]> git.proxmox.com Git - mirror_ovs.git/commitdiff
netdev-tc-offloads: Fix probe tc block support
authorRaed Salem <raeds@mellanox.com>
Mon, 8 Apr 2019 12:42:11 +0000 (15:42 +0300)
committerSimon Horman <simon.horman@netronome.com>
Tue, 9 Apr 2019 08:04:39 +0000 (10:04 +0200)
Current implementation will try to create an qdisk of type ingress with
block id 1 to check for kernel ingress block support, this check is
insufficient as old kernels without ingress block support will
successfully create an ingress qdisc, ignoring the ingress block.

Fix by trying to add a test rule on the ingress block.

Fixes 093c9458fb02 ("tc: allow offloading of block ids")
Signed-off-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
lib/netdev-tc-offloads.c

index f5555e418e0d8870f72757a304d26a06e5620e2d..e57de3b47f3d464c5196060cd67a1fd5e3cb5f06 100644 (file)
@@ -1497,6 +1497,7 @@ out:
 static void
 probe_tc_block_support(int ifindex)
 {
+    struct tc_flower flower;
     uint32_t block_id = 1;
     int error;
 
@@ -1505,10 +1506,21 @@ probe_tc_block_support(int ifindex)
         return;
     }
 
+    memset(&flower, 0, sizeof flower);
+
+    flower.key.eth_type = htons(ETH_P_IP);
+    flower.mask.eth_type = OVS_BE16_MAX;
+    memset(&flower.key.dst_mac, 0x11, sizeof flower.key.dst_mac);
+    memset(&flower.mask.dst_mac, 0xff, sizeof flower.mask.dst_mac);
+
+    error = tc_replace_flower(ifindex, 1, 1, &flower, block_id);
+
     tc_add_del_ingress_qdisc(ifindex, false, block_id);
 
-    block_support = true;
-    VLOG_INFO("probe tc: block offload is supported.");
+    if (!error) {
+        block_support = true;
+        VLOG_INFO("probe tc: block offload is supported.");
+    }
 }
 
 int