From: wenxu <we...@chinatelecom.cn>

The netdev-offload in tc mode can't work with flow-restore-wait.
When the vswitchd restart with flow-restore-wait, the tc qdisc
will be delete in netdev_set_flow_api_enabled. The netdev flow
api can be enabled after the flow-restore-wait flag removing.

Signed-off-by: wenxu <we...@chinatelecom.cn>
---
 lib/netdev-offload.c |  6 ++++--
 lib/netdev-offload.h |  3 ++-
 vswitchd/bridge.c    | 13 +++++++++----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index fb108c0..8547ce8 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -778,9 +778,11 @@ netdev_ports_flow_init(void)
 }
 
 void
-netdev_set_flow_api_enabled(const struct smap *ovs_other_config)
+netdev_set_flow_api_enabled(const struct smap *ovs_other_config,
+                            bool flow_restore_wait)
 {
-    if (smap_get_bool(ovs_other_config, "hw-offload", false)) {
+    if (smap_get_bool(ovs_other_config, "hw-offload", false) &&
+                      !flow_restore_wait) {
         static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
 
         if (ovsthread_once_start(&once)) {
diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h
index 8237a85..08b192c 100644
--- a/lib/netdev-offload.h
+++ b/lib/netdev-offload.h
@@ -124,7 +124,8 @@ int netdev_get_hw_info(struct netdev *, int);
 void netdev_set_hw_info(struct netdev *, int, int);
 bool netdev_any_oor(void);
 bool netdev_is_flow_api_enabled(void);
-void netdev_set_flow_api_enabled(const struct smap *ovs_other_config);
+void netdev_set_flow_api_enabled(const struct smap *ovs_other_config,
+                                 bool flow_restore_wait);
 bool netdev_is_offload_rebalance_policy_enabled(void);
 int netdev_flow_get_n_flows(struct netdev *netdev, uint64_t *n_flows);
 
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index e328d8e..bcbb176 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -813,7 +813,8 @@ datapath_reconfigure(const struct ovsrec_open_vswitch *cfg)
 }
 
 static void
-bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
+bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg,
+                   bool flow_restore_wait)
 {
     struct sockaddr_in *managers;
     struct bridge *br;
@@ -922,7 +923,9 @@ bridge_reconfigure(const struct ovsrec_open_vswitch 
*ovs_cfg)
                 /* Clear eventual previous errors */
                 ovsrec_interface_set_error(iface->cfg, NULL);
                 iface_configure_cfm(iface);
-                iface_configure_qos(iface, port->cfg->qos);
+                if (!flow_restore_wait) {
+                    iface_configure_qos(iface, port->cfg->qos);
+                }
                 iface_set_mac(br, port, iface);
                 ofproto_port_set_bfd(br->ofproto, iface->ofp_port,
                                      &iface->cfg->bfd);
@@ -3289,7 +3292,8 @@ bridge_run(void)
     cfg = ovsrec_open_vswitch_first(idl);
 
     if (cfg) {
-        netdev_set_flow_api_enabled(&cfg->other_config);
+        netdev_set_flow_api_enabled(&cfg->other_config,
+                                    ofproto_get_flow_restore_wait());
         dpdk_init(&cfg->other_config);
         userspace_tso_init(&cfg->other_config);
     }
@@ -3328,7 +3332,8 @@ bridge_run(void)
 
         idl_seqno = ovsdb_idl_get_seqno(idl);
         txn = ovsdb_idl_txn_create(idl);
-        bridge_reconfigure(cfg ? cfg : &null_cfg);
+        bridge_reconfigure(cfg ? cfg : &null_cfg,
+                           ofproto_get_flow_restore_wait());
 
         if (cfg) {
             ovsrec_open_vswitch_set_cur_cfg(cfg, cfg->next_cfg);
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to