On Wed, Apr 20, 2022 at 10:16:48AM +0200, Clément Léger wrote: > Le Thu, 14 Apr 2022 20:51:40 +0300, > Vladimir Oltean <olteanv@xxxxxxxxx> a écrit : > > > > + > > > +static int a5psw_port_fdb_add(struct dsa_switch *ds, int port, > > > + const unsigned char *addr, u16 vid, > > > + struct dsa_db db) > > > > This isn't something that is documented because I haven't had time to > > update that, but new drivers should comply to the requirements for FDB > > isolation (not ignore the passed "db" here) and eventually set > > ds->fdb_isolation = true. Doing so would allow your switch to behave > > correctly when > > - there is more than one bridge spanning its ports, > > - some ports are standalone and some ports are bridged > > - standalone ports are looped back via an external cable with bridged > > ports > > - unrecognized upper interfaces (bond, team) are used, and those are > > bridged directly with some other switch ports > > > > The most basic thing you need to do to satisfy the requirements is to > > figure out what mechanism for FDB partitioning does your hardware have. > > If the answer is "none", then we'll have to use VLANs for that: all > > standalone ports to share a VLAN, each VLAN-unaware bridge to share a > > VLAN across all member ports, each VLAN of a VLAN-aware bridge to > > reserve its own VLAN. Up to a total of 32 VLANs, since I notice that's > > what the limit for your hardware is. > > Ok, I see the idea. In the mean time, could we make a first step with a > single bridge and without VLAN support ? This is expected to come later > anyway. > > > > > But I see this patch set doesn't include VLAN functionality (and also > > ignores the "vid" from FDB entries), so I can't really say more right now. > > But if you could provide more information about the hardware > > capabilities we can discuss implementation options. > > That's indeed the problem. The FDB table does not seems to have > partitionning at all (except for ports) and entries (such as seen below) > do not contain any VLAN information. > > > > diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h > > > index b34ea549e936..37aa89383e70 100644 > > > --- a/drivers/net/dsa/rzn1_a5psw.h > > > +++ b/drivers/net/dsa/rzn1_a5psw.h > > > @@ -167,6 +167,22 @@ > > > #define A5PSW_CTRL_TIMEOUT 1000 > > > #define A5PSW_TABLE_ENTRIES 8192 > > > > > > +struct fdb_entry { > > > > Shouldn't this contain something along the lines of a VID, FID, something? > > This is extracted directly from the datasheet [1]. The switch FDB table > does not seems to store the VID with the entries (See page 300). > > [1] > https://www.renesas.com/us/en/document/mah/rzn1d-group-rzn1s-group-rzn1l-group-users-manual-r-engine-and-ethernet-peripherals Thanks for the link. I see that the switch has a non-partitionable lookup table, not even by VLAN. A shame. This is also in contrast with the software bridge driver, where FDB and MDB entries can have independent destinations per VID. So there's nothing you can do beyond limiting to a single offloaded bridge and hoping for the best w.r.t. per-VLAN forwarding destinations. Note that if you limit to a single bridge does not mean that you can declare ds->fdb_isolation = true. Declaring that would opt you into unicast and multicast filtering towards the CPU, i.o.w. a method for software to only receive the addresses it has expressed an interest in, rather than all packets received on standalone ports. The way that is implemented in DSA is by adding FDB and MDB entries on the management port, and it would break a lot of things without a partitioning scheme for the lookup table.