net/mlx5: Fix eeprom support for SFP module
authorEran Ben Elisha <eranbe@mellanox.com>
Sun, 14 Jun 2020 14:31:26 +0000 (17:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jul 2020 06:13:24 +0000 (08:13 +0200)
commitd8e284d778e7b3ada3d790ed9cf9dfdf783de6a0
treeae5adf8b172d3cf0d14b5b69ba513b27031797b2
parent0f488ed82212934bf3eac7d910c99a17d3779c13
net/mlx5: Fix eeprom support for SFP module

[ Upstream commit 47afbdd2fa4c5775c383ba376a3d1da7d7f694dc ]

Fix eeprom SFP query support by setting i2c_addr, offset and page number
correctly. Unlike QSFP modules, SFP eeprom params are as follow:
- i2c_addr is 0x50 for offset 0 - 255 and 0x51 for offset 256 - 511.
- Page number is always zero.
- Page offset is always relative to zero.

As part of eeprom query, query the module ID (SFP / QSFP*) via helper
function to set the params accordingly.

In addition, change mlx5_qsfp_eeprom_page() input type to be u16 to avoid
unnecessary casting.

Fixes: a708fb7b1f8d ("net/mlx5e: ethtool, Add support for EEPROM high pages query")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/port.c