[ovs-dev] [PATCH V10 25/33] netdev-tc-offloads: Add ingress on netdev flow api init
Roi Dayan
roid at mellanox.com
Thu Jun 8 11:46:42 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 d1036d1..26f1c1b 100644
--- a/lib/netdev-tc-offloads.c
+++ b/lib/netdev-tc-offloads.c
@@ -33,6 +33,7 @@
#include "hash.h"
#include "dpif.h"
#include "tc.h"
+#include "netdev-linux.h"
VLOG_DEFINE_THIS_MODULE(netdev_tc_offloads);
@@ -923,7 +924,27 @@ 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(&error_rl, "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