Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5640e04f authored by Peng Li's avatar Peng Li Committed by Greg Kroah-Hartman
Browse files

net: hns: add netif_carrier_off before change speed and duplex



[ Upstream commit 455c4401fe7a538facaffb35b906ce19f1ece474 ]

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: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7c10ec1d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;
	}