net: amd-xgbe: Check only the minimum speed for active/passive cables
authorTom Lendacky <thomas.lendacky@amd.com>
Thu, 8 Dec 2022 16:22:25 +0000 (10:22 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:27 +0000 (13:32 +0100)
[ Upstream commit f8ab263d4d48e6dab752029bf562f20a2ee630ed ]

There are cables that exist that can support speeds in excess of 10GbE.
The driver, however, restricts the EEPROM advertised nominal bitrate to
a specific range, which can prevent usage of cables that can support,
for example, up to 25GbE.

Rather than checking that an active or passive cable supports a specific
range, only check for a minimum supported speed.

Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c

index 868a768f424cb33243cd4022066102eee1b6aa7f..c731a04731f83dfa87586f6059bcfe60b8b76630 100644 (file)
@@ -237,10 +237,7 @@ enum xgbe_sfp_speed {
 
 #define XGBE_SFP_BASE_BR                       12
 #define XGBE_SFP_BASE_BR_1GBE_MIN              0x0a
-#define XGBE_SFP_BASE_BR_1GBE_MAX              0x0d
 #define XGBE_SFP_BASE_BR_10GBE_MIN             0x64
-#define XGBE_SFP_BASE_BR_10GBE_MAX             0x68
-#define XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX       0x78
 
 #define XGBE_SFP_BASE_CU_CABLE_LEN             18
 
@@ -827,29 +824,22 @@ static void xgbe_phy_sfp_phy_settings(struct xgbe_prv_data *pdata)
 static bool xgbe_phy_sfp_bit_rate(struct xgbe_sfp_eeprom *sfp_eeprom,
                                  enum xgbe_sfp_speed sfp_speed)
 {
-       u8 *sfp_base, min, max;
+       u8 *sfp_base, min;
 
        sfp_base = sfp_eeprom->base;
 
        switch (sfp_speed) {
        case XGBE_SFP_SPEED_1000:
                min = XGBE_SFP_BASE_BR_1GBE_MIN;
-               max = XGBE_SFP_BASE_BR_1GBE_MAX;
                break;
        case XGBE_SFP_SPEED_10000:
                min = XGBE_SFP_BASE_BR_10GBE_MIN;
-               if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME],
-                          XGBE_MOLEX_VENDOR, XGBE_SFP_BASE_VENDOR_NAME_LEN) == 0)
-                       max = XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX;
-               else
-                       max = XGBE_SFP_BASE_BR_10GBE_MAX;
                break;
        default:
                return false;
        }
 
-       return ((sfp_base[XGBE_SFP_BASE_BR] >= min) &&
-               (sfp_base[XGBE_SFP_BASE_BR] <= max));
+       return sfp_base[XGBE_SFP_BASE_BR] >= min;
 }
 
 static void xgbe_phy_free_phy_device(struct xgbe_prv_data *pdata)