[ovs-dev] [PATCH 1/2] netdev-offload-dpdk: Use has_vlan match attribute
Eli Britstein
elibr at nvidia.com
Sun Mar 14 15:25:27 UTC 2021
DPDK 20.11 introduced an ability to specify existance/non-existance of
VLAN tag by [1].
Use this attribute.
[1]: 09315fc83861 ("ethdev: add VLAN attributes to ethernet and VLAN items")
Signed-off-by: Eli Britstein <elibr at nvidia.com>
Reviewed-by: Salem Sol <salems at nvidia.com>
---
lib/netdev-offload-dpdk.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index f2413f5be..efcae08d2 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -169,6 +169,8 @@ dump_flow_pattern(struct ds *s, const struct rte_flow_item *item)
ds_put_cstr(s, "eth ");
if (eth_spec) {
+ uint32_t has_vlan_mask;
+
if (!eth_mask) {
eth_mask = &rte_flow_item_eth_mask;
}
@@ -181,6 +183,9 @@ dump_flow_pattern(struct ds *s, const struct rte_flow_item *item)
DUMP_PATTERN_ITEM(eth_mask->type, "type", "0x%04"PRIx16,
ntohs(eth_spec->type),
ntohs(eth_mask->type));
+ has_vlan_mask = eth_mask->has_vlan ? UINT32_MAX : 0;
+ DUMP_PATTERN_ITEM(has_vlan_mask, "has_vlan", "%d",
+ eth_spec->has_vlan, eth_mask->has_vlan);
}
ds_put_cstr(s, "/ ");
} else if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {
@@ -676,6 +681,7 @@ static int
parse_flow_match(struct flow_patterns *patterns,
struct match *match)
{
+ struct rte_flow_item_eth *eth_spec = NULL, *eth_mask = NULL;
struct flow *consumed_masks;
uint8_t proto = 0;
@@ -714,6 +720,11 @@ parse_flow_match(struct flow_patterns *patterns,
memset(&consumed_masks->dl_src, 0, sizeof consumed_masks->dl_src);
consumed_masks->dl_type = 0;
+ spec->has_vlan = 0;
+ mask->has_vlan = 1;
+ eth_spec = spec;
+ eth_mask = mask;
+
add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_ETH, spec, mask);
}
@@ -730,6 +741,11 @@ parse_flow_match(struct flow_patterns *patterns,
/* Match any protocols. */
mask->inner_type = 0;
+ if (eth_spec && eth_mask) {
+ eth_spec->has_vlan = 1;
+ eth_mask->has_vlan = 1;
+ }
+
add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_VLAN, spec, mask);
}
/* For untagged matching match->wc.masks.vlans[0].tci is 0xFFFF and
--
2.28.0.2311.g225365fb51
More information about the dev
mailing list