]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: hns3: modify an unsuitable print when setting unknown duplex to fibre
authorGuangbin Huang <huangguangbin2@huawei.com>
Wed, 19 Feb 2020 01:23:30 +0000 (09:23 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Feb 2020 00:25:12 +0000 (16:25 -0800)
Currently, if device is in link down status and user uses
'ethtool -s' command to set speed but not specify duplex
mode, the duplex mode passed from ethtool to driver is
unknown value(255), and the fibre port will identify this
value as half duplex mode and print "only copper port
supports half duplex!". This message is confusing.

So for fibre port, only the setting duplex is half, prints
error and returns.

Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c

index c03856e63320234b2d0659cd85b6a624673c2cfe..3f59a1924390f7636f3545d24006acbd2c0fd4d5 100644 (file)
@@ -736,7 +736,7 @@ static int hns3_check_ksettings_param(const struct net_device *netdev,
        if (ops->get_media_type)
                ops->get_media_type(handle, &media_type, &module_type);
 
-       if (cmd->base.duplex != DUPLEX_FULL &&
+       if (cmd->base.duplex == DUPLEX_HALF &&
            media_type != HNAE3_MEDIA_TYPE_COPPER) {
                netdev_err(netdev,
                           "only copper port supports half duplex!");