diff mbox series

[ovs-dev,v2,1/1] tc: Fix cleaning chains

Message ID 20230427113258.2508263-1-roid@nvidia.com
State Accepted
Commit 77d82289857f5cdcaaf4be06e17e750edcf0abd3
Headers show
Series [ovs-dev,v2,1/1] tc: Fix cleaning chains | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Roi Dayan April 27, 2023, 11:32 a.m. UTC
Sometimes there is a need to clean empty chains as done in
delete_chains_from_netdev().  The cited commit doesn't remove
the chain completely which cause adding ingress_block later to fail.
This can be reproduced with adding bond as ovs port which makes ovs
use ingress_block for it.
While at it add the netdev name that fails to the log.

Fixes: e1e5eac5b016 ("tc: Add TCA_KIND flower to delete and get operation to avoid rtnl_lock().")
Signed-off-by: Roi Dayan <roid@nvidia.com>
---

Change-log

v2:
- Add comment in code about using tc del filter without TCA_KIND.


 lib/netdev-offload-tc.c | 11 ++++++++---
 lib/tc.c                |  4 +++-
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Ilya Maximets April 28, 2023, 6:27 p.m. UTC | #1
On 4/27/23 13:32, Roi Dayan wrote:
> Sometimes there is a need to clean empty chains as done in
> delete_chains_from_netdev().  The cited commit doesn't remove
> the chain completely which cause adding ingress_block later to fail.
> This can be reproduced with adding bond as ovs port which makes ovs
> use ingress_block for it.
> While at it add the netdev name that fails to the log.
> 
> Fixes: e1e5eac5b016 ("tc: Add TCA_KIND flower to delete and get operation to avoid rtnl_lock().")
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> ---
> 
> Change-log
> 
> v2:
> - Add comment in code about using tc del filter without TCA_KIND.

Applied.  Thanks!

Backported down to 2.17.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index c9662081fc60..4f26dd8cca5f 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -525,7 +525,11 @@  delete_chains_from_netdev(struct netdev *netdev, struct tcf_id *id)
          */
         HMAP_FOR_EACH_POP (chain_node, node, &map) {
             id->chain = chain_node->chain;
-            tc_del_flower_filter(id);
+            /* Delete empty chain doesn't seem to work with
+             * tc_del_flower_filter() so use tc_del_filter()
+             * without specifying TCA_KIND.
+             */
+            tc_del_filter(id, NULL);
             free(chain_node);
         }
     }
@@ -2879,8 +2883,9 @@  netdev_tc_init_flow_api(struct netdev *netdev)
     error = tc_add_del_qdisc(ifindex, true, block_id, hook);
 
     if (error && error != EEXIST) {
-        VLOG_INFO("failed adding ingress qdisc required for offloading: %s",
-                  ovs_strerror(error));
+        VLOG_INFO("failed adding ingress qdisc required for offloading "
+                  "on %s: %s",
+                  netdev_get_name(netdev), ovs_strerror(error));
         return error;
     }
 
diff --git a/lib/tc.c b/lib/tc.c
index 4c07e22162e7..5c32c6f971da 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -2354,7 +2354,9 @@  tc_del_filter(struct tcf_id *id, const char *kind)
     struct ofpbuf request;
 
     request_from_tcf_id(id, 0, RTM_DELTFILTER, NLM_F_ACK, &request);
-    nl_msg_put_string(&request, TCA_KIND, kind);
+    if (kind) {
+        nl_msg_put_string(&request, TCA_KIND, kind);
+    }
     return tc_transact(&request, NULL);
 }