[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+h21hrZT6u1oy=cW1mcZuU7JFfHtxpzEjrf3CcuXLtzxe0kQw@mail.gmail.com>
Date: Fri, 19 Jun 2020 01:53:38 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Cong Wang <xiyou.wangcong@...il.com>,
netdev <netdev@...r.kernel.org>,
syzbot+f3a0e80c34b3fc28ac5e@...kaller.appspotmail.com,
Taehee Yoo <ap420073@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [Patch net] net: change addr_list_lock back to static key
On Fri, 19 Jun 2020 at 01:46, Andrew Lunn <andrew@...n.ch> wrote:
>
> > > Hi Vladimir
> > >
> > > So you are suggesting this?
> > >
> > > > > + ret = netdev_upper_dev_link(master, slave_dev, NULL);
> > >
> > > Andrew
> >
> > Yes, basically this:
> >
> > diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> > index 4c7f086a047b..6aff8cfc9cf1 100644
> > --- a/net/dsa/slave.c
> > +++ b/net/dsa/slave.c
> > @@ -1807,6 +1807,13 @@ int dsa_slave_create(struct dsa_port *port)
> > ret, slave_dev->name);
> > goto out_phy;
> > }
> > + rtnl_lock();
> > + ret = netdev_upper_dev_link(master, slave_dev, NULL);
> > + rtnl_unlock();
> > + if (ret) {
> > + unregister_netdevice(slave_dev);
> > + goto out_phy;
> > + }
> >
> > return 0;
> >
> > @@ -1826,12 +1833,14 @@ int dsa_slave_create(struct dsa_port *port)
> >
> > void dsa_slave_destroy(struct net_device *slave_dev)
> > {
> > + struct net_device *master = dsa_slave_to_master(slave_dev);
> > struct dsa_port *dp = dsa_slave_to_port(slave_dev);
> > struct dsa_slave_priv *p = netdev_priv(slave_dev);
> >
> > netif_carrier_off(slave_dev);
> > rtnl_lock();
> > phylink_disconnect_phy(dp->pl);
> > + netdev_upper_dev_unlink(master, slave_dev);
> > rtnl_unlock();
> >
> > dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
> >
> > Do you see a problem with it?
>
> I was initially not sure you could do this. But it looks like you can
> have N : M relationships between uppers and lowers. I suppose it does
> make sense. You can have multiple VLAN uppers to one base device. You
> can have multiple lowers to one bond device, etc.
>
> I wonder what 'side effects' there are for declaring this linkage. It
> is not something i've looked into before, since we never used it. So i
> don't see a problem with this, other than i don't know what problems
> we might run into :-)
>
> Andrew
>
It was surprising to me as well, since I was used to the bridge model
(a port can have only one bridge master). But it looks like, that is
the difference between netdev_upper_dev_link and
netdev_master_upper_dev_link. This uses the former, and the bridge
layer uses the latter.
So I guess it is ok.
Thanks,
-Vladimir
Powered by blists - more mailing lists