mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 13:23:23 +01:00
netdevsim: set the carrier when the device goes up
Bringing a linked netdevsim device down and then up causes communication failure because both interfaces lack carrier. Basically a ifdown/ifup on the interface make the link broken. Commit3762ec05a9("netdevsim: add NAPI support") added supported for NAPI, calling netif_carrier_off() in nsim_stop(). This patch re-enables the carrier symmetrically on nsim_open(), in case the device is linked and the peer is up. Signed-off-by: Breno Leitao <[email protected]> Fixes:3762ec05a9("netdevsim: add NAPI support") Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
1 parent
cf51d617c3
commit
1a8fed52f7
1 file changed
+7
@@ -545,6 +545,7 @@ static void nsim_enable_napi(struct netdevsim *ns)
|
||||
static int nsim_open(struct net_device *dev)
|
||||
{
|
||||
struct netdevsim *ns = netdev_priv(dev);
|
||||
struct netdevsim *peer;
|
||||
int err;
|
||||
|
||||
netdev_assert_locked(dev);
|
||||
@@ -555,6 +556,12 @@ static int nsim_open(struct net_device *dev)
|
||||
|
||||
nsim_enable_napi(ns);
|
||||
|
||||
peer = rtnl_dereference(ns->peer);
|
||||
if (peer && netif_running(peer->netdev)) {
|
||||
netif_carrier_on(dev);
|
||||
netif_carrier_on(peer->netdev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user