aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/hisilicon
diff options
context:
space:
mode:
authorPeng Li <lipeng321@huawei.com>2019-04-04 16:17:48 +0800
committerDavid S. Miller <davem@davemloft.net>2019-04-04 10:20:38 -0700
commit95dbab9f3606e9f3724fc0e38298830b09a57559 (patch)
tree05472bedd20a48066714a3582d70dc0cad2a0855 /drivers/net/ethernet/hisilicon
parentMerge branch 'net-More-movement-to-fib_nh_common' (diff)
downloadlinux-dev-95dbab9f3606e9f3724fc0e38298830b09a57559.tar.xz
linux-dev-95dbab9f3606e9f3724fc0e38298830b09a57559.zip
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 <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 359d4731fb2d..fc82d0e11546 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);