diff mbox series

[v2,net] net: dsa: vsc73xx: fix reception from VLAN-unaware bridges

Message ID 20241014153041.1110364-1-vladimir.oltean@nxp.com (mailing list archive)
State Accepted
Commit 11d06f0aaef89f4cad68b92510bd9decff2d7b87
Delegated to: Netdev Maintainers
Headers show
Series [v2,net] net: dsa: vsc73xx: fix reception from VLAN-unaware bridges | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-15--06-00 (tests: 777)

Commit Message

Vladimir Oltean Oct. 14, 2024, 3:30 p.m. UTC
Similar to the situation described for sja1105 in commit 1f9fc48fd302
("net: dsa: sja1105: fix reception from VLAN-unaware bridges"), the
vsc73xx driver uses tag_8021q and doesn't need the ds->untag_bridge_pvid
request. In fact, this option breaks packet reception.

The ds->untag_bridge_pvid option strips VLANs from packets received on
VLAN-unaware bridge ports. But those VLANs should already be stripped
by tag_vsc73xx_8021q.c as part of vsc73xx_rcv() - they are not VLANs in
VLAN-unaware mode, but DSA tags. Thus, dsa_software_vlan_untag() tries
to untag a VLAN that doesn't exist, corrupting the packet.

Fixes: 93e4649efa96 ("net: dsa: provide a software untagging function on RX for VLAN-aware bridges")
Tested-by: Pawel Dembicki <paweldembicki@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
v1->v2:
- retarget to 'net'
- rewrite commit message

Link to v1:
https://lore.kernel.org/netdev/20241008104657.3549151-1-vladimir.oltean@nxp.com/

 drivers/net/dsa/vitesse-vsc73xx-core.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Florian Fainelli Oct. 14, 2024, 5:11 p.m. UTC | #1
On 10/14/24 08:30, Vladimir Oltean wrote:
> Similar to the situation described for sja1105 in commit 1f9fc48fd302
> ("net: dsa: sja1105: fix reception from VLAN-unaware bridges"), the
> vsc73xx driver uses tag_8021q and doesn't need the ds->untag_bridge_pvid
> request. In fact, this option breaks packet reception.
> 
> The ds->untag_bridge_pvid option strips VLANs from packets received on
> VLAN-unaware bridge ports. But those VLANs should already be stripped
> by tag_vsc73xx_8021q.c as part of vsc73xx_rcv() - they are not VLANs in
> VLAN-unaware mode, but DSA tags. Thus, dsa_software_vlan_untag() tries
> to untag a VLAN that doesn't exist, corrupting the packet.
> 
> Fixes: 93e4649efa96 ("net: dsa: provide a software untagging function on RX for VLAN-aware bridges")
> Tested-by: Pawel Dembicki <paweldembicki@gmail.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Linus Walleij Oct. 15, 2024, 8:03 a.m. UTC | #2
On Mon, Oct 14, 2024 at 5:30 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:

> Similar to the situation described for sja1105 in commit 1f9fc48fd302
> ("net: dsa: sja1105: fix reception from VLAN-unaware bridges"), the
> vsc73xx driver uses tag_8021q and doesn't need the ds->untag_bridge_pvid
> request. In fact, this option breaks packet reception.
>
> The ds->untag_bridge_pvid option strips VLANs from packets received on
> VLAN-unaware bridge ports. But those VLANs should already be stripped
> by tag_vsc73xx_8021q.c as part of vsc73xx_rcv() - they are not VLANs in
> VLAN-unaware mode, but DSA tags. Thus, dsa_software_vlan_untag() tries
> to untag a VLAN that doesn't exist, corrupting the packet.
>
> Fixes: 93e4649efa96 ("net: dsa: provide a software untagging function on RX for VLAN-aware bridges")
> Tested-by: Pawel Dembicki <paweldembicki@gmail.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
patchwork-bot+netdevbpf@kernel.org Oct. 16, 2024, 1:50 a.m. UTC | #3
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 14 Oct 2024 18:30:41 +0300 you wrote:
> Similar to the situation described for sja1105 in commit 1f9fc48fd302
> ("net: dsa: sja1105: fix reception from VLAN-unaware bridges"), the
> vsc73xx driver uses tag_8021q and doesn't need the ds->untag_bridge_pvid
> request. In fact, this option breaks packet reception.
> 
> The ds->untag_bridge_pvid option strips VLANs from packets received on
> VLAN-unaware bridge ports. But those VLANs should already be stripped
> by tag_vsc73xx_8021q.c as part of vsc73xx_rcv() - they are not VLANs in
> VLAN-unaware mode, but DSA tags. Thus, dsa_software_vlan_untag() tries
> to untag a VLAN that doesn't exist, corrupting the packet.
> 
> [...]

Here is the summary with links:
  - [v2,net] net: dsa: vsc73xx: fix reception from VLAN-unaware bridges
    https://git.kernel.org/netdev/net/c/11d06f0aaef8

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c
index e4b98fd51643..f18aa321053d 100644
--- a/drivers/net/dsa/vitesse-vsc73xx-core.c
+++ b/drivers/net/dsa/vitesse-vsc73xx-core.c
@@ -851,7 +851,6 @@  static int vsc73xx_setup(struct dsa_switch *ds)
 
 	dev_info(vsc->dev, "set up the switch\n");
 
-	ds->untag_bridge_pvid = true;
 	ds->max_num_bridges = DSA_TAG_8021Q_MAX_NUM_BRIDGES;
 	ds->fdb_isolation = true;