[ovs-dev,ovs,V4,06/24] dpif-netlink: Flush added ports using netdev flow api

Submitted by Roi Dayan on March 13, 2017, 1:36 p.m.

Details

Message ID 1489412234-30916-7-git-send-email-roid@mellanox.com
State Superseded
Headers show

Commit Message

Roi Dayan March 13, 2017, 1:36 p.m.
From: Paul Blakey <paulb@mellanox.com>

If netdev flow offloading is enabled, flush all
added ports using netdev flow api.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
 lib/dpif-netlink.c |    5 +++++
 lib/netdev.c       |   12 ++++++++++++
 lib/netdev.h       |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 9762a87..0a2e429 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -1079,6 +1079,11 @@  dpif_netlink_flow_flush(struct dpif *dpif_)
     dpif_netlink_flow_init(&flow);
     flow.cmd = OVS_FLOW_CMD_DEL;
     flow.dp_ifindex = dpif->dp_ifindex;
+
+    if (netdev_flow_api_enabled) {
+        netdev_ports_flow_flush(DPIF_HMAP_KEY(dpif_));
+    }
+
     return dpif_netlink_flow_transact(&flow, NULL, NULL);
 }
 
diff --git a/lib/netdev.c b/lib/netdev.c
index e2016bd..40c2d1c 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -2225,6 +2225,18 @@  netdev_hmap_port_del(odp_port_t port_no, const void *obj)
     return ret;
 }
 
+void
+netdev_ports_flow_flush(const void *obj)
+{
+    struct port_to_netdev_data *data;
+
+    HMAP_FOR_EACH(data, node, &port_to_netdev) {
+        if (data->obj == obj) {
+            netdev_flow_flush(data->netdev);
+        }
+    }
+}
+
 bool netdev_flow_api_enabled = false;
 
 #ifdef __linux__
diff --git a/lib/netdev.h b/lib/netdev.h
index f494ea3..869d9c4 100644
--- a/lib/netdev.h
+++ b/lib/netdev.h
@@ -187,6 +187,7 @@  struct netdev *netdev_hmap_port_get(odp_port_t port, const void *obj);
 int netdev_hmap_port_del(odp_port_t port, const void *obj);
 struct netdev_flow_dump **netdev_ports_flow_dumps_create(const void *obj,
                                                          int *ports);
+void netdev_ports_flow_flush(const void *obj);
 odp_port_t netdev_hmap_port_get_byifidx(int ifindex);
 
 /* native tunnel APIs */