Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	netdev <netdev@vger.kernel.org>,
	syzbot+f3a0e80c34b3fc28ac5e@syzkaller.appspotmail.com,
	Taehee Yoo <ap420073@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [Patch net] net: change addr_list_lock back to static key
Date: Fri, 19 Jun 2020 00:46:32 +0200	[thread overview]
Message-ID: <20200618224632.GE279339@lunn.ch> (raw)
In-Reply-To: <CA+h21hrZM8Dqi7AYPkKgsAm5-q=TxEdTaci=Tq35VfoOxt_5rw@mail.gmail.com>

> > 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


  reply	other threads:[~2020-06-18 22:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 21:53 [Patch net] net: change addr_list_lock back to static key Cong Wang
2020-06-09 20:00 ` David Miller
2020-06-10 14:48 ` Taehee Yoo
2020-06-10 23:21   ` Cong Wang
2020-06-13 16:03     ` Taehee Yoo
2020-06-15 21:33       ` Cong Wang
2020-06-16 15:03         ` Taehee Yoo
2020-06-17 17:42           ` Cong Wang
2020-06-18 19:40 ` Vladimir Oltean
2020-06-18 19:56   ` Cong Wang
2020-06-18 20:06     ` Cong Wang
2020-06-18 20:33       ` Vladimir Oltean
2020-06-18 20:59         ` Cong Wang
2020-06-18 22:29         ` Andrew Lunn
2020-06-18 22:32           ` Vladimir Oltean
2020-06-18 22:46             ` Andrew Lunn [this message]
2020-06-18 22:53               ` Vladimir Oltean

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=20200618224632.GE279339@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=dvyukov@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=syzbot+f3a0e80c34b3fc28ac5e@syzkaller.appspotmail.com \
    --cc=xiyou.wangcong@gmail.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