Acked-by: Daniele Di Proietto <[email protected]> Thanks
2016-06-09 17:46 GMT-07:00 Jesse Gross <[email protected]>: > When calling odp_flow_key_from_flow (or _mask), the in_port included > as part of the flow is ignored and must be explicitly passed as a > separate parameter. This is because the assumption was that the flow's > version would often be in OFP format, rather than ODP. > > However, at this point all flows that are ready for serialization in > netlink format already have their in_port properly set to ODP format. > As a result, every caller needs to explicitly initialize the extra > paramter to the value that is in the flow. This switches to just use > the value in the flow to simply things and avoid the possibility of > forgetting to initialize the extra parameter. > > Signed-off-by: Jesse Gross <[email protected]> > --- > lib/dpif-netdev.c | 3 --- > lib/odp-util.c | 6 +++--- > lib/odp-util.h | 6 ------ > lib/tnl-ports.c | 2 -- > ofproto/ofproto-dpif-upcall.c | 3 --- > tests/test-odp.c | 1 - > 6 files changed, 3 insertions(+), 18 deletions(-) > > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c > index fcfd22e..f42d2da 100644 > --- a/lib/dpif-netdev.c > +++ b/lib/dpif-netdev.c > @@ -1942,14 +1942,12 @@ dp_netdev_flow_to_dpif_flow(const struct > dp_netdev_flow *netdev_flow, > /* Key */ > offset = key_buf->size; > flow->key = ofpbuf_tail(key_buf); > - odp_parms.odp_in_port = netdev_flow->flow.in_port.odp_port; > odp_flow_key_from_flow(&odp_parms, key_buf); > flow->key_len = key_buf->size - offset; > > /* Mask */ > offset = mask_buf->size; > flow->mask = ofpbuf_tail(mask_buf); > - odp_parms.odp_in_port = wc.masks.in_port.odp_port; > odp_parms.key_buf = key_buf; > odp_flow_key_from_mask(&odp_parms, mask_buf); > flow->mask_len = mask_buf->size - offset; > @@ -3518,7 +3516,6 @@ dp_netdev_upcall(struct dp_netdev_pmd_thread *pmd, > struct dp_packet *packet_, > struct odp_flow_key_parms odp_parms = { > .flow = flow, > .mask = &wc->masks, > - .odp_in_port = flow->in_port.odp_port, > .support = dp_netdev_support, > }; > > diff --git a/lib/odp-util.c b/lib/odp-util.c > index d9ace90..289b969 100644 > --- a/lib/odp-util.c > +++ b/lib/odp-util.c > @@ -4274,10 +4274,10 @@ odp_flow_key_from_flow__(const struct > odp_flow_key_parms *parms, > nl_msg_put_u32(buf, OVS_KEY_ATTR_DP_HASH, data->dp_hash); > } > > - /* Add an ingress port attribute if this is a mask or 'odp_in_port' > + /* Add an ingress port attribute if this is a mask or > 'in_port.odp_port' > * is not the magical value "ODPP_NONE". */ > - if (export_mask || parms->odp_in_port != ODPP_NONE) { > - nl_msg_put_odp_port(buf, OVS_KEY_ATTR_IN_PORT, > parms->odp_in_port); > + if (export_mask || flow->in_port.odp_port != ODPP_NONE) { > + nl_msg_put_odp_port(buf, OVS_KEY_ATTR_IN_PORT, > data->in_port.odp_port); > } > > eth_key = nl_msg_put_unspec_uninit(buf, OVS_KEY_ATTR_ETHERNET, > diff --git a/lib/odp-util.h b/lib/odp-util.h > index 51cf5c3..2c3cc8c 100644 > --- a/lib/odp-util.h > +++ b/lib/odp-util.h > @@ -194,12 +194,6 @@ struct odp_flow_key_parms { > const struct flow *flow; > const struct flow *mask; > > - /* 'flow->in_port' is ignored (since it is likely to be an OpenFlow > port > - * number rather than a datapath port number). Instead, if > 'odp_in_port' > - * is anything other than ODPP_NONE, it is included in 'buf' as the > input > - * port. */ > - odp_port_t odp_in_port; > - > /* Indicates support for various fields. If the datapath supports a > field, > * then it will always be serialised. */ > struct odp_support support; > diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c > index e8d43f0..e945eae 100644 > --- a/lib/tnl-ports.c > +++ b/lib/tnl-ports.c > @@ -316,7 +316,6 @@ tnl_port_show_v(struct ds *ds) > miniflow_expand(p->cr.match.flow, &flow); > > /* Key. */ > - odp_parms.odp_in_port = flow.in_port.odp_port; > odp_parms.support.recirc = true; > ofpbuf_use_stack(&buf, &keybuf, sizeof keybuf); > odp_flow_key_from_flow(&odp_parms, &buf); > @@ -324,7 +323,6 @@ tnl_port_show_v(struct ds *ds) > key_len = buf.size; > > /* mask*/ > - odp_parms.odp_in_port = wc.masks.in_port.odp_port; > odp_parms.support.recirc = false; > ofpbuf_use_stack(&buf, &maskbuf, sizeof maskbuf); > odp_flow_key_from_mask(&odp_parms, &buf); > diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c > index 9400ef9..b947da9 100644 > --- a/ofproto/ofproto-dpif-upcall.c > +++ b/ofproto/ofproto-dpif-upcall.c > @@ -1491,16 +1491,13 @@ ukey_create_from_upcall(struct upcall *upcall, > struct flow_wildcards *wc) > /* dpif-netdev doesn't provide a netlink-formatted flow key in the > * upcall, so convert the upcall's flow here. */ > ofpbuf_use_stack(&keybuf, &keystub, sizeof keystub); > - odp_parms.odp_in_port = upcall->flow->in_port.odp_port; > odp_flow_key_from_flow(&odp_parms, &keybuf); > } > > atomic_read_relaxed(&enable_megaflows, &megaflow); > ofpbuf_use_stack(&maskbuf, &maskstub, sizeof maskstub); > if (megaflow) { > - odp_parms.odp_in_port = wc->masks.in_port.odp_port; > odp_parms.key_buf = &keybuf; > - > odp_flow_key_from_mask(&odp_parms, &maskbuf); > } > > diff --git a/tests/test-odp.c b/tests/test-odp.c > index 602a6b6..8e4db09 100644 > --- a/tests/test-odp.c > +++ b/tests/test-odp.c > @@ -86,7 +86,6 @@ parse_keys(bool wc_keys) > /* Convert cls_rule back to odp_key. */ > ofpbuf_uninit(&odp_key); > ofpbuf_init(&odp_key, 0); > - odp_parms.odp_in_port = flow.in_port.odp_port; > odp_flow_key_from_flow(&odp_parms, &odp_key); > > if (odp_key.size > ODPUTIL_FLOW_KEY_BYTES) { > -- > 2.5.0 > > _______________________________________________ > dev mailing list > [email protected] > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
