Re: [RFC PATCH net-next] net: dsa: tag_qca: Check for upstream VLAN tag

From: Vladimir Oltean
Date: Sat Jun 05 2021 - 21:02:17 EST


Hi Matthew,

On Sat, Jun 05, 2021 at 11:39:24PM +0100, Matthew Hagan wrote:
> On 05/06/2021 21:35, Andrew Lunn wrote:
>
> >> The tested case is a Meraki MX65 which features two QCA8337 switches with
> >> their CPU ports attached to a BCM58625 switch ports 4 and 5 respectively.
> > Hi Matthew
> >
> > The BCM58625 switch is also running DSA? What does you device tree
> > look like? I know Florian has used two broadcom switches in cascade
> > and did not have problems.
> >
> > Andrew
>
> Hi Andrew
>
> I did discuss this with Florian, who recommended I submit the changes. Can
> confirm the b53 DSA driver is being used. The issue here is that tagging
> must occur on all ports. We can't selectively disable for ports 4 and 5
> where the QCA switches are attached, thus this patch is required to get
> things working.
>
> Setup is like this:
>                        sw0p2     sw0p4            sw1p2     sw1p4
>     wan1    wan2  sw0p1  +  sw0p3  +  sw0p5  sw1p1  +  sw1p3  +  sw1p5
>      +       +      +    |    +    |    +      +    |    +    |    +
>      |       |      |    |    |    |    |      |    |    |    |    |
>      |       |    +--+----+----+----+----+-+ +--+----+----+----+----+-+
>      |       |    |         QCA8337        | |        QCA8337         |
>      |       |    +------------+-----------+ +-----------+------------+
>      |       |             sw0 |                     sw1 |
> +----+-------+-----------------+-------------------------+------------+
> |    0       1    BCM58625     4                         5            |
> +----+-------+-----------------+-------------------------+------------+

It is a bit unconventional for the upstream Broadcom switch, which is a
DSA master of its own, to insert a VLAN ID of zero out of the blue,
especially if it operates in standalone mode. Supposedly sw0 and sw1 are
not under a bridge net device, are they?

If I'm not mistaken, this patch should solve your problem?

-----------------------------[ cut here ]-----------------------------
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 3ca6b394dd5f..d6655b516bd8 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1462,6 +1462,7 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
struct b53_device *dev = ds->priv;
bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
+ bool really_untagged = false;
struct b53_vlan *vl;
int err;

@@ -1474,10 +1475,10 @@ int b53_vlan_add(struct dsa_switch *ds, int port,
b53_get_vlan_entry(dev, vlan->vid, vl);

if (vlan->vid == 0 && vlan->vid == b53_default_pvid(dev))
- untagged = true;
+ really_untagged = true;

vl->members |= BIT(port);
- if (untagged && !dsa_is_cpu_port(ds, port))
+ if (really_untagged || (untagged && !dsa_is_cpu_port(ds, port)))
vl->untag |= BIT(port);
else
vl->untag &= ~BIT(port);
-----------------------------[ cut here ]-----------------------------