Re: [PATCH net-next v6 3/9] net: dsa: realtek: rtl8365mb: set speed for family D
From: Andrew Lunn
Date: Sun Oct 18 2026 - 19:04:53 EST
On Sun, Oct 18, 2026 at 07:40:47PM -0300, Luiz Angelo Daros de Luca wrote:
> > diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> > index 840db5a..2dabc4d 100644
> > --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> > +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
> > @@ -344,6 +344,7 @@
> > #define RTL8365MB_PORT_SPEED_10M 0
> > #define RTL8365MB_PORT_SPEED_100M 1
> > #define RTL8365MB_PORT_SPEED_1000M 2
> > +#define RTL8365MB_D_PORT_SPEED_2500M 5
>
> I also used the same _<FAMILY>_ tag trick previously, but it gets
> confusing quickly. Does RTL8365MB_D_xxx mean something exclusive to
> family D, or family D and later? I hope a more seasoned reviewer can
> weigh in on this.
The Marvell switch driver does something similar. There are a few
families of devices, and within each family, a few devices. Within a
family, the devices are register compatible, but they either have
different number of ports, or features are not present.
The naming of functions and defines is based around the highest family
member of the family which introduced the feature. A few examples:
int mv88e6097_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in,
u8 out);
int mv88e6390_port_pause_limit(struct mv88e6xxx_chip *chip, int port, u8 in,
u8 out);
The feature was first introduced in mv88e6097, and this method is used
in all families until the mv88e6390 came along, which required a
different implementation because the registers changed.
So i would say RTL8365MB_D_xxx means D and later. And if you need
RTL8365MB_F_xxx, put it close by so other developers are aware it
exists.
What we also sometimes do is have a mv88e6xxx_foo function, which is
generic, but it calls mv88e6352_foo, mv88e6189_foo, mv88e6393_foo as
needed.
Andrew