meta-flow: Make 'in_port' field writable.
authorBen Pfaff <blp@nicira.com>
Mon, 6 May 2013 22:38:36 +0000 (15:38 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 8 May 2013 17:57:10 +0000 (10:57 -0700)
commitd9c782a7cca985b40b6e88e2d3e647dfcb22589c
tree6e7134c10ff739dedd09b4f47bfc0b12bba7ef4e
parenta75faeef3cb4084105c214db596f119526494645
meta-flow: Make 'in_port' field writable.

OpenFlow says that an "output" action to a flow's input port is ordinarily
dropped, unless the flow explicitly outputs to OFPP_IN_PORT.  We've
occasionally been asked to implement some way to avoid this behavior in
cases where it is not easily known in advance whether a given port is the
input port (so that OFPP_IN_PORT is not easy to use).

This commit implements such a feature.  With this commit, one may write:
    actions=load:0->NXM_OF_IN_PORT[],output:123
which will output to port 123 regardless of whether it is the input port.
If the input port is important, then one may save and restore it on the
stack:
    actions=push:NXM_OF_IN_PORT[],load:0->NXM_OF_IN_PORT[],output:123,
            pop:NXM_OF_IN_PORT[]

(Sometimes I am asked whether "resubmit" changes the in_port and would
therefore interact badly with this feature.  It does not.   "resubmit" only
(optionally) changes the in_port used for the resubmit's flow table lookup.
It does not otherwise have any effect on in_port.)

Bug #14091.
CC: Jarno Rajahalme <jarno.rajahalme@nsn.com>
CC: Ronghua Zhang <rzhang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
NEWS
include/openflow/nicira-ext.h
lib/meta-flow.c
tests/ofproto-dpif.at