[ovs-dev] [PATCH ovs V3 16/25] netdev-tc-offloads: Implement netdev flow del using tc interface

Roi Dayan roid at mellanox.com
Wed Feb 8 15:29:29 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>
---
 lib/netdev-tc-offloads.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c
index 035f361..d1c7805 100644
--- a/lib/netdev-tc-offloads.c
+++ b/lib/netdev-tc-offloads.c
@@ -725,7 +725,33 @@ netdev_tc_flow_del(struct netdev *netdev OVS_UNUSED,
                    struct dpif_flow_stats *stats OVS_UNUSED,
                    const ovs_u128 *ufid OVS_UNUSED)
 {
-    return EOPNOTSUPP;
+    struct netdev *dev;
+    int prio = 0;
+    int ifindex;
+    int error;
+    int handle = get_ufid_tc_mapping(ufid, &prio, &dev);
+
+    if (!handle) {
+        return ENOENT;
+    }
+
+    ifindex = netdev_get_ifindex(dev);
+    if (ifindex < 0) {
+        VLOG_ERR_RL(&rl_err, "failed to get ifindex for %s: %s",
+                    netdev_get_name(dev), ovs_strerror(-ifindex));
+        netdev_close(dev);
+        return -ifindex;
+    }
+
+    error = tc_del_filter(ifindex, prio, handle);
+    del_ufid_tc_mapping(ufid);
+
+    netdev_close(dev);
+
+    if (stats) {
+        memset(stats, 0, sizeof(*stats));
+    }
+    return error;
 }
 
 int
-- 
2.7.4



More information about the dev mailing list