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:22:43 +0000 (10:22 -0700)
commit557323cd11f0b02c0dc755f65699895df02781de
tree33c308698d33fa9de4e751c4ace385a3be0cfee2
parent94aa0d197d3898264ed9761dd5a2089fed40fca3
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