aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2022-05-11 12:50:13 +0300
committerJakub Kicinski <kuba@kernel.org>2022-05-12 16:38:38 -0700
commite9b3ba439dcb975474accbae1a37b99f9df59bed (patch)
treec448f07ed73ce0e2a0a6d05a3f2e1b4c30dd08c3 /drivers/net/dsa
parentnet: lan966x: Fix use of pointer after being freed (diff)
downloadlinux-dev-e9b3ba439dcb975474accbae1a37b99f9df59bed.tar.xz
linux-dev-e9b3ba439dcb975474accbae1a37b99f9df59bed.zip
net: dsa: felix: program host FDB entries towards PGID_CPU for tag_8021q too
I remembered why we had the host FDB migration procedure in place. It is true that host FDB entry migration can be done by changing the value of PGID_CPU, but the problem is that only host FDB entries learned while operating in NPI mode go to PGID_CPU. When the CPU port operates in tag_8021q mode, the FDB entries are learned towards the unicast PGID equal to the physical port number of this CPU port, bypassing the PGID_CPU indirection. So host FDB entries learned in tag_8021q mode are not migrated any longer towards the NPI port. Fix this by extracting the NPI port -> PGID_CPU redirection from the ocelot switch lib, moving it to the Felix DSA driver, and applying it for any CPU port regardless of its kind (NPI or tag_8021q). Fixes: a51c1c3f3218 ("net: dsa: felix: stop migrating FDBs back and forth on tag proto change") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/ocelot/felix.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index a23781d9a15c..5af4f9b3ee32 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -668,15 +668,19 @@ static int felix_fdb_add(struct dsa_switch *ds, int port,
struct dsa_db db)
{
struct net_device *bridge_dev = felix_classify_db(db);
+ struct dsa_port *dp = dsa_to_port(ds, port);
struct ocelot *ocelot = ds->priv;
if (IS_ERR(bridge_dev))
return PTR_ERR(bridge_dev);
- if (dsa_is_cpu_port(ds, port) && !bridge_dev &&
+ if (dsa_port_is_cpu(dp) && !bridge_dev &&
dsa_fdb_present_in_other_db(ds, port, addr, vid, db))
return 0;
+ if (dsa_port_is_cpu(dp))
+ port = PGID_CPU;
+
return ocelot_fdb_add(ocelot, port, addr, vid, bridge_dev);
}
@@ -685,15 +689,19 @@ static int felix_fdb_del(struct dsa_switch *ds, int port,
struct dsa_db db)
{
struct net_device *bridge_dev = felix_classify_db(db);
+ struct dsa_port *dp = dsa_to_port(ds, port);
struct ocelot *ocelot = ds->priv;
if (IS_ERR(bridge_dev))
return PTR_ERR(bridge_dev);
- if (dsa_is_cpu_port(ds, port) && !bridge_dev &&
+ if (dsa_port_is_cpu(dp) && !bridge_dev &&
dsa_fdb_present_in_other_db(ds, port, addr, vid, db))
return 0;
+ if (dsa_port_is_cpu(dp))
+ port = PGID_CPU;
+
return ocelot_fdb_del(ocelot, port, addr, vid, bridge_dev);
}