Skip to contentSkip to conversation

net/mlx4: Fix EEPROM dump support

PATCH Applied Tariq Toukan 2 participants 2 messages May 9, 2021 – May 10, 2021

Subsystems (4)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

PATCH 1/1 net/mlx4: Fix EEPROM dump support

From: Vladyslav Tarasiuk <[email protected]>

Fix SFP and QSFP* EEPROM queries by setting i2c_address, offset and page number correctly. For SFP set the following params:
- I2C address for offsets 0-255 is 0x50. For 256-511 - 0x51.
- Page number is zero.
- Offset is 0-255.

At the same time, QSFP* parameters are different:
- I2C address is always 0x50.
- Page number is not limited to zero.
- Offset is 0-255 for page zero and 128-255 for others.

To set parameters accordingly to cable used, implement function to query module ID and implement respective helper functions to set parameters correctly.

Fixes 135dd9594f12 ("net/mlx4_en: ethtool, Remove unsupported SFP EEPROM high pages query")
---
 .../net/ethernet/mellanox/mlx4/en_ethtool.c   |   4 +-
 drivers/net/ethernet/mellanox/mlx4/port.c     | 107 +++++++++++++++++-
 2 files changed, 104 insertions(+), 7 deletions(-)

Hi,

Please queue to -stable >= v5.2.

Regards,
Tariq

drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1 -3
index 1434df66fcf2..3616b77caa0a 100644
@@ -2027,8 +2027,6 @@ 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)
 {
@@ -2063,7 +2061,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 = MLX4_EEPROM_PAGE_LEN;
+		modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
 		break;
 	default:
 		return -EINVAL;
drivers/net/ethernet/mellanox/mlx4/port.c +103 -4

138 lines not on this page · raw message

Signature · 1 line
2.21.0
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 9 lines · On Sun, 9 May 2021 09:43:18 +0300 you wrote:

From: Vladyslav Tarasiuk <[email protected]>

Fix SFP and QSFP* EEPROM queries by setting i2c_address, offset and page number correctly. For SFP set the following params:
- I2C address for offsets 0-255 is 0x50. For 256-511 - 0x51.
- Page number is zero.
- Offset is 0-255.

[...]

Here is the summary with links:
- [net] net/mlx4: Fix EEPROM dump support

    https://git.kernel.org/netdev/net/c/db825feefc68

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html