diff options
author | Ido Schimmel <idosch@mellanox.com> | 2016-09-12 13:26:24 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-13 12:16:33 -0400 |
commit | 4149b97f728edc9247939ece42a784c14b4e212f (patch) | |
tree | 175ad29aaa581e683c9be4b24cf2efa23ca3e785 /drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |
parent | mlxsw: spectrum: Correctly report autonegotiation (diff) | |
download | linux-dev-4149b97f728edc9247939ece42a784c14b4e212f.tar.xz linux-dev-4149b97f728edc9247939ece42a784c14b4e212f.zip |
mlxsw: spectrum: Report link partner's advertised speeds
If autonegotiation was performed successfully, then we should report the
link partner's advertised speeds instead of the operational speed of the
port.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index cbec5f301939..07930cc1fa60 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1800,6 +1800,8 @@ static int mlxsw_sp_port_get_settings(struct net_device *dev, u32 eth_proto_cap; u32 eth_proto_admin; u32 eth_proto_oper; + u8 autoneg_status; + u32 eth_proto_lp; int err; mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sp_port->local_port, 0); @@ -1810,6 +1812,8 @@ static int mlxsw_sp_port_get_settings(struct net_device *dev, } mlxsw_reg_ptys_unpack(ptys_pl, ð_proto_cap, ð_proto_admin, ð_proto_oper); + eth_proto_lp = mlxsw_reg_ptys_eth_proto_lp_advertise_get(ptys_pl); + autoneg_status = mlxsw_reg_ptys_an_status_get(ptys_pl); cmd->supported = mlxsw_sp_from_ptys_supported_port(eth_proto_cap) | mlxsw_sp_from_ptys_supported_link(eth_proto_cap) | @@ -1826,7 +1830,10 @@ static int mlxsw_sp_port_get_settings(struct net_device *dev, eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; cmd->port = mlxsw_sp_port_connector_port(eth_proto_oper); - cmd->lp_advertising = mlxsw_sp_from_ptys_advert_link(eth_proto_oper); + + if (autoneg_status == MLXSW_REG_PTYS_AN_STATUS_OK && eth_proto_lp) + cmd->lp_advertising = + mlxsw_sp_from_ptys_advert_link(eth_proto_lp); cmd->transceiver = XCVR_INTERNAL; return 0; |