diff mbox series

[ovs-dev,v2,branch-2.14,1/3] tc: Use skip_hw flag when probing tc features

Message ID 20210419122504.3519344-2-aconole@redhat.com
State Accepted
Headers show
Series Backport ct-offload state flag support | expand

Commit Message

Aaron Conole April 19, 2021, 12:25 p.m. UTC
From: Roi Dayan <roid@mellanox.com>

There is no need to pass tc rules to hw when just probing
for tc features. this will avoid redundant errors from hw drivers
that may happen.

Signed-off-by: Roi Dayan <roid@mellanox.com>
Acked-By: Vlad Buslov <vladbu@mellanox.com>
Reviewed-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
(cherry picked from commit d5659751f65ebc17d9aec40b60c1cff3a2d87162)
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 lib/netdev-offload-tc.c |  2 ++
 lib/tc.c                | 13 ++++++-------
 lib/tc.h                | 10 ++++++++++
 3 files changed, 18 insertions(+), 7 deletions(-)

Comments

0-day Robot April 19, 2021, 12:59 p.m. UTC | #1
Bleep bloop.  Greetings Aaron Conole, 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.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Simon Horman <simon.horman@netronome.com>, Aaron Conole <aconole@redhat.com>
Lines checked: 110, Warnings: 1, Errors: 0


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/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index 0da8abe45b..71cea41da4 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -1939,6 +1939,7 @@  probe_multi_mask_per_prio(int ifindex)
 
     memset(&flower, 0, sizeof flower);
 
+    flower.tc_policy = TC_POLICY_SKIP_HW;
     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);
@@ -2076,6 +2077,7 @@  probe_tc_block_support(int ifindex)
 
     memset(&flower, 0, sizeof flower);
 
+    flower.tc_policy = TC_POLICY_SKIP_HW;
     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);
diff --git a/lib/tc.c b/lib/tc.c
index 44abcd3a12..3192207984 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -65,12 +65,6 @@  VLOG_DEFINE_THIS_MODULE(tc);
 
 static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(60, 5);
 
-enum tc_offload_policy {
-    TC_POLICY_NONE,
-    TC_POLICY_SKIP_SW,
-    TC_POLICY_SKIP_HW
-};
-
 static enum tc_offload_policy tc_policy = TC_POLICY_NONE;
 
 struct tc_pedit_key_ex {
@@ -2759,6 +2753,7 @@  nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower)
     bool is_vlan = eth_type_vlan(flower->key.eth_type);
     bool is_qinq = is_vlan && eth_type_vlan(flower->key.encap_eth_type[0]);
     bool is_mpls = eth_type_mpls(flower->key.eth_type);
+    enum tc_offload_policy policy = flower->tc_policy;
     int err;
 
     /* need to parse acts first as some acts require changing the matching
@@ -2884,7 +2879,11 @@  nl_msg_put_flower_options(struct ofpbuf *request, struct tc_flower *flower)
         }
     }
 
-    nl_msg_put_u32(request, TCA_FLOWER_FLAGS, tc_get_tc_cls_policy(tc_policy));
+    if (policy == TC_POLICY_NONE) {
+        policy = tc_policy;
+    }
+
+    nl_msg_put_u32(request, TCA_FLOWER_FLAGS, tc_get_tc_cls_policy(policy));
 
     if (flower->tunnel) {
         nl_msg_put_flower_tunnel(request, flower);
diff --git a/lib/tc.h b/lib/tc.h
index 028eed5d06..281231c0d3 100644
--- a/lib/tc.h
+++ b/lib/tc.h
@@ -312,6 +312,14 @@  is_tcf_id_eq(struct tcf_id *id1, struct tcf_id *id2)
            && id1->chain == id2->chain;
 }
 
+enum tc_offload_policy {
+    TC_POLICY_NONE = 0,
+    TC_POLICY_SKIP_SW,
+    TC_POLICY_SKIP_HW
+};
+
+BUILD_ASSERT_DECL(TC_POLICY_NONE == 0);
+
 struct tc_flower {
     struct tc_flower_key key;
     struct tc_flower_key mask;
@@ -337,6 +345,8 @@  struct tc_flower {
     bool needs_full_ip_proto_mask;
 
     enum tc_offloaded_state offloaded_state;
+    /* Used to force skip_hw when probing tc features. */
+    enum tc_offload_policy tc_policy;
 };
 
 /* assert that if we overflow with a masked write of uint32_t to the last byte