From: Ido Schimmel <idosch@nvidia.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Petr Machata <petrm@nvidia.com>,
Woojung Huh <woojung.huh@microchip.com>,
Oleksij Rempel <linux@rempel-privat.de>,
Arun Ramadoss <arun.ramadoss@microchip.com>,
Hauke Mehrtens <hauke@hauke-m.de>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: Re: [RFC PATCH net-next 1/3] selftests: forwarding: add a vlan_deletion test to bridge_vlan_unaware
Date: Thu, 7 Jul 2022 15:13:25 +0300 [thread overview]
Message-ID: <YsbN5UhjDhO8nJcJ@shredder> (raw)
In-Reply-To: <20220705173114.2004386-2-vladimir.oltean@nxp.com>
On Tue, Jul 05, 2022 at 08:31:12PM +0300, Vladimir Oltean wrote:
> Historically, DSA drivers have seen problems with the model in which
> bridge VLANs work, particularly with them being offloaded to switchdev
> asynchronously relative to when they become active (vlan_filtering=1).
>
> This switchdev API peculiarity was papered over by commit 2ea7a679ca2a
> ("net: dsa: Don't add vlans when vlan filtering is disabled"), which
> introduced other problems, fixed by commit 54a0ed0df496 ("net: dsa:
> provide an option for drivers to always receive bridge VLANs") through
> an opt-in ds->configure_vlan_while_not_filtering bool (which later
> became an opt-out).
>
> The point is that some DSA drivers still skip VLAN configuration while
> VLAN-unaware, and there is a desire to get rid of that behavior.
>
> It's hard to deduce from the wording "at least one corner case" what
> Andrew saw, but my best guess is that there is a discrepancy of meaning
> between bridge pvid and hardware port pvid which caused breakage.
>
> On one side, the Linux bridge with vlan_filtering=0 is completely
> VLAN-unaware, and will accept and process a packet the same way
> irrespective of the VLAN groups on the ports or the bridge itself
> (there may not even be a pvid, and this makes no difference).
>
> On the other hand, DSA switches still do VLAN processing internally,
> even with vlan_filtering disabled, but they are expected to classify all
> packets to the port pvid. That pvid shouldn't be confused with the
> bridge pvid, and there lies the problem.
>
> When a switch port is under a VLAN-unaware bridge, the hardware pvid
> must be explicitly managed by the driver to classify all received
> packets to it, regardless of bridge VLAN groups. When under a VLAN-aware
> bridge, the hardware pvid must be synchronized to the bridge port pvid.
> To do this correctly, the pattern is unfortunately a bit complicated,
> and involves hooking the pvid change logic into quite a few places
> (the ones that change the input variables which determine the value to
> use as hardware pvid for a port). See mv88e6xxx_port_commit_pvid(),
> sja1105_commit_pvid(), ocelot_port_set_pvid() etc.
>
> The point is that not all drivers used to do that, especially in older
> kernels. If a driver is to blindly program a bridge pvid VLAN received
> from switchdev while it's VLAN-unaware, this might in turn change the
> hardware pvid used by a VLAN-unaware bridge port, which might result in
> packet loss depending which other ports have that pvid too (in that same
> note, it might also go unnoticed).
>
> To capture that condition, it is sufficient to take a VLAN-unaware
> bridge and change the [VLAN-aware] bridge pvid on a single port, to a
> VID that isn't present on any other port. This shouldn't have absolutely
> any effect on packet classification or forwarding. However, broken
> drivers will take the bait, and change their PVID to 3, causing packet
> loss.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Ido Schimmel <idosch@nvidia.com>
next prev parent reply other threads:[~2022-07-07 12:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 17:31 [RFC PATCH net-next 0/3] Delete ds->configure_vlan_while_not_filtering Vladimir Oltean
2022-07-05 17:31 ` [RFC PATCH net-next 1/3] selftests: forwarding: add a vlan_deletion test to bridge_vlan_unaware Vladimir Oltean
2022-07-07 12:13 ` Ido Schimmel [this message]
2022-07-07 13:34 ` Martin Blumenstingl
2022-07-07 13:45 ` Vladimir Oltean
2022-07-05 17:31 ` [RFC PATCH net-next 2/3] net: dsa: ar9331: remove ds->configure_vlan_while_not_filtering Vladimir Oltean
2022-07-05 17:31 ` [RFC PATCH net-next 3/3] net: dsa: never skip VLAN configuration Vladimir Oltean
2022-07-06 10:51 ` Arun.Ramadoss
2022-07-06 11:12 ` Vladimir Oltean
2022-07-06 16:33 ` Martin Blumenstingl
2022-07-06 16:45 ` Vladimir Oltean
2022-07-06 19:57 ` Martin Blumenstingl
2022-07-07 22:31 ` Vladimir Oltean
2022-07-08 10:00 ` Martin Blumenstingl
2022-07-08 12:09 ` Vladimir Oltean
2022-07-08 22:27 ` Martin Blumenstingl
2022-07-14 10:46 ` Arun.Ramadoss
2022-07-14 15:12 ` Vladimir Oltean
2022-07-15 9:23 ` Arun.Ramadoss
2022-07-15 15:26 ` Vladimir Oltean
2022-07-18 14:34 ` Arun.Ramadoss
2022-07-18 16:24 ` Vladimir Oltean
2022-07-26 15:10 ` Arun.Ramadoss
2022-07-26 17:21 ` Vladimir Oltean
2022-09-12 15:30 ` Arun.Ramadoss
2022-09-12 15:42 ` Vladimir Oltean
2022-09-13 10:57 ` Arun.Ramadoss
2022-09-13 15:09 ` Vladimir Oltean
2022-07-06 20:04 ` Hauke Mehrtens
2022-07-07 22:54 ` 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=YsbN5UhjDhO8nJcJ@shredder \
--to=idosch@nvidia.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hauke@hauke-m.de \
--cc=kuba@kernel.org \
--cc=linux@rempel-privat.de \
--cc=martin.blumenstingl@googlemail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
--cc=woojung.huh@microchip.com \
--cc=xiaoliang.yang_1@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;
as well as URLs for NNTP newsgroup(s).