diff mbox series

[ovs-dev,V2,1/2] netdev-offload-dpdk: Use has_vlan match attribute

Message ID 20210713051711.9404-1-elibr@nvidia.com
State Superseded
Headers show
Series [ovs-dev,V2,1/2] netdev-offload-dpdk: Use has_vlan match attribute | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot success github build: passed

Commit Message

Eli Britstein July 13, 2021, 5:17 a.m. UTC
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@nvidia.com>
Reviewed-by: Salem Sol <salems@nvidia.com>
---
 lib/netdev-offload-dpdk.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index e7913292e..3e0d0643b 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -210,6 +210,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;
             }
@@ -222,6 +224,9 @@  dump_flow_pattern(struct ds *s,
             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) {
@@ -1037,6 +1042,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;
 
@@ -1082,6 +1088,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);
     }
 
@@ -1098,6 +1109,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);
     }
     /* For untagged matching match->wc.masks.vlans[0].tci is 0xFFFF and