bnxt_en: Allow PHY settings on multi-function or NPAR PFs if allowed by FW.
authorMichael Chan <michael.chan@broadcom.com>
Sun, 24 Nov 2019 03:30:49 +0000 (22:30 -0500)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Sun, 24 Nov 2019 22:48:03 +0000 (14:48 -0800)
Currently, the driver does not allow PHY settings on a multi-function or
NPAR NIC whose port is shared by more than one function.  Newer
firmware now allows PHY settings on some of these NICs.  Check for
this new firmware setting and allow the user to set the PHY settings
accordingly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 4b0303ac307fd0ffc271c4cc0c67a97048cb45fb..85983f0e3134725ee483bd04f72a617b7418d8cf 100644 (file)
@@ -8456,6 +8456,10 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
                if (bp->test_info)
                        bp->test_info->flags |= BNXT_TEST_FL_AN_PHY_LPBK;
        }
+       if (resp->flags & PORT_PHY_QCAPS_RESP_FLAGS_SHARED_PHY_CFG_SUPPORTED) {
+               if (BNXT_PF(bp))
+                       bp->fw_cap |= BNXT_FW_CAP_SHARED_PORT_CFG;
+       }
        if (resp->supported_speeds_auto_mode)
                link_info->support_auto_speeds =
                        le16_to_cpu(resp->supported_speeds_auto_mode);
@@ -8570,7 +8574,7 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
        }
        mutex_unlock(&bp->hwrm_cmd_lock);
 
-       if (!BNXT_SINGLE_PF(bp))
+       if (!BNXT_PHY_CFG_ABLE(bp))
                return 0;
 
        diff = link_info->support_auto_speeds ^ link_info->advertising;
index cab1703dfcf7498ac2c88b83ac26b11603d278a0..505af5cfb1bd7712998a20b14a807ca8498b49ab 100644 (file)
@@ -1548,6 +1548,8 @@ struct bnxt {
 #define BNXT_NPAR(bp)          ((bp)->port_partition_type)
 #define BNXT_MH(bp)            ((bp)->flags & BNXT_FLAG_MULTI_HOST)
 #define BNXT_SINGLE_PF(bp)     (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp))
+#define BNXT_PHY_CFG_ABLE(bp)  (BNXT_SINGLE_PF(bp) ||                  \
+                                ((bp)->fw_cap & BNXT_FW_CAP_SHARED_PORT_CFG))
 #define BNXT_CHIP_TYPE_NITRO_A0(bp) ((bp)->flags & BNXT_FLAG_CHIP_NITRO_A0)
 #define BNXT_RX_PAGE_MODE(bp)  ((bp)->flags & BNXT_FLAG_RX_PAGE_MODE)
 #define BNXT_SUPPORTS_TPA(bp)  (!BNXT_CHIP_TYPE_NITRO_A0(bp) &&        \
@@ -1682,6 +1684,7 @@ struct bnxt {
        #define BNXT_FW_CAP_EXT_STATS_SUPPORTED         0x00040000
        #define BNXT_FW_CAP_ERR_RECOVER_RELOAD          0x00100000
        #define BNXT_FW_CAP_HOT_RESET                   0x00200000
+       #define BNXT_FW_CAP_SHARED_PORT_CFG             0x00400000
 
 #define BNXT_NEW_RM(bp)                ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
        u32                     hwrm_spec_code;
index 62ef84741a55d9fa2681db765156d7b54f3c53eb..e455aaa50a64c06e8a01dcea5580ad6d7d9fdc5e 100644 (file)
@@ -1590,7 +1590,7 @@ static int bnxt_set_link_ksettings(struct net_device *dev,
        u32 speed;
        int rc = 0;
 
-       if (!BNXT_SINGLE_PF(bp))
+       if (!BNXT_PHY_CFG_ABLE(bp))
                return -EOPNOTSUPP;
 
        mutex_lock(&bp->link_lock);
@@ -1662,7 +1662,7 @@ static int bnxt_set_pauseparam(struct net_device *dev,
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_link_info *link_info = &bp->link_info;
 
-       if (!BNXT_SINGLE_PF(bp))
+       if (!BNXT_PHY_CFG_ABLE(bp))
                return -EOPNOTSUPP;
 
        if (epause->autoneg) {
@@ -2399,7 +2399,7 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
                 _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
        int rc = 0;
 
-       if (!BNXT_SINGLE_PF(bp))
+       if (!BNXT_PHY_CFG_ABLE(bp))
                return -EOPNOTSUPP;
 
        if (!(bp->flags & BNXT_FLAG_EEE_CAP))
@@ -2586,7 +2586,7 @@ static int bnxt_nway_reset(struct net_device *dev)
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_link_info *link_info = &bp->link_info;
 
-       if (!BNXT_SINGLE_PF(bp))
+       if (!BNXT_PHY_CFG_ABLE(bp))
                return -EOPNOTSUPP;
 
        if (!(link_info->autoneg & BNXT_AUTONEG_SPEED))