netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: felix: allow flooding for all traffic classes
@ 2020-04-21 18:13 Vladimir Oltean
  2020-04-23  2:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Oltean @ 2020-04-21 18:13 UTC (permalink / raw)
  To: davem
  Cc: horatiu.vultur, andrew, f.fainelli, vivien.didelot,
	joergen.andreasen, allan.nielsen, claudiu.manoil, netdev,
	UNGLinuxDriver, alexandru.marginean, xiaoliang.yang_1, yangbo.lu,
	po.liu

From: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>

Right now it can be seen that the VSC9959 (Felix) switch will not flood
frames if they have a VLAN tag with a PCP of 1-7 (nonzero).

It turns out that Felix is quite different from its cousin, Ocelot, in
that frame flooding can be allowed/denied per traffic class. Where
Ocelot has 1 instance of the ANA_FLOODING register, Felix has 8.

The approach that this driver is going to take is "thanks, but no
thanks". We have no use case of limiting the flooding domain based on
traffic class, so we just want to allow packets to be flooded, no matter
what traffic class they have.

So we copy the line of code from ocelot.c which does the one-shot
initialization of the flooding PGIDs, and we add it to felix.c as well -
except replicated 8 times.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix.c | 7 +++++++
 drivers/net/dsa/ocelot/felix.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index a312a236a606..83bfb0548fbe 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -506,6 +506,7 @@ static int felix_setup(struct dsa_switch *ds)
 	struct ocelot *ocelot = ds->priv;
 	struct felix *felix = ocelot_to_felix(ocelot);
 	int port, err;
+	int tc;
 
 	err = felix_init_structs(felix, ds->num_ports);
 	if (err)
@@ -531,6 +532,12 @@ static int felix_setup(struct dsa_switch *ds)
 	ocelot_write_rix(ocelot,
 			 ANA_PGID_PGID_PGID(GENMASK(ocelot->num_phys_ports, 0)),
 			 ANA_PGID_PGID, PGID_UC);
+	/* Setup the per-traffic class flooding PGIDs */
+	for (tc = 0; tc < FELIX_NUM_TC; tc++)
+		ocelot_write_rix(ocelot, ANA_FLOODING_FLD_MULTICAST(PGID_MC) |
+				 ANA_FLOODING_FLD_BROADCAST(PGID_MC) |
+				 ANA_FLOODING_FLD_UNICAST(PGID_UC),
+				 ANA_FLOODING, tc);
 
 	ds->mtu_enforcement_ingress = true;
 	/* It looks like the MAC/PCS interrupt register - PM0_IEVENT (0x8040)
diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index a609a946cbd7..c4303e7c4164 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -5,6 +5,7 @@
 #define _MSCC_FELIX_H
 
 #define ocelot_to_felix(o)		container_of((o), struct felix, ocelot)
+#define FELIX_NUM_TC			8
 
 /* Platform-specific information */
 struct felix_info {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: dsa: felix: allow flooding for all traffic classes
  2020-04-21 18:13 [PATCH net-next] net: dsa: felix: allow flooding for all traffic classes Vladimir Oltean
@ 2020-04-23  2:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-04-23  2:26 UTC (permalink / raw)
  To: olteanv
  Cc: horatiu.vultur, andrew, f.fainelli, vivien.didelot,
	joergen.andreasen, allan.nielsen, claudiu.manoil, netdev,
	UNGLinuxDriver, alexandru.marginean, xiaoliang.yang_1, yangbo.lu,
	po.liu

From: Vladimir Oltean <olteanv@gmail.com>
Date: Tue, 21 Apr 2020 21:13:47 +0300

> From: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> 
> Right now it can be seen that the VSC9959 (Felix) switch will not flood
> frames if they have a VLAN tag with a PCP of 1-7 (nonzero).
> 
> It turns out that Felix is quite different from its cousin, Ocelot, in
> that frame flooding can be allowed/denied per traffic class. Where
> Ocelot has 1 instance of the ANA_FLOODING register, Felix has 8.
> 
> The approach that this driver is going to take is "thanks, but no
> thanks". We have no use case of limiting the flooding domain based on
> traffic class, so we just want to allow packets to be flooded, no matter
> what traffic class they have.
> 
> So we copy the line of code from ocelot.c which does the one-shot
> initialization of the flooding PGIDs, and we add it to felix.c as well -
> except replicated 8 times.
> 
> Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-23  2:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 18:13 [PATCH net-next] net: dsa: felix: allow flooding for all traffic classes Vladimir Oltean
2020-04-23  2:26 ` David Miller

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).