]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
net/mlx4_en: ethtool, Remove unsupported SFP EEPROM high pages query
authorErez Alfasi <ereza@mellanox.com>
Mon, 20 May 2019 14:42:52 +0000 (17:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:21:45 +0000 (12:21 +0200)
[ Upstream commit 135dd9594f127c8a82d141c3c8430e9e2143216a ]

Querying EEPROM high pages data for SFP module is currently
not supported by our driver but is still tried, resulting in
invalid FW queries.

Set the EEPROM ethtool data length to 256 for SFP module to
limit the reading for page 0 only and prevent invalid FW queries.

Fixes: 7202da8b7f71 ("ethtool, net/mlx4_en: Cable info, get_module_info/eeprom ethtool support")
Signed-off-by: Erez Alfasi <ereza@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
drivers/net/ethernet/mellanox/mlx4/port.c

index 5363cee88a0a4d6bc822a21bd5261dcac83bafa9..d631cd94ee636453dd534c82ac1f0e0411475e89 100644 (file)
@@ -1982,6 +1982,8 @@ static int mlx4_en_set_tunable(struct net_device *dev,
        return ret;
 }
 
+#define MLX4_EEPROM_PAGE_LEN 256
+
 static int mlx4_en_get_module_info(struct net_device *dev,
                                   struct ethtool_modinfo *modinfo)
 {
@@ -2016,7 +2018,7 @@ static int mlx4_en_get_module_info(struct net_device *dev,
                break;
        case MLX4_MODULE_ID_SFP:
                modinfo->type = ETH_MODULE_SFF_8472;
-               modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
+               modinfo->eeprom_len = MLX4_EEPROM_PAGE_LEN;
                break;
        default:
                return -EINVAL;
index 3ef3406ff4cbc2ce59c9a4ead19add33fb9943c6..5922fb318d30a947b52b27b72526cc37590a9476 100644 (file)
@@ -2077,11 +2077,6 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port,
                size -= offset + size - I2C_PAGE_SIZE;
 
        i2c_addr = I2C_ADDR_LOW;
-       if (offset >= I2C_PAGE_SIZE) {
-               /* Reset offset to high page */
-               i2c_addr = I2C_ADDR_HIGH;
-               offset -= I2C_PAGE_SIZE;
-       }
 
        cable_info = (struct mlx4_cable_info *)inmad->data;
        cable_info->dev_mem_address = cpu_to_be16(offset);