From: Peng Li Date: Thu, 4 Apr 2019 08:17:48 +0000 (+0800) Subject: net: hns3: check 1000M half for hns3_ethtool_ops.set_link_ksettings X-Git-Tag: v5.2-rc1~133^2~250^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95dbab9f3606e9f3724fc0e38298830b09a57559;p=thirdparty%2Fkernel%2Flinux.git net: hns3: check 1000M half for hns3_ethtool_ops.set_link_ksettings Hip08 SOC does not support 1000M half, this patch adds 1000M half check for hns3_ethtool_ops.set_link_ksettings, so the user can not set 1000M half by ethtool. Signed-off-by: Peng Li Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index 359d4731fb2db..fc82d0e115464 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -648,6 +648,10 @@ static int hns3_get_link_ksettings(struct net_device *netdev, static int hns3_set_link_ksettings(struct net_device *netdev, const struct ethtool_link_ksettings *cmd) { + /* Chip doesn't support this mode. */ + if (cmd->base.speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF) + return -EINVAL; + /* Only support ksettings_set for netdev with phy attached for now */ if (netdev->phydev) return phy_ethtool_ksettings_set(netdev->phydev, cmd);