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

Transceiver module reset through 'rst' field in PMAOS register is not
supported on RJ45 ports, so module reset should be rejected.

Therefore, before trying to access this field, 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).

Output example:

 # ethtool --reset swp11 phy
 ETHTOOL_RESET 0x40
 Cannot issue ETHTOOL_RESET: Invalid argument
 $ dmesg
 mlxsw_spectrum 0000:03:00.0 swp11: Reset module is not supported 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