[ovs-dev] [PATCH ovs V8 20/26] netdev-tc-offloads: Add ingress on netdev flow api init

Roi Dayan roid at mellanox.com
Wed May 3 15:08:11 UTC 2017


From: Paul Blakey <paulb at mellanox.com>

Signed-off-by: Paul Blakey <paulb at mellanox.com>
Reviewed-by: Roi Dayan <roid at mellanox.com>
Reviewed-by: Simon Horman <simon.horman at netronome.com>
---
 lib/netdev-tc-offloads.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c
index c3eddf4..4fc0445 100644
--- a/lib/netdev-tc-offloads.c
+++ b/lib/netdev-tc-offloads.c
@@ -72,6 +72,7 @@
 #include "openvswitch/match.h"
 #include "openvswitch/vlog.h"
 #include "tc.h"
+#include "netdev-linux.h"
 
 VLOG_DEFINE_THIS_MODULE(netdev_tc_offloads);
 
@@ -934,8 +935,28 @@ netdev_tc_flow_del(struct netdev *netdev OVS_UNUSED,
 }
 
 int
-netdev_tc_init_flow_api(struct netdev *netdev OVS_UNUSED)
+netdev_tc_init_flow_api(struct netdev *netdev)
 {
+    int ifindex;
+    int error;
+
+    ifindex = netdev_get_ifindex(netdev);
+    if (ifindex < 0) {
+        VLOG_ERR_RL(&rl_err, "failed to get ifindex for %s: %s",
+                    netdev_get_name(netdev), ovs_strerror(-ifindex));
+        return -ifindex;
+    }
+
+    error = tc_add_del_ingress_qdisc(ifindex, true);
+
+    if (error && error != EEXIST) {
+        VLOG_ERR("failed adding ingress qdisc required for offloading: %s",
+                 ovs_strerror(error));
+        return error;
+    }
+
+    VLOG_INFO("added ingress qdisc to %s", netdev_get_name(netdev));
+
     return 0;
 }
 
-- 
2.7.4



More information about the dev mailing list