summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYisen Zhuang <yisen.zhuang@huawei.com>2023-09-06 15:20:17 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-09-23 10:59:59 +0200
commit89099d73b2dd447e3ff503cee6b1608748668e32 (patch)
treeee3b4bbb5c9cb61d13aef7c72508dc8635d99f79 /drivers
parenta44602888bbe89d9dd89cb84baed2e356aba7436 (diff)
downloadlinux-89099d73b2dd447e3ff503cee6b1608748668e32.tar.gz
linux-89099d73b2dd447e3ff503cee6b1608748668e32.tar.bz2
linux-89099d73b2dd447e3ff503cee6b1608748668e32.zip
net: hns3: fix the port information display when sfp is absent
[ Upstream commit 674d9591a32d01df75d6b5fffed4ef942a294376 ] When sfp is absent or unidentified, the port type should be displayed as PORT_OTHERS, rather than PORT_FIBRE. Fixes: 88d10bd6f730 ("net: hns3: add support for multiple media type") Signed-off-by: Yisen Zhuang <yisen.zhuang@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 34e5448d59f6..4ea19f546df0 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -676,7 +676,9 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
hns3_get_ksettings(h, cmd);
break;
case HNAE3_MEDIA_TYPE_FIBER:
- if (module_type == HNAE3_MODULE_TYPE_CR)
+ if (module_type == HNAE3_MODULE_TYPE_UNKNOWN)
+ cmd->base.port = PORT_OTHER;
+ else if (module_type == HNAE3_MODULE_TYPE_CR)
cmd->base.port = PORT_DA;
else
cmd->base.port = PORT_FIBRE;