Skip to content
Snippets Groups Projects
Commit 12f97e2b authored by Yonglong Liu's avatar Yonglong Liu Committed by Cheng Jian
Browse files

net: hns: fix wrong display of "Advertised link modes"


driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

-----------------------------

The "Advertised link modes" always shows "1000baseT/Full", because
the driver only assigned this value.

Function ethtool_convert_link_mode_to_legacy_u32() should be called
after function phy_ethtool_ksettings_get() to get the current value
of the phy.

Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Reviewed-by: default avatarli yongxin <liyongxin1@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
parent 46293832
No related branches found
No related tags found
No related merge requests found
......@@ -135,11 +135,6 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev,
return -EINVAL;
}
ethtool_convert_link_mode_to_legacy_u32(&supported,
cmd->link_modes.supported);
ethtool_convert_link_mode_to_legacy_u32(&advertising,
cmd->link_modes.advertising);
/* When there is no phy, autoneg is off. */
cmd->base.autoneg = false;
cmd->base.speed = speed;
......@@ -148,6 +143,11 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev,
if (net_dev->phydev)
phy_ethtool_ksettings_get(net_dev->phydev, cmd);
ethtool_convert_link_mode_to_legacy_u32(&supported,
cmd->link_modes.supported);
ethtool_convert_link_mode_to_legacy_u32(&advertising,
cmd->link_modes.advertising);
link_stat = hns_nic_get_link(net_dev);
if (!link_stat) {
cmd->base.speed = (u32)SPEED_UNKNOWN;
......@@ -160,7 +160,6 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev,
supported |= h->if_support;
if (h->phy_if == PHY_INTERFACE_MODE_SGMII) {
supported |= SUPPORTED_TP;
advertising |= ADVERTISED_1000baseT_Full;
} else if (h->phy_if == PHY_INTERFACE_MODE_XGMII) {
supported |= SUPPORTED_FIBRE;
advertising |= ADVERTISED_10000baseKR_Full;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment