cxgb4: do DCB state reset in couple of places

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>
This commit is contained in:
Ganesh Goudar 2017-09-23 16:07:28 +05:30 committed by David S. Miller
parent d958af3d14
commit ba581f77df
3 changed files with 20 additions and 6 deletions

View File

@ -40,8 +40,7 @@ static inline bool cxgb4_dcb_state_synced(enum cxgb4_dcb_state state)
return false; return false;
} }
/* Initialize a port's Data Center Bridging state. Typically used after a /* Initialize a port's Data Center Bridging state.
* Link Down event.
*/ */
void cxgb4_dcb_state_init(struct net_device *dev) 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. /* Finite State machine for Data Center Bridging.
*/ */
void cxgb4_dcb_state_fsm(struct net_device *dev, 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 * state. We need to reset back to a ground state
* of incomplete. * of incomplete.
*/ */
cxgb4_dcb_cleanup_apps(dev); cxgb4_dcb_reset(dev);
cxgb4_dcb_state_init(dev);
dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE;
dcb->supported = CXGB4_DCBX_FW_SUPPORT; dcb->supported = CXGB4_DCBX_FW_SUPPORT;
linkwatch_fire_event(dev); linkwatch_fire_event(dev);

View File

@ -131,6 +131,7 @@ struct port_dcb_info {
void cxgb4_dcb_state_init(struct net_device *); void cxgb4_dcb_state_init(struct net_device *);
void cxgb4_dcb_version_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_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_handle_fw_update(struct adapter *, const struct fw_port_cmd *);
void cxgb4_dcb_set_caps(struct adapter *, const struct fw_port_cmd *); void cxgb4_dcb_set_caps(struct adapter *, const struct fw_port_cmd *);

View File

@ -281,7 +281,7 @@ void t4_os_link_changed(struct adapter *adapter, int port_id, int link_stat)
else { else {
#ifdef CONFIG_CHELSIO_T4_DCB #ifdef CONFIG_CHELSIO_T4_DCB
if (cxgb4_dcb_enabled(dev)) { if (cxgb4_dcb_enabled(dev)) {
cxgb4_dcb_state_init(dev); cxgb4_dcb_reset(dev);
dcb_tx_queue_prio_enable(dev, false); dcb_tx_queue_prio_enable(dev, false);
} }
#endif /* CONFIG_CHELSIO_T4_DCB */ #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 port_info *pi = netdev_priv(dev);
struct adapter *adapter = pi->adapter; struct adapter *adapter = pi->adapter;
int ret;
netif_tx_stop_all_queues(dev); netif_tx_stop_all_queues(dev);
netif_carrier_off(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, int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid,