bnxt_en: Skip disabling autoneg before PHY loopback when appropriate.
authorMichael Chan <michael.chan@broadcom.com>
Sun, 24 Nov 2019 03:30:46 +0000 (22:30 -0500)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Sun, 24 Nov 2019 22:48:02 +0000 (14:48 -0800)
New firmware allows PHY loopback to be set without disabling autoneg
first.  Check this capability and skip disabling autoneg when
it is supported by firmware.  Using this scheme, loopback will
always work even if the PHY only supports autoneg.

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 0e384c578aa06f09f7a22bdb170071a87fc0b7df..9d02232c311337a7f8b7a37eddeedb8a621fc35e 100644 (file)
@@ -8419,7 +8419,8 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
 
        bp->flags &= ~BNXT_FLAG_EEE_CAP;
        if (bp->test_info)
-               bp->test_info->flags &= ~BNXT_TEST_FL_EXT_LPBK;
+               bp->test_info->flags &= ~(BNXT_TEST_FL_EXT_LPBK |
+                                         BNXT_TEST_FL_AN_PHY_LPBK);
        if (bp->hwrm_spec_code < 0x10201)
                return 0;
 
@@ -8445,6 +8446,10 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
                if (bp->test_info)
                        bp->test_info->flags |= BNXT_TEST_FL_EXT_LPBK;
        }
+       if (resp->flags & PORT_PHY_QCAPS_RESP_FLAGS_AUTONEG_LPBK_SUPPORTED) {
+               if (bp->test_info)
+                       bp->test_info->flags |= BNXT_TEST_FL_AN_PHY_LPBK;
+       }
        if (resp->supported_speeds_auto_mode)
                link_info->support_auto_speeds =
                        le16_to_cpu(resp->supported_speeds_auto_mode);
index dbdd09750d917532561ae0e5012ddb1af0593390..94c8a9276d3ad1cfc5634cc1b2f75baeb6d8a56a 100644 (file)
@@ -1226,7 +1226,8 @@ struct bnxt_led_info {
 struct bnxt_test_info {
        u8 offline_mask;
        u8 flags;
-#define BNXT_TEST_FL_EXT_LPBK  0x1
+#define BNXT_TEST_FL_EXT_LPBK          0x1
+#define BNXT_TEST_FL_AN_PHY_LPBK       0x2
        u16 timeout;
        char string[BNXT_MAX_TEST][ETH_GSTRING_LEN];
 };
index 0641020b56d5ed0be0bb9e18bab898597b4357f7..62ef84741a55d9fa2681db765156d7b54f3c53eb 100644 (file)
@@ -2698,7 +2698,8 @@ static int bnxt_disable_an_for_lpbk(struct bnxt *bp,
        u16 fw_speed;
        int rc;
 
-       if (!link_info->autoneg)
+       if (!link_info->autoneg ||
+           (bp->test_info->flags & BNXT_TEST_FL_AN_PHY_LPBK))
                return 0;
 
        rc = bnxt_query_force_speeds(bp, &fw_advertising);