Skip to content

Commit

Permalink
net/mlx5e: Remove overzealous validations in netlink EEPROM query
Browse files Browse the repository at this point in the history
Unlike the legacy EEPROM callbacks, when using the netlink EEPROM query
(get_module_eeprom_by_page) the driver should not try to validate the
query parameters, but just perform the read requested by the userspace.

Recent discussion in the mailing list:
https://lore.kernel.org/netdev/20220120093051.70845141@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net/

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
Gal Pressman authored and Saeed Mahameed committed Mar 11, 2022
1 parent fcb610a commit 970adfb
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions drivers/net/ethernet/mellanox/mlx5/core/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,35 +451,12 @@ int mlx5_query_module_eeprom_by_page(struct mlx5_core_dev *dev,
struct mlx5_module_eeprom_query_params *params,
u8 *data)
{
u8 module_id;
int err;

err = mlx5_query_module_num(dev, &params->module_number);
if (err)
return err;

err = mlx5_query_module_id(dev, params->module_number, &module_id);
if (err)
return err;

switch (module_id) {
case MLX5_MODULE_ID_SFP:
if (params->page > 0)
return -EINVAL;
break;
case MLX5_MODULE_ID_QSFP:
case MLX5_MODULE_ID_QSFP28:
case MLX5_MODULE_ID_QSFP_PLUS:
if (params->page > 3)
return -EINVAL;
break;
case MLX5_MODULE_ID_DSFP:
break;
default:
mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id);
return -EINVAL;
}

if (params->i2c_address != MLX5_I2C_ADDR_HIGH &&
params->i2c_address != MLX5_I2C_ADDR_LOW) {
mlx5_core_err(dev, "I2C address not recognized: 0x%x\n", params->i2c_address);
Expand Down

0 comments on commit 970adfb

Please sign in to comment.