From: Vladimir Oltean <olteanv@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
andrew@lunn.ch, vivien.didelot@gmail.com, jiri@mellanox.com,
edumazet@google.com, ap420073@gmail.com,
xiyou.wangcong@gmail.com, maximmi@mellanox.com, mkubecek@suse.cz,
richardcochran@gmail.com
Subject: Re: [PATCH net-next] net: restore DSA behavior of not overriding ndo_get_phys_port_name if present
Date: Thu, 23 Jul 2020 01:46:54 +0300 [thread overview]
Message-ID: <20200722224654.nqlw4nhdm22f7a5d@skbuf> (raw)
In-Reply-To: <6db74106-af90-deac-907d-9f0c971ec698@gmail.com>
On Wed, Jul 22, 2020 at 03:11:09PM -0700, Florian Fainelli wrote:
> On 7/22/20 3:06 PM, Vladimir Oltean wrote:
> > On Wed, Jul 22, 2020 at 02:53:28PM -0700, Florian Fainelli wrote:
> >> On 7/22/20 1:53 PM, Vladimir Oltean wrote:
> >>> Prior to the commit below, dsa_master_ndo_setup() used to avoid
> >>> overriding .ndo_get_phys_port_name() unless the callback was empty.
> >>>
> >>> https://elixir.bootlin.com/linux/v5.7.7/source/net/dsa/master.c#L269
> >>>
> >>> Now, it overrides it unconditionally.
> >>>
> >>> This matters for boards where DSA switches are hanging off of other DSA
> >>> switches, or switchdev interfaces.
> >>> Say a user has these udev rules for the top-level switch:
> >>>
> >>> ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p0", NAME="swp0"
> >>> ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p1", NAME="swp1"
> >>> ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p2", NAME="swp2"
> >>> ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p3", NAME="swp3"
> >>> ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p4", NAME="swp4"
> >>> ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:00.5", DRIVERS=="mscc_felix", ATTR{phys_port_name}=="p5", NAME="swp5"
> >>>
> >>> If the DSA switches below start randomly overriding
> >>> ndo_get_phys_port_name with their own CPU port, bad things can happen.
> >>> Not only may the CPU port number be not unique among different
> >>> downstream DSA switches, but one of the upstream switchdev interfaces
> >>> may also happen to have a port with the same number. So, we may even end
> >>> up in a situation where all interfaces of the top-level switch end up
> >>> having a phys_port_name attribute of "p0". Clearly not ok if the purpose
> >>> of the udev rules is to assign unique names.
> >>>
> >>> Fix this by restoring the old behavior, which did not overlay this
> >>> operation on top of the DSA master logic, if there was one in place
> >>> already.
> >>>
> >>> Fixes: 3369afba1e46 ("net: Call into DSA netdevice_ops wrappers")
> >>> Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
> >>> ---
> >>> This is brain-dead, please consider killing this and retrieving the CPU
> >>> port number from "devlink port"...
> >>
> >> That is fair enough. Do you want to submit such a change while you are
> >> at it?
> >>
> >
> > If I'm getting you right, you mean I should be dropping this patch, and
> > send another one that deletes dsa_ndo_get_phys_port_name()?
> > I would expect that to be so - the problem is the fact that we're
> > retrieving the number of the CPU port through an ndo of the master
> > interface, it's not something we can fix by just calling into devlink
> > from kernel side. The user has to call into devlink.
>
> Yes, that is what I meant, that an user should call the appropriate
> devlink command to obtain the port number, this particular change has
> caused more harm than good, and the justification for doing it in the
> first place was weak to begin with.
> --
> Florian
If the patch at this link is considered appropriate:
https://patchwork.ozlabs.org/project/netdev/patch/20200722224312.2719813-1-olteanv@gmail.com/
then this can be considered superseded by that.
If not, please apply this.
Thanks,
-Vladimir
prev parent reply other threads:[~2020-07-22 22:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 20:53 [PATCH net-next] net: restore DSA behavior of not overriding ndo_get_phys_port_name if present Vladimir Oltean
2020-07-22 21:53 ` Florian Fainelli
2020-07-22 22:06 ` Vladimir Oltean
2020-07-22 22:11 ` Florian Fainelli
2020-07-22 22:46 ` Vladimir Oltean [this message]
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=20200722224654.nqlw4nhdm22f7a5d@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=maximmi@mellanox.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=vivien.didelot@gmail.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;
as well as URLs for NNTP newsgroup(s).