[PATCH 2/2][Cosmic][SRU Bionic] net: hns: add netif_carrier_off before change speed and duplex
dann frazier
dann.frazier at canonical.com
Thu Sep 13 18:47:13 UTC 2018
From: Peng Li <lipeng321 at huawei.com>
BugLink: https://bugs.launchpad.net/bugs/1792209
If there are packets in hardware when changing the speed
or duplex, it may cause hardware hang up.
This patch adds netif_carrier_off before change speed and
duplex in ethtool_ops.set_link_ksettings, and adds
netif_carrier_on after complete the change.
Signed-off-by: Peng Li <lipeng321 at huawei.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 455c4401fe7a538facaffb35b906ce19f1ece474)
Signed-off-by: dann frazier <dann.frazier at canonical.com>
---
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 2e14a3ae1d8be..c1e947bb852ff 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -243,7 +243,9 @@ static int hns_nic_set_link_ksettings(struct net_device *net_dev,
}
if (h->dev->ops->adjust_link) {
+ netif_carrier_off(net_dev);
h->dev->ops->adjust_link(h, (int)speed, cmd->base.duplex);
+ netif_carrier_on(net_dev);
return 0;
}
--
2.19.0
More information about the kernel-team
mailing list