From: Robert Hodaszi <robert.hodaszi@digi.com>
To: netdev@vger.kernel.org, vladimir.oltean@nxp.com,
claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com,
UNGLinuxDriver@microchip.com, andrew@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org,
linux-kernel@vger.kernel.org
Cc: Robert Hodaszi <robert.hodaszi@digi.com>
Subject: [PATCH RFC net 2/2] net: dsa: felix: fix reception from VLAN-unaware ports
Date: Sun, 15 Dec 2024 17:33:34 +0100 [thread overview]
Message-ID: <20241215163334.615427-3-robert.hodaszi@digi.com> (raw)
In-Reply-To: <20241215163334.615427-1-robert.hodaszi@digi.com>
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@digi.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
next prev parent reply other threads:[~2024-12-15 16:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-15 16:33 [PATCH RFC net 0/2] net: dsa: felix: fix VLAN-unaware reception Robert Hodaszi
2024-12-15 16:33 ` [PATCH RFC net 1/2] net: dsa: provide a way to exclude switch ports from VLAN untagging Robert Hodaszi
2024-12-15 16:33 ` Robert Hodaszi [this message]
2024-12-15 17:09 ` [PATCH RFC net 0/2] net: dsa: felix: fix VLAN-unaware reception Vladimir Oltean
2024-12-16 10:10 ` Robert Hodaszi
2024-12-16 13:51 ` Vladimir Oltean
2024-12-16 14:39 ` Robert Hodaszi
2024-12-16 14:48 ` Vladimir Oltean
2024-12-17 10:15 ` Simon Horman
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=20241215163334.615427-3-robert.hodaszi@digi.com \
--to=robert.hodaszi@digi.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®