[ovs-dev,V2] netdev-tc-offloads: Fix vxlan tunnel offloading

Message ID 1505311498-13843-1-git-send-email-roid@mellanox.com
State New
Headers show
  • [ovs-dev,V2] netdev-tc-offloads: Fix vxlan tunnel offloading
Related show

Commit Message

Roi Dayan Sept. 13, 2017, 2:04 p.m.
From: Paul Blakey <paulb@mellanox.com>

This commit fixes offloading when tunnel id is 0 by checking
for valid tunnel dst ipv4 or ipv6, like done in the normal flow.

Also need to reset the tunnel mask outside the condition
because in the special case, when adding a port with key=flow,
the match for tunnel_set gets a tunnel key id 0 with a mask.
If we don't reset the mask we'll fail later when we check
for unknown attributes that the mask was not reset.

Fixes: 8f283af89298 ("netdev-tc-offloads: Implement netdev flow put using tc interface")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>

This is V2 for the prev patch with
title "netdev-tc-offloads: Fix offloading when tunnel id is 0"

    - Use flow_tnl_dst_is_set() instead of checking mask
    - Move memset of maks tunnel to outside the condition
    - Update commit message


 lib/netdev-tc-offloads.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)


diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c
index 3c145c2..524c7dc 100644
--- a/lib/netdev-tc-offloads.c
+++ b/lib/netdev-tc-offloads.c
@@ -683,7 +683,7 @@  netdev_tc_flow_put(struct netdev *netdev, struct match *match,
     memset(&flower, 0, sizeof flower);
-    if (tnl->tun_id) {
+    if (flow_tnl_dst_is_set(&key->tunnel)) {
                     "tunnel: id %#" PRIx64 " src " IP_FMT
                     " dst " IP_FMT " tp_src %d tp_dst %d",
@@ -698,9 +698,8 @@  netdev_tc_flow_put(struct netdev *netdev, struct match *match,
         flower.tunnel.tp_src = tnl->tp_src;
         flower.tunnel.tp_dst = tnl->tp_dst;
         flower.tunnel.tunnel = true;
-        memset(&mask->tunnel, 0, sizeof mask->tunnel);
+    memset(&mask->tunnel, 0, sizeof mask->tunnel);
     flower.key.eth_type = key->dl_type;
     flower.mask.eth_type = mask->dl_type;