When enable tc-offload, we should add coverage counters for netdev_set_policing.

Fixes: e7f6ba220e10 ("lib/tc: add ingress ratelimiting support for tc-offload")
Cc: Pieter Jansen van Vuuren <[email protected]>
Signed-off-by: Tonghao Zhang <[email protected]>
Reviewed-by: Pieter Jansen van Vuuren <[email protected]>
---
 lib/netdev-linux.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 84e2f52..f75d73f 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2470,10 +2470,7 @@ netdev_linux_set_policing(struct netdev *netdev_,
         netdev->cache_valid &= ~VALID_POLICING;
     }
 
-    error = get_ifindex(netdev_, &ifindex);
-    if (error) {
-        goto out;
-    }
+    COVERAGE_INC(netdev_set_policing);
 
     /* Use matchall for policing when offloadling ovs with tc-flower. */
     if (netdev_is_flow_api_enabled()) {
@@ -2485,7 +2482,11 @@ netdev_linux_set_policing(struct netdev *netdev_,
         return error;
     }
 
-    COVERAGE_INC(netdev_set_policing);
+    error = get_ifindex(netdev_, &ifindex);
+    if (error) {
+        goto out;
+    }
+
     /* Remove any existing ingress qdisc. */
     error = tc_add_del_qdisc(ifindex, false, 0, TC_INGRESS);
     if (error) {
-- 
1.8.3.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to