mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mieczyslaw Nalewaj <namiltd@yahoo.com>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	"Linus Walleij" <linusw@kernel.org>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>,
	"Yury Norov" <yury.norov@gmail.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Russell King" <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH v4 7/8] net: dsa: realtek: rtl8365mb: add FDB support
Date: Sat, 16 May 2026 17:29:38 +0200	[thread overview]
Message-ID: <bfc07fe3-268a-46c1-a186-0f3a43bd2a34@yahoo.com> (raw)
In-Reply-To: <CAJq09z4nEe7sLeSqOYjq=B=mMjja-W9=99+O6wHwQ6an91wNJw@mail.gmail.com>

On 5/16/2026 2:47 PM, Luiz Angelo Daros de Luca wrote:
>>> +
>>> +struct rtl8365mb_l2_mc_key {
>>> +     u8 mac_addr[ETH_ALEN];
>>> +     union {
>>> +             u16 vid; /* IVL */
>>> +             u16 fid; /* SVL */
>>> +     };
>>> +     bool ivl;
>>> +};
>>> +
>>> +struct rtl8365mb_l2_mc {
>>> +     struct rtl8365mb_l2_mc_key key;
>>> +     u16 member;
>>> +     u8 priority;
>>> +     u8 igmpidx;
>>> +
>>> +     bool is_static;
>>> +     bool fwd_pri;
>>> +     bool igmp_asic;
>>> +};
>>> +
>>> +static void rtl8365mb_l2_data_to_uc(const u16 *data, struct rtl8365mb_l2_uc *uc)
>>> +{
>>> +     u32 val;
>>> +
>>> +     uc->key.mac_addr[5] = FIELD_GET(RTL8365MB_L2_UC_D0_MAC5_MSK, data[0]);
>>> +     uc->key.mac_addr[4] = FIELD_GET(RTL8365MB_L2_UC_D0_MAC4_MSK, data[0]);
>>> +     uc->key.mac_addr[3] = FIELD_GET(RTL8365MB_L2_UC_D1_MAC3_MSK, data[1]);
>>> +     uc->key.mac_addr[2] = FIELD_GET(RTL8365MB_L2_UC_D1_MAC2_MSK, data[1]);
>>> +     uc->key.mac_addr[1] = FIELD_GET(RTL8365MB_L2_UC_D2_MAC1_MSK, data[2]);
>>> +     uc->key.mac_addr[0] = FIELD_GET(RTL8365MB_L2_UC_D2_MAC0_MSK, data[2]);
>>> +     uc->key.efid = FIELD_GET(RTL8365MB_L2_UC_D4_EFID_MSK, data[4]);
>>> +     uc->key.vid = FIELD_GET(RTL8365MB_L2_UC_D3_VID_MSK, data[3]);
>>> +     uc->key.ivl = FIELD_GET(RTL8365MB_L2_UC_D3_IVL_MSK, data[3]);
>>> +     uc->key.fid = FIELD_GET(RTL8365MB_L2_UC_D4_FID_MSK, data[4]);
>>> +     uc->age = FIELD_GET(RTL8365MB_L2_UC_D4_AGE_MSK, data[4]);
>>> +     uc->auth = FIELD_GET(RTL8365MB_L2_UC_D4_AUTH_MSK, data[4]);
>>> +
>>
>> The problem with overwriting uc->key.fid and uc->key.vid values in the union still exists.
> 
> Hello Mieczysław,
> 
> Thanks for the review. Please note that rtl8365mb_l2_data_to_uc
> operates on the unicast structure (struct rtl8365mb_l2_uc), rather
> than the multicast structure (struct rtl8365mb_l2_mc) quoted in your
> comment.
> 
> For reference, here is the definition of rtl8365mb_l2_uc and its key:
> 
> +struct rtl8365mb_l2_uc_key {
> +       u8 mac_addr[ETH_ALEN];
> +       u16 vid;
> +       u16 fid;
> +       bool ivl;
> +       u16 efid;
> +};
> +
> +struct rtl8365mb_l2_uc {
> +       struct rtl8365mb_l2_uc_key key;
> +       u8 port;
> +       u8 age;
> +       u8 priority;
> +
> +       bool sa_block;
> +       bool da_block;
> +       bool auth;
> +       bool is_static;
> +       bool sa_pri;
> +       bool fwd_pri;
> +};
> 
> As you can see, there is no union in the unicast key. The hardware
> table entry has independent fields for efid, fid, and vid (though in
> practice, vendor examples always show one of fid or vid set to 0).
> 
> The multicast entry (struct rtl8365mb_l2_mc) is the only one that uses
> a union for the dual-purpose field, which is interpreted as either fid
> or vid depending on the ivl value.
> 
> Regards,
> 
> Luiz

Reviewed-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>

  reply	other threads:[~2026-05-16 15:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-16  3:46 [net-next PATCH v4 0/8] net: dsa: realtek: rtl8365mb: bridge offloading and VLAN support Luiz Angelo Daros de Luca
2026-05-16  3:46 ` [net-next PATCH v4 1/8] net: dsa: realtek: rtl8365mb: use ERR_PTR Luiz Angelo Daros de Luca
2026-05-16 15:33   ` Mieczyslaw Nalewaj
2026-05-16  3:46 ` [net-next PATCH v4 2/8] net: dsa: realtek: rtl8365mb: use dsa helpers for port iteration Luiz Angelo Daros de Luca
2026-05-16 15:32   ` Mieczyslaw Nalewaj
2026-05-17  6:53   ` Mieczyslaw Nalewaj
2026-05-16  3:46 ` [net-next PATCH v4 3/8] net: dsa: realtek: rtl8365mb: prepare for multiple source files Luiz Angelo Daros de Luca
2026-05-16  3:46 ` [net-next PATCH v4 4/8] net: dsa: realtek: rtl8365mb: add table lookup interface Luiz Angelo Daros de Luca
2026-05-16 15:31   ` Mieczyslaw Nalewaj
2026-05-16  3:46 ` [net-next PATCH v4 5/8] net: dsa: realtek: rtl8365mb: add VLAN support Luiz Angelo Daros de Luca
2026-05-16 15:31   ` Mieczyslaw Nalewaj
2026-05-17  7:01   ` Mieczyslaw Nalewaj
2026-05-16  3:46 ` [net-next PATCH v4 6/8] net: dsa: realtek: rtl8365mb: add port_bridge_{join,leave} Luiz Angelo Daros de Luca
2026-05-16 15:30   ` Mieczyslaw Nalewaj
2026-05-16  3:46 ` [net-next PATCH v4 7/8] net: dsa: realtek: rtl8365mb: add FDB support Luiz Angelo Daros de Luca
2026-05-16  5:48   ` Mieczyslaw Nalewaj
2026-05-16 12:47     ` Luiz Angelo Daros de Luca
2026-05-16 15:29       ` Mieczyslaw Nalewaj [this message]
2026-05-18  4:38   ` Luiz Angelo Daros de Luca
2026-05-16  3:46 ` [net-next PATCH v4 8/8] net: dsa: realtek: rtl8365mb: add bridge port flags Luiz Angelo Daros de Luca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfc07fe3-268a-46c1-a186-0f3a43bd2a34@yahoo.com \
    --to=namiltd@yahoo.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rasmusvillemoes.dk \
    --cc=luizluca@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®