summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gross <jesse@kernel.org>2016-06-09 13:32:50 -0700
committerJesse Gross <jesse@kernel.org>2016-06-13 13:28:39 -0700
commit098d2a9777f0d986220d278c0095eae42eaadf21 (patch)
treec7096584ef1bd8daaedcc51d960c9c1e01dabed9
parentd1d7816bec0ddc005e99df8d39c8c280ce8b4115 (diff)
downloadopenvswitch-098d2a9777f0d986220d278c0095eae42eaadf21.tar.gz
odp-util: Remove odp_in_port from struct odp_flow_key_parms.
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 <jesse@kernel.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
-rw-r--r--lib/dpif-netdev.c3
-rw-r--r--lib/odp-util.c6
-rw-r--r--lib/odp-util.h6
-rw-r--r--lib/tnl-ports.c2
-rw-r--r--ofproto/ofproto-dpif-upcall.c3
-rw-r--r--tests/test-odp.c1
6 files changed, 3 insertions, 18 deletions
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index fcfd22ec8..f42d2dabc 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 d9ace9042..289b969c1 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 51cf5c368..2c3cc8c9d 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 e8d43f0f1..e945eae24 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 9400ef963..b947da927 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 602a6b611..8e4db09c8 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) {