[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241215163334.615427-3-robert.hodaszi@digi.com>
Date: Sun, 15 Dec 2024 17:33:34 +0100
From: Robert Hodaszi <robert.hodaszi@...i.com>
To: netdev@...r.kernel.org,
vladimir.oltean@....com,
claudiu.manoil@....com,
alexandre.belloni@...tlin.com,
UNGLinuxDriver@...rochip.com,
andrew@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
horms@...nel.org,
linux-kernel@...r.kernel.org
Cc: Robert Hodaszi <robert.hodaszi@...i.com>
Subject: [PATCH RFC net 2/2] net: dsa: felix: fix reception from VLAN-unaware ports
In ocelot-8021q mode, the driver always enables
'untag_vlan_aware_bridge_pvid' to do software VLAN untagging, no matter
if tagging is enabled on the port (VLAN-aware) or not (VLAN-unaware).
That corrupts packets on VLAN-unaware ports.
Exclude the port from VLAN untagging by setting the 'not_tagged' port
flag on VLAN-unaware ports.
Fixes: f1288fd7293b ("net: dsa: felix: fix VLAN tag loss on CPU reception with ocelot-8021q")
Signed-off-by: Robert Hodaszi <robert.hodaszi@...i.com>
---
drivers/net/dsa/ocelot/felix.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 3aa9c997018a..8a2650a428ec 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -273,6 +273,7 @@ static int felix_tag_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid,
struct dsa_port *dp = dsa_to_port(ds, port);
struct dsa_port *cpu_dp;
int err;
+ bool tagging_enabled;
/* tag_8021q.c assumes we are implementing this via port VLAN
* membership, which we aren't. So we don't need to add any VCAP filter
@@ -281,9 +282,11 @@ static int felix_tag_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid,
if (!dsa_port_is_user(dp))
return 0;
+ tagging_enabled = dsa_port_is_vlan_filtering(dp);
+
dsa_switch_for_each_cpu_port(cpu_dp, ds) {
err = felix_tag_8021q_vlan_add_rx(ds, port, cpu_dp->index, vid,
- dsa_port_is_vlan_filtering(dp));
+ tagging_enabled);
if (err)
return err;
}
@@ -292,6 +295,8 @@ static int felix_tag_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid,
if (err)
goto add_tx_failed;
+ dp->not_tagged = !tagging_enabled;
+
return 0;
add_tx_failed:
@@ -320,6 +325,8 @@ static int felix_tag_8021q_vlan_del(struct dsa_switch *ds, int port, u16 vid)
if (err)
goto del_tx_failed;
+ dp->not_tagged = 0;
+
return 0;
del_tx_failed:
--
2.43.0
Powered by blists - more mailing lists