mlxsw: spectrum: Fix autoneg status in ethtool
authorAmit Cohen <amitc@mellanox.com>
Thu, 18 Apr 2019 07:14:16 +0000 (07:14 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Apr 2019 17:37:30 +0000 (10:37 -0700)
commit151f0dddbbfe4c35c9c5b64873115aafd436af9d
tree075c347029c40ece5982047aaeaaee35c9611720
parent1ab3030193d25878b3b1409060e1e0a879800c95
mlxsw: spectrum: Fix autoneg status in ethtool

If link is down and autoneg is set to on/off, the status in ethtool does
not change.

The reason is when the link is down the function returns with zero
before changing autoneg value.

Move the checking of link state (up/down) to be performed after setting
autoneg value, in order to be sure that autoneg will change in any case.

Fixes: 56ade8fe3fe1 ("mlxsw: spectrum: Add initial support for Spectrum ASIC")
Signed-off-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c