Skip to content

Commit 1a8fed5

Browse files
leitaokuba-moo
authored andcommitted
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. Commit 3762ec0 ("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: 3762ec0 ("netdevsim: add NAPI support") Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent cf51d61 commit 1a8fed5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/net/netdevsim/netdev.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ static void nsim_enable_napi(struct netdevsim *ns)
545545
static int nsim_open(struct net_device *dev)
546546
{
547547
struct netdevsim *ns = netdev_priv(dev);
548+
struct netdevsim *peer;
548549
int err;
549550

550551
netdev_assert_locked(dev);
@@ -555,6 +556,12 @@ static int nsim_open(struct net_device *dev)
555556

556557
nsim_enable_napi(ns);
557558

559+
peer = rtnl_dereference(ns->peer);
560+
if (peer && netif_running(peer->netdev)) {
561+
netif_carrier_on(dev);
562+
netif_carrier_on(peer->netdev);
563+
}
564+
558565
return 0;
559566
}
560567

0 commit comments

Comments
 (0)