Re: [PATCH net-next v7 10/10] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB
From: Mieczyslaw Nalewaj
Date: Wed Nov 04 2026 - 12:09:28 EST
On 11/4/2026 2:14 PM, Alvin Šipraga wrote:
> On Wed, Nov 04, 2026 at 10:40:11AM +0100, Mieczyslaw Nalewaj wrote:
>> There is one instance for family C and one for family D, and the chip
>> table entries only say:
>>
>> .family_info = &rtl8365mb_family_d,
> Yes, sounds reasonable. Starts to resemble how mv88e6xxx does it.
Thanks. I'm glad we are aligned on the family_info approach. Since I already
have a working draft of this refactoring, I’ve pushed the current pre-v9 code
to GitHub for early visibility. If you'd like to see how the family_info
looks in practice while reviewing, you can check it out here: https://github.com/namiltd/rtl8367d/pull/11/commits
> It seemed to me that VLAN would also benefit from being split
> out somehow. I already tried to structure the VLAN/L2 APIs into somewhat
> high- and low-level implementations, the former being accessed by
> _main.c and the latter implemented in _{vlan,l2}.c. In the cases where
> the binary format/address the chip expects is different, it seems
> logical to then have different low-level implementations depending on
> family. There might be some code duplication, but to the extent that
> it's just incidental (e.g. 50% of the stuff is the same), it can still
> improve the maintainability of the code IMO.
> But if there's also extra steps in the sequence, then perhaps
> it's better to avoid an if (family D) { do this extra thing }, and
> instead implement a whole different operation with a little code
> duplication. It's a matter of taste though.
Agreed. I will look into splitting the low-level VLAN operations into distinct
family C and D functions inside rtl8365mb_vlan.c to avoid internal if/else
checks. A bit of duplication is definitely worth it for better maintainability.
> I would encourage you not to send a v9 straight away but to discuss some
> things on the list first. Otherwise it's easy to lose track of the
> conversation.
Understood. I will hold off on sending the official v9 patchset until we finish
discussing the remaining parts here on the list.
Kind regards,
Mieczyslaw