bnxt_en: Report firmware DCBX agent.
authorMichael Chan <michael.chan@broadcom.com>
Mon, 24 Jul 2017 16:34:25 +0000 (12:34 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jul 2017 00:29:58 +0000 (17:29 -0700)
Report DCB_CAP_DCBX_LLD_MANAGED only if the firmware DCBX agent is enabled
and running for PF or VF.  Otherwise, if both LLDP and DCBX agents are
disabled in firmware, we report DCB_CAP_DCBX_LLD_HOST and allow host
IEEE DCB settings.  This patch refines the current logic in the driver.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c

index 5df967037d10fc238d47c64e1570c5a148c582e6..95fea2622d640e9a366cfb98201ecea6844d963f 100644 (file)
@@ -4578,6 +4578,7 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)
 {
        struct hwrm_func_qcfg_input req = {0};
        struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+       u16 flags;
        int rc;
 
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QCFG, -1, -1);
@@ -4594,15 +4595,15 @@ static int bnxt_hwrm_func_qcfg(struct bnxt *bp)
                vf->vlan = le16_to_cpu(resp->vlan) & VLAN_VID_MASK;
        }
 #endif
-       if (BNXT_PF(bp)) {
-               u16 flags = le16_to_cpu(resp->flags);
-
-               if (flags & (FUNC_QCFG_RESP_FLAGS_FW_DCBX_AGENT_ENABLED |
-                            FUNC_QCFG_RESP_FLAGS_FW_LLDP_AGENT_ENABLED))
-                       bp->flags |= BNXT_FLAG_FW_LLDP_AGENT;
-               if (flags & FUNC_QCFG_RESP_FLAGS_MULTI_HOST)
-                       bp->flags |= BNXT_FLAG_MULTI_HOST;
-       }
+       flags = le16_to_cpu(resp->flags);
+       if (flags & (FUNC_QCFG_RESP_FLAGS_FW_DCBX_AGENT_ENABLED |
+                    FUNC_QCFG_RESP_FLAGS_FW_LLDP_AGENT_ENABLED)) {
+               bp->flags |= BNXT_FLAG_FW_LLDP_AGENT;
+               if (flags & FUNC_QCFG_RESP_FLAGS_FW_DCBX_AGENT_ENABLED)
+                       bp->flags |= BNXT_FLAG_FW_DCBX_AGENT;
+       }
+       if (BNXT_PF(bp) && (flags & FUNC_QCFG_RESP_FLAGS_MULTI_HOST))
+               bp->flags |= BNXT_FLAG_MULTI_HOST;
 
        switch (resp->port_partition_type) {
        case FUNC_QCFG_RESP_PORT_PARTITION_TYPE_NPAR1_0:
index 15d5a10122ed0fd94406cc0a479ecb8a56eeab02..6b781be6672264c872278fbef3032b705d693324 100644 (file)
@@ -1027,6 +1027,7 @@ struct bnxt {
        #define BNXT_FLAG_MULTI_HOST    0x100000
        #define BNXT_FLAG_SHORT_CMD     0x200000
        #define BNXT_FLAG_DOUBLE_DB     0x400000
+       #define BNXT_FLAG_FW_DCBX_AGENT 0x800000
        #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000
 
        #define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA |             \
index 5c6dd0ce209f627e4c5bd74efa1ef581d1eb46ad..c0145898f64c76683b4720d7f13616cc672d3bd4 100644 (file)
@@ -549,13 +549,18 @@ static u8 bnxt_dcbnl_setdcbx(struct net_device *dev, u8 mode)
 {
        struct bnxt *bp = netdev_priv(dev);
 
-       /* only support IEEE */
-       if ((mode & DCB_CAP_DCBX_VER_CEE) || !(mode & DCB_CAP_DCBX_VER_IEEE))
+       /* All firmware DCBX settings are set in NVRAM */
+       if (bp->dcbx_cap & DCB_CAP_DCBX_LLD_MANAGED)
                return 1;
 
        if (mode & DCB_CAP_DCBX_HOST) {
                if (BNXT_VF(bp) || (bp->flags & BNXT_FLAG_FW_LLDP_AGENT))
                        return 1;
+
+               /* only support IEEE */
+               if ((mode & DCB_CAP_DCBX_VER_CEE) ||
+                   !(mode & DCB_CAP_DCBX_VER_IEEE))
+                       return 1;
        }
 
        if (mode == bp->dcbx_cap)
@@ -584,7 +589,7 @@ void bnxt_dcb_init(struct bnxt *bp)
        bp->dcbx_cap = DCB_CAP_DCBX_VER_IEEE;
        if (BNXT_PF(bp) && !(bp->flags & BNXT_FLAG_FW_LLDP_AGENT))
                bp->dcbx_cap |= DCB_CAP_DCBX_HOST;
-       else
+       else if (bp->flags & BNXT_FLAG_FW_DCBX_AGENT)
                bp->dcbx_cap |= DCB_CAP_DCBX_LLD_MANAGED;
        bp->dev->dcbnl_ops = &dcbnl_ops;
 }