浏览代码

cxgb4 : Handle dcb enable correctly

Disabling DCBx in firmware automatically enables DCBx for control via host
lldp agents. Wait for an explicit setstate call from an lldp agents to enable
 DCBx instead.

Fixes: 76bcb31efc06 ("cxgb4 : Add DCBx support codebase and dcbnl_ops")

Signed-off-by: Anish Bhatt <anish@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Anish Bhatt 11 年之前
父节点
当前提交
3bb062613b
共有 2 个文件被更改,包括 11 次插入2 次删除
  1. 6 1
      drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
  2. 5 1
      drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

+ 6 - 1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c

@@ -116,7 +116,6 @@ void cxgb4_dcb_state_fsm(struct net_device *dev,
 			/* we're going to use Host DCB */
 			/* we're going to use Host DCB */
 			dcb->state = CXGB4_DCB_STATE_HOST;
 			dcb->state = CXGB4_DCB_STATE_HOST;
 			dcb->supported = CXGB4_DCBX_HOST_SUPPORT;
 			dcb->supported = CXGB4_DCBX_HOST_SUPPORT;
-			dcb->enabled = 1;
 			break;
 			break;
 		}
 		}
 
 
@@ -386,6 +385,12 @@ static u8 cxgb4_setstate(struct net_device *dev, u8 enabled)
 {
 {
 	struct port_info *pi = netdev2pinfo(dev);
 	struct port_info *pi = netdev2pinfo(dev);
 
 
+	/* If DCBx is host-managed, dcb is enabled by outside lldp agents */
+	if (pi->dcb.state == CXGB4_DCB_STATE_HOST) {
+		pi->dcb.enabled = enabled;
+		return 0;
+	}
+
 	/* Firmware doesn't provide any mechanism to control the DCB state.
 	/* Firmware doesn't provide any mechanism to control the DCB state.
 	 */
 	 */
 	if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED))
 	if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED))

+ 5 - 1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

@@ -694,7 +694,11 @@ int cxgb4_dcb_enabled(const struct net_device *dev)
 #ifdef CONFIG_CHELSIO_T4_DCB
 #ifdef CONFIG_CHELSIO_T4_DCB
 	struct port_info *pi = netdev_priv(dev);
 	struct port_info *pi = netdev_priv(dev);
 
 
-	return pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED;
+	if (!pi->dcb.enabled)
+		return 0;
+
+	return ((pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED) ||
+		(pi->dcb.state == CXGB4_DCB_STATE_HOST));
 #else
 #else
 	return 0;
 	return 0;
 #endif
 #endif