netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: Ido Schimmel <idosch@nvidia.com>,
	netdev@vger.kernel.org, Jiri Pirko <jiri@nvidia.com>,
	Nikolay Aleksandrov <nikolay@nvidia.com>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net] selftests/net: set link down before enslave
Date: Wed, 20 Jan 2021 21:43:28 +0200	[thread overview]
Message-ID: <20210120194328.GA2628348@shredder.lan> (raw)
In-Reply-To: <20210120143847.GI1421720@Leo-laptop-t470s>

On Wed, Jan 20, 2021 at 10:38:47PM +0800, Hangbin Liu wrote:
> Hi Ido,
> 
> On Wed, Jan 20, 2021 at 12:42:10PM +0200, Ido Schimmel wrote:
> > > diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
> > > index c9ce3dfa42ee..a26fddc63992 100755
> > > --- a/tools/testing/selftests/net/rtnetlink.sh
> > > +++ b/tools/testing/selftests/net/rtnetlink.sh
> > > @@ -1205,6 +1205,8 @@ kci_test_bridge_parent_id()
> > >  	dev20=`ls ${sysfsnet}20/net/`
> > >  
> > >  	ip link add name test-bond0 type bond mode 802.3ad
> > > +	ip link set dev $dev10 down
> > > +	ip link set dev $dev20 down
> > 
> > But these netdevs are created with their administrative state set to
> > 'DOWN'. Who is setting them to up?
> 
> Would you please point me where we set the state to 'DOWN'? Cause on my
> host it is init as UP:
> 
> ++ ls /sys/bus/netdevsim/devices/netdevsim10/net/
> + dev10=eth3
> ++ ls /sys/bus/netdevsim/devices/netdevsim20/net/
> + dev20=eth4
> + ip link add name test-bond0 type bond mode 802.3ad
> + ip link show eth3
> 66: eth3: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
>     link/ether 1e:52:27:5f:a5:3c brd ff:ff:ff:ff:ff:ff

I didn't have time to look into this today, but I suspect the problem is
either:

1. Some interface manager on your end that is setting these interfaces
up after they are created

2. A bug in netdevsim that does not initialize the carrier to off.
Maybe try with this patch (didn't test):

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index aec92440eef1..1e0dc298bf20 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -312,6 +312,8 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
 
        nsim_ipsec_init(ns);
 
+       netif_carrier_off(dev);
+
        err = register_netdevice(dev);
        if (err)
                goto err_ipsec_teardown;

> 
> # uname -r
> 5.11.0-rc3+
> 
> Thanks
> Hangbin

  reply	other threads:[~2021-01-20 19:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 10:29 [PATCH net] selftests/net: set link down before enslave Hangbin Liu
2021-01-20 10:42 ` Ido Schimmel
2021-01-20 14:38   ` Hangbin Liu
2021-01-20 19:43     ` Ido Schimmel [this message]
2021-01-21  1:46       ` Jakub Kicinski
2021-01-21  3:02         ` Hangbin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210120194328.GA2628348@shredder.lan \
    --to=idosch@idosch.org \
    --cc=davem@davemloft.net \
    --cc=idosch@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).