netdev-offload-dpdk: Use has_vlan match attribute.
DPDK 20.11 introduced an ability to specify existance/non-existance of
VLAN tag by [1].
Use this attribute.
[1]: ("ethdev: add VLAN attributes to ethernet and VLAN items")
@@ -363,6 +363,8 @@ dump_flow_pattern(struct ds *s,
ds_put_cstr(s, "eth ");
if (eth_spec) {
+ uint32_t has_vlan_mask;
+
if (!eth_mask) {
eth_mask = &rte_flow_item_eth_mask;
}
@@ -377,6 +379,9 @@ dump_flow_pattern(struct ds *s,
DUMP_PATTERN_ITEM(eth_mask->type, false, "type", "0x%04"PRIx16,
ntohs(eth_spec->type),
ntohs(eth_mask->type), 0);
+ has_vlan_mask = eth_mask->has_vlan ? UINT32_MAX : 0;
+ DUMP_PATTERN_ITEM(has_vlan_mask, false, "has_vlan", "%d",
+ eth_spec->has_vlan, eth_mask->has_vlan, 0);
}
ds_put_cstr(s, "/ ");
} else if (item->type == RTE_FLOW_ITEM_TYPE_VLAN) {
@@ -1369,6 +1374,7 @@ parse_flow_match(struct netdev *netdev,
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;
@@ -1414,6 +1420,11 @@ parse_flow_match(struct netdev *netdev,
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, NULL);
}
@@ -1430,6 +1441,11 @@ parse_flow_match(struct netdev *netdev,
/* 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, NULL);
}
/* For untagged matching match->wc.masks.vlans[0].tci is 0xFFFF and
