Re: [net-next PATCH v3 7/8] net: dsa: realtek: rtl8365mb: add FDB support

From: Mieczyslaw Nalewaj

Date: Mon May 11 2026 - 11:23:59 EST


On 5/10/2026 7:35 PM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> net: dsa: realtek: rtl8365mb: add FDB support
>
> Implement support for FDB and MDB management for the RTL8365MB series
> switches. Introduce a mutex lock (l2_lock) to protect concurrent L2 table
> updates. Add support for forwarding database operations, including unicast
> and multicast entry handling as well as fast aging support.
>
>> diff --git a/drivers/net/dsa/realtek/rtl8365mb_l2.c b/drivers/net/dsa/realtek/rtl8365mb_l2.c
>> --- /dev/null
>> +++ b/drivers/net/dsa/realtek/rtl8365mb_l2.c
>
> [ ... ]
>
>> +static void rtl8365mb_l2_data_to_uc(const u16 *data, struct rtl8365mb_l2_uc *uc)
>> +{
>
> [ ... ]
>
>> + uc->key.efid = FIELD_GET(RTL8365MB_L2_UC_D4_EFID_MASK, data[4]);
>> + uc->key.vid = FIELD_GET(RTL8365MB_L2_UC_D3_VID_MASK, data[3]);
>> + uc->key.ivl = FIELD_GET(RTL8365MB_L2_UC_D3_IVL_MASK, data[3]);
>> + uc->key.fid = FIELD_GET(RTL8365MB_L2_UC_D4_FID_MASK, data[4]);
>
> Because vid and fid share the same union memory in struct rtl8365mb_l2_uc_key,
> does setting fid immediately after vid overwrite the 12-bit vid value with
> the 4-bit fid value?

Change code to:

uc->key.efid = FIELD_GET(RTL8365MB_L2_UC_D4_EFID_MASK, data[4]);
uc->key.ivl = FIELD_GET(RTL8365MB_L2_UC_D3_IVL_MASK, data[3]);

if (uc->key.ivl)
uc->key.vid = FIELD_GET(RTL8365MB_L2_UC_D3_VID_MASK, data[3]);
else
uc->key.fid = FIELD_GET(RTL8365MB_L2_UC_D4_FID_MASK, data[4]);