[ovs-dev,ovs,V4,24/24] netdev: Init flow api on already added ports on offload enable

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

Details

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

Commit Message

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

Ports already added to a switch are not being initialized for offloading
so when enabling offload we need to go over those ports.

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

Patch hide | download patch | download mbox

diff --git a/lib/netdev.c b/lib/netdev.c
index e7d74ca..047269d 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -2303,6 +2303,18 @@  netdev_ports_flow_get(const void *obj, struct match *match,
 bool netdev_flow_api_enabled = false;
 
 #ifdef __linux__
+static void
+netdev_ports_flow_init(void)
+{
+    struct port_to_netdev_data *data;
+
+    ovs_mutex_lock(&netdev_hmap_mutex);
+    HMAP_FOR_EACH(data, node, &port_to_netdev) {
+       netdev_init_flow_api(data->netdev);
+    }
+    ovs_mutex_unlock(&netdev_hmap_mutex);
+}
+
 void
 netdev_set_flow_api_enabled(const struct smap *ovs_other_config)
 {
@@ -2317,6 +2329,8 @@  netdev_set_flow_api_enabled(const struct smap *ovs_other_config)
             tc_set_policy(smap_get_def(ovs_other_config, "tc-policy",
                                        TC_POLICY_DEFAULT));
 
+            netdev_ports_flow_init();
+
             ovsthread_once_done(&once);
         }
     }