cxgb4: do DCB state reset in couple of places
authorGanesh Goudar <ganeshgr@chelsio.com>
Sat, 23 Sep 2017 10:37:28 +0000 (16:07 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Sep 2017 03:28:14 +0000 (20:28 -0700)
reset the driver's DCB state in couple of places
where it was missing.

Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

index 6ee2ed30626bfdf7c221a2c7846bc0abf90ac9ad..4e7f72b17e825c847f631efbaf3ab684465c4ca0 100644 (file)
@@ -40,8 +40,7 @@ static inline bool cxgb4_dcb_state_synced(enum cxgb4_dcb_state state)
                return false;
 }
 
-/* Initialize a port's Data Center Bridging state.  Typically used after a
- * Link Down event.
+/* Initialize a port's Data Center Bridging state.
  */
 void cxgb4_dcb_state_init(struct net_device *dev)
 {
@@ -106,6 +105,15 @@ static void cxgb4_dcb_cleanup_apps(struct net_device *dev)
        }
 }
 
+/* Reset a port's Data Center Bridging state.  Typically used after a
+ * Link Down event.
+ */
+void cxgb4_dcb_reset(struct net_device *dev)
+{
+       cxgb4_dcb_cleanup_apps(dev);
+       cxgb4_dcb_state_init(dev);
+}
+
 /* Finite State machine for Data Center Bridging.
  */
 void cxgb4_dcb_state_fsm(struct net_device *dev,
@@ -194,8 +202,7 @@ void cxgb4_dcb_state_fsm(struct net_device *dev,
                         * state.  We need to reset back to a ground state
                         * of incomplete.
                         */
-                       cxgb4_dcb_cleanup_apps(dev);
-                       cxgb4_dcb_state_init(dev);
+                       cxgb4_dcb_reset(dev);
                        dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE;
                        dcb->supported = CXGB4_DCBX_FW_SUPPORT;
                        linkwatch_fire_event(dev);
index ccf24d3dc982478b61e79ee2e850183b58701f45..02040b99c78a0561da461c1497a26bfb92ce2f40 100644 (file)
@@ -131,6 +131,7 @@ struct port_dcb_info {
 
 void cxgb4_dcb_state_init(struct net_device *);
 void cxgb4_dcb_version_init(struct net_device *);
+void cxgb4_dcb_reset(struct net_device *dev);
 void cxgb4_dcb_state_fsm(struct net_device *, enum cxgb4_dcb_state_input);
 void cxgb4_dcb_handle_fw_update(struct adapter *, const struct fw_port_cmd *);
 void cxgb4_dcb_set_caps(struct adapter *, const struct fw_port_cmd *);
index aa93ae95d3b928cad1eb2161037f73810438174c..13b636b0af5fccdefa17f51887d551d17e9e71b0 100644 (file)
@@ -281,7 +281,7 @@ void t4_os_link_changed(struct adapter *adapter, int port_id, int link_stat)
                else {
 #ifdef CONFIG_CHELSIO_T4_DCB
                        if (cxgb4_dcb_enabled(dev)) {
-                               cxgb4_dcb_state_init(dev);
+                               cxgb4_dcb_reset(dev);
                                dcb_tx_queue_prio_enable(dev, false);
                        }
 #endif /* CONFIG_CHELSIO_T4_DCB */
@@ -2304,10 +2304,16 @@ static int cxgb_close(struct net_device *dev)
 {
        struct port_info *pi = netdev_priv(dev);
        struct adapter *adapter = pi->adapter;
+       int ret;
 
        netif_tx_stop_all_queues(dev);
        netif_carrier_off(dev);
-       return t4_enable_vi(adapter, adapter->pf, pi->viid, false, false);
+       ret = t4_enable_vi(adapter, adapter->pf, pi->viid, false, false);
+#ifdef CONFIG_CHELSIO_T4_DCB
+       cxgb4_dcb_reset(dev);
+       dcb_tx_queue_prio_enable(dev, false);
+#endif
+       return ret;
 }
 
 int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid,