Commit 31c7d2b0 authored by Emil Tantilov's avatar Emil Tantilov Committed by Jeff Kirsher

ixgbe: fix SFF data dumps of SFP+ modules from an offset

This patch fixes the read loop for the I2C data to account for the offset.

Also includes a whitespace cleanup and removes ret_val as it is not needed.

CC: Ben Hutchings <bhutchings@solarflare.com>
Reported-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarEmil Tantilov <emil.s.tantilov@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
Reviewed-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 1b1bf31a
...@@ -2946,12 +2946,11 @@ static int ixgbe_get_module_eeprom(struct net_device *dev, ...@@ -2946,12 +2946,11 @@ static int ixgbe_get_module_eeprom(struct net_device *dev,
u32 status = IXGBE_ERR_PHY_ADDR_INVALID; u32 status = IXGBE_ERR_PHY_ADDR_INVALID;
u8 databyte = 0xFF; u8 databyte = 0xFF;
int i = 0; int i = 0;
int ret_val = 0;
if (ee->len == 0) if (ee->len == 0)
return -EINVAL; return -EINVAL;
for (i = ee->offset; i < ee->len; i++) { for (i = ee->offset; i < ee->offset + ee->len; i++) {
/* I2C reads can take long time */ /* I2C reads can take long time */
if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) if (test_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
return -EBUSY; return -EBUSY;
...@@ -2962,12 +2961,12 @@ static int ixgbe_get_module_eeprom(struct net_device *dev, ...@@ -2962,12 +2961,12 @@ static int ixgbe_get_module_eeprom(struct net_device *dev,
status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte); status = hw->phy.ops.read_i2c_sff8472(hw, i, &databyte);
if (status != 0) if (status != 0)
ret_val = -EIO; return -EIO;
data[i - ee->offset] = databyte; data[i - ee->offset] = databyte;
} }
return ret_val; return 0;
} }
static const struct ethtool_ops ixgbe_ethtool_ops = { static const struct ethtool_ops ixgbe_ethtool_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment