Looks good, thanks :-) Jarno
On May 7, 2013, at 1:38 , ext Ben Pfaff wrote: > 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.rajaha...@nsn.com> > CC: Ronghua Zhang <rzh...@nicira.com> > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > NEWS | 4 ++++ > include/openflow/nicira-ext.h | 2 ++ > lib/meta-flow.c | 2 +- > tests/ofproto-dpif.at | 5 +++-- > 4 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/NEWS b/NEWS > index 3a7123b..87f9bde 100644 > --- a/NEWS > +++ b/NEWS > @@ -1,5 +1,9 @@ > post-v1.11.0 > --------------------- > + - OpenFlow: > + * The "load" and "set_field" actions can now modify the "in_port". > (This > + allows one to enable output to a flow's input port by setting the > + in_port to some unused value, such as OFPP_NONE.) > > > v1.11.0 - xx xxx xxxx > diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h > index c80ff95..8c9fab1 100644 > --- a/include/openflow/nicira-ext.h > +++ b/include/openflow/nicira-ext.h > @@ -493,6 +493,8 @@ OFP_ASSERT(sizeof(struct nx_action_pop_queue) == 16); > * Modifying any of the above fields changes the corresponding packet > * header. > * > + * - NXM_OF_IN_PORT > + * > * - NXM_NX_REG(idx) for idx in the switch's accepted range. > * > * - NXM_OF_VLAN_TCI. Modifying this field's value has side effects on the > diff --git a/lib/meta-flow.c b/lib/meta-flow.c > index 9296faa..a75e526 100644 > --- a/lib/meta-flow.c > +++ b/lib/meta-flow.c > @@ -114,7 +114,7 @@ static const struct mf_field mf_fields[MFF_N_IDS] = { > MFM_NONE, > MFS_OFP_PORT, > MFP_NONE, > - false, > + true, > NXM_OF_IN_PORT, "NXM_OF_IN_PORT", > OXM_OF_IN_PORT, "OXM_OF_IN_PORT", > }, { > diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at > index 2b9df96..1fdbac3 100644 > --- a/tests/ofproto-dpif.at > +++ b/tests/ofproto-dpif.at > @@ -92,18 +92,19 @@ AT_SETUP([ofproto-dpif - output]) > OVS_VSWITCHD_START > ADD_OF_PORTS([br0], [1], [9], [10], [11], [55], [66], [77], [88]) > AT_DATA([flows.txt], [dnl > -in_port=1 > actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7 > +in_port=1 > actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8 > in_port=2 actions=output:9 > in_port=3 > actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]] > in_port=4 > actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11 > in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]] > in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]] > in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]] > +in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9 > ]) > AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) > AT_CHECK([ovs-appctl ofproto/trace br0 > 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], > [0], [stdout]) > AT_CHECK([tail -1 stdout], [0], > - [Datapath actions: 9,55,10,55,66,11,77,88 > + [Datapath actions: 9,55,10,55,66,11,77,88,9,1 > ]) > OVS_VSWITCHD_STOP > AT_CLEANUP > -- > 1.7.2.5 > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev