mlxsw: Add netdev argument to mlxsw_env_get_module_info()
authorDanielle Ratson <danieller@nvidia.com>
Wed, 26 Jan 2022 10:30:31 +0000 (12:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jan 2022 11:15:42 +0000 (11:15 +0000)
The next patches will forbid querying the port module's EEPROM info when
its type is RJ45 as in this case no transceiver module can ever be
connected to the port.

Add netdev argument to mlxsw_env_get_module_info() so it could be used
to print an error to the kernel log via netdev_err().

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_env.c
drivers/net/ethernet/mellanox/mlxsw/core_env.h
drivers/net/ethernet/mellanox/mlxsw/minimal.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c

index e84453d..06b6acc 100644 (file)
@@ -206,7 +206,8 @@ int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module,
        return 0;
 }
 
-int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
+int mlxsw_env_get_module_info(struct net_device *netdev,
+                             struct mlxsw_core *mlxsw_core, int module,
                              struct ethtool_modinfo *modinfo)
 {
        u8 module_info[MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE];
index da121b1..ec6564e 100644 (file)
@@ -12,7 +12,8 @@ struct ethtool_eeprom;
 int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module,
                                         int off, int *temp);
 
-int mlxsw_env_get_module_info(struct mlxsw_core *mlxsw_core, int module,
+int mlxsw_env_get_module_info(struct net_device *netdev,
+                             struct mlxsw_core *mlxsw_core, int module,
                              struct ethtool_modinfo *modinfo);
 
 int mlxsw_env_get_module_eeprom(struct net_device *netdev,
index 10d13f5..9ac8ce0 100644 (file)
@@ -110,7 +110,8 @@ static int mlxsw_m_get_module_info(struct net_device *netdev,
        struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
        struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
 
-       return mlxsw_env_get_module_info(core, mlxsw_m_port->module, modinfo);
+       return mlxsw_env_get_module_info(netdev, core, mlxsw_m_port->module,
+                                        modinfo);
 }
 
 static int
index 68c0ddf..055f857 100644 (file)
@@ -1035,7 +1035,7 @@ static int mlxsw_sp_get_module_info(struct net_device *netdev,
        struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(netdev);
        struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
 
-       return mlxsw_env_get_module_info(mlxsw_sp->core,
+       return mlxsw_env_get_module_info(netdev, mlxsw_sp->core,
                                         mlxsw_sp_port->mapping.module,
                                         modinfo);
 }