diff mbox series

[ovs-dev,v2] netdev_offload_dpdk: Support QinQ offload.

Message ID 20241125100853.978-1-allen.chen@jaguarmicro.com
State New
Delegated to: Kevin Traynor
Headers show
Series [ovs-dev,v2] netdev_offload_dpdk: Support QinQ offload. | expand

Checks

Context Check Description
ovsrobot/apply-robot fail apply and check: fail

Commit Message

Allen Chen Nov. 25, 2024, 10:08 a.m. UTC
Support QinQ offload

Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>
---
 NEWS                      |  5 +++++
 lib/netdev-offload-dpdk.c | 31 +++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

Comments

0-day Robot Nov. 26, 2024, 7:18 p.m. UTC | #1
References:  <20241125100853.978-1-allen.chen@jaguarmicro.com>
 

Bleep bloop.  Greetings Allen Chen, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 netdev_offload_dpdk: Support QinQ offload.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Patch skipped due to previous failure.

Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index 03ad245ab..39456fc21 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@ 
+v3.4.0 - 20 Nov 2024
+---------------------
+    - Add support for QinQ offload.
+
+
 v3.4.0 - 12 Nov 2024
 ---------------------
     - Add support for ICMPV6 offload.
diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 1ec5d175b..956bb9198 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -1399,6 +1399,7 @@  parse_flow_match(struct netdev *netdev,
                  struct match *match)
 {
     struct rte_flow_item_eth *eth_spec = NULL, *eth_mask = NULL;
+    struct rte_flow_item_vlan *vlan_spec = NULL, *vlan_mask = NULL;
     struct flow *consumed_masks;
     uint8_t proto = 0;
 
@@ -1471,6 +1472,9 @@  parse_flow_match(struct netdev *netdev,
             eth_mask->type = match->wc.masks.vlans[0].tpid;
         }
 
+        vlan_spec = spec;
+        vlan_mask = mask;
+
         add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_VLAN, spec, mask, NULL);
     }
     /* For untagged matching match->wc.masks.vlans[0].tci is 0xFFFF and
@@ -1479,6 +1483,33 @@  parse_flow_match(struct netdev *netdev,
      */
     memset(&consumed_masks->vlans[0], 0, sizeof consumed_masks->vlans[0]);
 
+    /* VLAN */
+    if (match->wc.masks.vlans[1].tci && match->flow.vlans[1].tci) {
+        struct rte_flow_item_vlan *spec, *mask;
+
+        spec = xzalloc(sizeof *spec);
+        mask = xzalloc(sizeof *mask);
+
+        spec->tci = match->flow.vlans[1].tci & ~htons(VLAN_CFI);
+        mask->tci = match->wc.masks.vlans[1].tci & ~htons(VLAN_CFI);
+
+        if (vlan_spec && vlan_mask) {
+            vlan_spec->has_more_vlan = 1;
+            vlan_mask->has_more_vlan = 1;
+            spec->inner_type = vlan_spec->inner_type;
+            mask->inner_type = vlan_mask->inner_type;
+            vlan_spec->inner_type = match->flow.vlans[1].tpid;
+            vlan_mask->inner_type = match->wc.masks.vlans[1].tpid;
+        }
+
+        add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_VLAN, spec, mask, NULL);
+    }
+    /* For untagged matching match->wc.masks.vlans[0].tci is 0xFFFF and
+     * match->flow.vlans[0].tci is 0. Consuming is needed outside of the if
+     * scope to handle that.
+     */
+    memset(&consumed_masks->vlans[1], 0, sizeof consumed_masks->vlans[1]);
+
     /* IP v4 */
     if (match->flow.dl_type == htons(ETH_TYPE_IP)) {
         struct rte_flow_item_ipv4 *spec, *mask, *last = NULL;