ixgbe: Check DDM existence in transceiver before access
authorMauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
Thu, 23 May 2019 19:11:12 +0000 (16:11 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:30 +0000 (07:28 +0200)
[ Upstream commit 655c91414579d7bb115a4f7898ee726fc18e0984 ]

Some transceivers may comply with SFF-8472 but not implement the Digital
Diagnostic Monitoring (DDM) interface described in it. The existence of
such area is specified by bit 6 of byte 92, set to 1 if implemented.

Currently, due to not checking this bit ixgbe fails trying to read SFP
module's eeprom with the follow message:

ethtool -m enP51p1s0f0
Cannot get Module EEPROM data: Input/output error

Because it fails to read the additional 256 bytes in which it was assumed
to exist the DDM data.

This issue was noticed using a Mellanox Passive DAC PN 01FT738. The eeprom
data was confirmed by Mellanox as correct and present in other Passive
DACs in from other manufacturers.

Signed-off-by: "Mauro S. M. Rodrigues" <maurosr@linux.vnet.ibm.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h

index c3e7a8191128dea542db9208a8076b4cf190e60e..f7e68083200cf1823643947b0459c569f916e8b2 100644 (file)
@@ -3237,7 +3237,8 @@ static int ixgbe_get_module_info(struct net_device *dev,
                page_swap = true;
        }
 
-       if (sff8472_rev == IXGBE_SFF_SFF_8472_UNSUP || page_swap) {
+       if (sff8472_rev == IXGBE_SFF_SFF_8472_UNSUP || page_swap ||
+           !(addr_mode & IXGBE_SFF_DDM_IMPLEMENTED)) {
                /* We have a SFP, but it does not support SFF-8472 */
                modinfo->type = ETH_MODULE_SFF_8079;
                modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
index b0cac961df3bf3235155a11684d633299f83e179..94df1d99be95cc0902ef61e874165493ddec00fa 100644 (file)
@@ -70,6 +70,7 @@
 #define IXGBE_SFF_SOFT_RS_SELECT_10G           0x8
 #define IXGBE_SFF_SOFT_RS_SELECT_1G            0x0
 #define IXGBE_SFF_ADDRESSING_MODE              0x4
+#define IXGBE_SFF_DDM_IMPLEMENTED              0x40
 #define IXGBE_SFF_QSFP_DA_ACTIVE_CABLE         0x1
 #define IXGBE_SFF_QSFP_DA_PASSIVE_CABLE                0x8
 #define IXGBE_SFF_QSFP_CONNECTOR_NOT_SEPARABLE 0x23