From 0132dd23bd2b88c55aeffa53803ced0f01bb9944 Mon Sep 17 00:00:00 2001 From: shenhao Date: Sun, 26 Apr 2020 20:47:53 +0800 Subject: [PATCH] net: hns3: disable auto-negotiation off with 1000M setting in ethtool driver inclusion category: bugfix bugzilla: NA CVE: NA -------------------------------------------- The 802.3 specification does not specify the behavior of auto-negotiation off with 1000M in phy. Therefore, some phy compatibility issues occur. This patch forbids the setting of this unreasonable mode by ethtool in driver. Signed-off-by: Yufeng Mo Signed-off-by: shenhao Reviewed-by: Zhong Zhaohui Signed-off-by: Yang Yingliang --- drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 3c25c11c5cf3..69bf22c14d5f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -776,8 +776,13 @@ static int hns3_set_link_ksettings(struct net_device *netdev, cmd->base.duplex); /* Only support ksettings_set for netdev with phy attached for now */ - if (netdev->phydev) + if (netdev->phydev) { + if (cmd->base.speed == SPEED_1000 && + cmd->base.autoneg == AUTONEG_DISABLE) + return -EINVAL; + return phy_ethtool_ksettings_set(netdev->phydev, cmd); + } if (handle->pdev->revision == 0x20) return -EOPNOTSUPP; -- GitLab