From: Vladimir Oltean <olteanv@gmail.com>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Kurt Kanzenbach <kurt@linutronix.de>,
Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [PATCH v2 net 1/3] net: dsa: only unset VLAN filtering when last port leaves last VLAN-aware bridge
Date: Mon, 22 Mar 2021 19:56:15 +0200 [thread overview]
Message-ID: <20210322175615.47awcvac2sbxqqyc@skbuf> (raw)
In-Reply-To: <87lfafm5xh.fsf@waldekranz.com>
On Mon, Mar 22, 2021 at 06:52:58PM +0100, Tobias Waldekranz wrote:
> On Sun, Mar 21, 2021 at 00:59, Vladimir Oltean <olteanv@gmail.com> wrote:
> > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> > DSA is aware of switches with global VLAN filtering since the blamed
> > commit, but it makes a bad decision when multiple bridges are spanning
> > the same switch:
> >
> > ip link add br0 type bridge vlan_filtering 1
> > ip link add br1 type bridge vlan_filtering 1
> > ip link set swp2 master br0
> > ip link set swp3 master br0
> > ip link set swp4 master br1
> > ip link set swp5 master br1
> > ip link set swp5 nomaster
> > ip link set swp4 nomaster
> > [138665.939930] sja1105 spi0.1: port 3: dsa_core: VLAN filtering is a global setting
> > [138665.947514] DSA: failed to notify DSA_NOTIFIER_BRIDGE_LEAVE
> >
> > When all ports leave br1, DSA blindly attempts to disable VLAN filtering
> > on the switch, ignoring the fact that br0 still exists and is VLAN-aware
> > too. It fails while doing that.
> >
> > This patch checks whether any port exists at all and is under a
> > VLAN-aware bridge.
> >
> > Fixes: d371b7c92d19 ("net: dsa: Unset vlan_filtering when ports leave the bridge")
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > Tested-by: Florian Fainelli <f.fainelli@gmail.com>
> > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> > ---
> > net/dsa/switch.c | 15 +++++++++------
> > 1 file changed, 9 insertions(+), 6 deletions(-)
> >
> > diff --git a/net/dsa/switch.c b/net/dsa/switch.c
> > index 4b5da89dc27a..32963276452f 100644
> > --- a/net/dsa/switch.c
> > +++ b/net/dsa/switch.c
> > @@ -107,7 +107,7 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
> > bool unset_vlan_filtering = br_vlan_enabled(info->br);
> > struct dsa_switch_tree *dst = ds->dst;
> > struct netlink_ext_ack extack = {0};
> > - int err, i;
> > + int err, port;
> >
> > if (dst->index == info->tree_index && ds->index == info->sw_index &&
> > ds->ops->port_bridge_join)
> > @@ -124,13 +124,16 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
> > * it. That is a good thing, because that lets us handle it and also
> > * handle the case where the switch's vlan_filtering setting is global
> > * (not per port). When that happens, the correct moment to trigger the
> > - * vlan_filtering callback is only when the last port left this bridge.
> > + * vlan_filtering callback is only when the last port leaves the last
> > + * VLAN-aware bridge.
> > */
> > if (unset_vlan_filtering && ds->vlan_filtering_is_global) {
> > - for (i = 0; i < ds->num_ports; i++) {
> > - if (i == info->port)
> > - continue;
> > - if (dsa_to_port(ds, i)->bridge_dev == info->br) {
> > + for (port = 0; port < ds->num_ports; port++) {
> > + struct net_device *bridge_dev;
> > +
> > + bridge_dev = dsa_to_port(ds, port)->bridge_dev;
> > +
> > + if (bridge_dev && br_vlan_enabled(bridge_dev)) {
> > unset_vlan_filtering = false;
> > break;
> > }
> > --
> > 2.25.1
>
> Is it the case that all devices in which VLAN filtering is a global
> setting are also single-chip? To my _D_SA eyes, it feels like we should
> have to iterate over all ports in the tree, not just the switch.
Correct, I might revisit this if I ever get my hands on a board with
sja1105 switches in a real multi-switch tree, and not in disjoint trees
as I have had access to so far.
next prev parent reply other threads:[~2021-03-22 17:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-20 22:59 [PATCH v2 net 0/3] Clear rx-vlan-filter feature in DSA when necessary Vladimir Oltean
2021-03-20 22:59 ` [PATCH v2 net 1/3] net: dsa: only unset VLAN filtering when last port leaves last VLAN-aware bridge Vladimir Oltean
2021-03-22 17:52 ` Tobias Waldekranz
2021-03-22 17:56 ` Vladimir Oltean [this message]
2021-03-20 22:59 ` [PATCH v2 net 2/3] net: dsa: don't advertise 'rx-vlan-filter' if VLAN filtering not global Vladimir Oltean
2021-03-23 2:40 ` Florian Fainelli
2021-03-23 12:03 ` Vladimir Oltean
2021-03-23 16:16 ` Florian Fainelli
2021-03-23 19:33 ` Vladimir Oltean
2021-03-20 22:59 ` [PATCH v2 net 3/3] net: dsa: let drivers state that they need VLAN filtering while standalone 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=20210322175615.47awcvac2sbxqqyc@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=tobias@waldekranz.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.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