aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlxsw/core_env.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-05-18 13:13:40 -0700
committerDavid S. Miller <davem@davemloft.net>2019-05-18 13:13:40 -0700
commitee8a2b95b737d5989efeb477d5a1ef5e6955b830 (patch)
treebec4eeb2158d856439ff0c065d652f399375065c /drivers/net/ethernet/mellanox/mlxsw/core_env.c
parentvsock/virtio: Initialize core virtio vsock before registering the driver (diff)
parentmlxsw: core: Prevent reading unsupported slave address from SFP EEPROM (diff)
downloadlinux-dev-ee8a2b95b737d5989efeb477d5a1ef5e6955b830.tar.xz
linux-dev-ee8a2b95b737d5989efeb477d5a1ef5e6955b830.zip
Merge branch 'mlxsw-Two-port-module-fixes'
Ido Schimmel says: ==================== mlxsw: Two port module fixes Patch #1 fixes driver initialization failure on old ASICs due to unsupported register access. This is fixed by first testing if the register is supported. Patch #2 fixes reading of certain modules' EEPROM. The problem and solution are explained in detail in the commit message. Please consider both patches for stable. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/core_env.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core_env.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
index c1c1965d7acc..72539a9a3847 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
@@ -3,6 +3,7 @@
#include <linux/kernel.h>
#include <linux/err.h>
+#include <linux/sfp.h>
#include "core.h"
#include "core_env.h"
@@ -162,7 +163,7 @@ int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
{
u8 module_info[MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE];
u16 offset = MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE;
- u8 module_rev_id, module_id;
+ u8 module_rev_id, module_id, diag_mon;
unsigned int read_size;
int err;
@@ -195,8 +196,21 @@ int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
}
break;
case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_SFP:
+ /* Verify if transceiver provides diagnostic monitoring page */
+ err = mlxsw_env_query_module_eeprom(mlxsw_core, module,
+ SFP_DIAGMON, 1, &diag_mon,
+ &read_size);
+ if (err)
+ return err;
+
+ if (read_size < 1)
+ return -EIO;
+
modinfo->type = ETH_MODULE_SFF_8472;
- modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
+ if (diag_mon)
+ modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
+ else
+ modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN / 2;
break;
default:
return -EINVAL;