]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports
authorDanielle Ratson <danieller@nvidia.com>
Wed, 26 Jan 2022 10:30:35 +0000 (12:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jan 2022 11:15:42 +0000 (11:15 +0000)
commitfca2e521a8bae3b817bb77c0efbfd5dfa04469d8
tree4ab24307eefbafc84392a93342f6ffd22b600d01
parent1a8a9dbba3eea60e40231f75b60be2c1ec3fe2da
mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports

MCIA (Management Cable Info Access) register is not supported on RJ45
ports, so getting module EEPROM should be rejected.

Therefore, before trying to access this register, validate the port
module type that was queried during initialization and return an error
to user space in case the port module type is RJ45 (twisted pair).

Examples for output when trying to get EEPROM module:

Using netlink:

 # ethtool -m swp1
 netlink error: mlxsw_core: EEPROM is not equipped on port module type
 netlink error: Invalid argument

Using IOCTL:

 # ethtool -m swp1
 Cannot get module EEPROM information: Invalid argument
 $ dmesg
 mlxsw_spectrum 0000:03:00.0 swp1: EEPROM is not equipped on port module type

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_env.c