Skip to content

Commit

Permalink
netdev-offload-dpdk: Use has_vlan match attribute.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Salem Sol <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
elibritstein authored and igsilya committed May 4, 2022
1 parent 7d35554 commit 9b7ed5f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/netdev-offload-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand All @@ -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
Expand Down

0 comments on commit 9b7ed5f

Please sign in to comment.