From: Kurt Kanzenbach <kurt@linutronix.de>
To: Vladimir Oltean <vladimir.oltean@nxp.com>, netdev@vger.kernel.org
Cc: "Florian Fainelli" <f.fainelli@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Tobias Waldekranz" <tobias@waldekranz.com>,
"Alvin Šipraga" <alsi@bang-olufsen.dk>
Subject: Re: [PATCH v2 net-next 4/4] net: dsa: let drivers state that they need VLAN filtering while standalone
Date: Tue, 24 Aug 2021 08:24:52 +0200 [thread overview]
Message-ID: <87tujfpdfv.fsf@kurt> (raw)
In-Reply-To: <20210823212258.3190699-5-vladimir.oltean@nxp.com>
[-- Attachment #1: Type: text/plain, Size: 2620 bytes --]
On Tue Aug 24 2021, Vladimir Oltean wrote:
> As explained in commit e358bef7c392 ("net: dsa: Give drivers the chance
> to veto certain upper devices"), the hellcreek driver uses some tricks
> to comply with the network stack expectations: it enforces port
> separation in standalone mode using VLANs. For untagged traffic,
> bridging between ports is prevented by using different PVIDs, and for
> VLAN-tagged traffic, it never accepts 8021q uppers with the same VID on
> two ports, so packets with one VLAN cannot leak from one port to another.
>
> That is almost fine*, and has worked because hellcreek relied on an
> implicit behavior of the DSA core that was changed by the previous
> patch: the standalone ports declare the 'rx-vlan-filter' feature as 'on
> [fixed]'. Since most of the DSA drivers are actually VLAN-unaware in
> standalone mode, that feature was actually incorrectly reflecting the
> hardware/driver state, so there was a desire to fix it. This leaves the
> hellcreek driver in a situation where it has to explicitly request this
> behavior from the DSA framework.
>
> We configure the ports as follows:
>
> - Standalone: 'rx-vlan-filter' is on. An 8021q upper on top of a
> standalone hellcreek port will go through dsa_slave_vlan_rx_add_vid
> and will add a VLAN to the hardware tables, giving the driver the
> opportunity to refuse it through .port_prechangeupper.
>
> - Bridged with vlan_filtering=0: 'rx-vlan-filter' is off. An 8021q upper
> on top of a bridged hellcreek port will not go through
> dsa_slave_vlan_rx_add_vid, because there will not be any attempt to
> offload this VLAN. The driver already disables VLAN awareness, so that
> upper should receive the traffic it needs.
>
> - Bridged with vlan_filtering=1: 'rx-vlan-filter' is on. An 8021q upper
> on top of a bridged hellcreek port will call dsa_slave_vlan_rx_add_vid,
> and can again be vetoed through .port_prechangeupper.
>
> *It is not actually completely fine, because if I follow through
> correctly, we can have the following situation:
>
> ip link add br0 type bridge vlan_filtering 0
> ip link set lan0 master br0 # lan0 now becomes VLAN-unaware
> ip link set lan0 nomaster # lan0 fails to become VLAN-aware again, therefore breaking isolation
>
> This patch fixes that corner case by extending the DSA core logic, based
> on this requested attribute, to change the VLAN awareness state of the
> switch (port) when it leaves the bridge.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Kurt Kanzenbach <kurt@linutronix.de>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next prev parent reply other threads:[~2021-08-24 6:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 21:22 [PATCH v2 net-next 0/4] Plug holes in DSA's software bridging support Vladimir Oltean
2021-08-23 21:22 ` [PATCH v2 net-next 1/4] net: dsa: don't call switchdev_bridge_port_unoffload for unoffloaded bridge ports Vladimir Oltean
2021-08-23 21:22 ` [PATCH v2 net-next 2/4] net: dsa: properly fall back to software bridging Vladimir Oltean
2021-08-23 21:22 ` [PATCH v2 net-next 3/4] net: dsa: don't advertise 'rx-vlan-filter' when not needed Vladimir Oltean
2021-08-23 21:22 ` [PATCH v2 net-next 4/4] net: dsa: let drivers state that they need VLAN filtering while standalone Vladimir Oltean
2021-08-24 6:24 ` Kurt Kanzenbach [this message]
2021-08-24 8:40 ` [PATCH v2 net-next 0/4] Plug holes in DSA's software bridging support patchwork-bot+netdevbpf
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=87tujfpdfv.fsf@kurt \
--to=kurt@linutronix.de \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).