mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mieczyslaw Nalewaj <namiltd@yahoo.com>
To: linusw@kernel.org, andrew@lunn.ch, olteanv@gmail.com,
	kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, linux@armlinux.org.uk, luizluca@gmail.com,
	maxime.chevallier@bootlin.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, alvin.sipraga@analog.com,
	gusfmora@gmail.com, kuncy7@gmail.com, fabianotassotti@gmail.com,
	gabonpivovich@gmail.com, contact@c127.dev
Subject: Re: [PATCH net-next v12 12/13] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D
Date: Sat, 21 Nov 2026 10:33:34 +0100	[thread overview]
Message-ID: <1fb7feee-3e4b-4313-a596-29f2ad0de1dc@yahoo.com> (raw)
In-Reply-To: <ca39376d-37b6-43e0-9dd5-7d431d335e63@yahoo.com>

Subject: Re: [PATCH net-next v12 12/13] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D

> +void rtl8365mb_d_l2_data_to_mc(const u16 *data,
> +			       struct rtl8365mb_l2_mc *mc)
> +{
> +	rtl8365mb_l2_data_to_mac(data, mc->key.mac_addr);
> +	mc->key.vid = FIELD_GET(RTL8365MB_D_L2_MC_D3_VID_MSK, data[3]);
> +	mc->key.ivl = FIELD_GET(RTL8365MB_D_L2_MC_D3_IVL_MSK, data[3]);

I noticed that, unlike rtl8365mb_d_l2_data_to_uc(), this does not clear
key.vid when IVL is 0, so the FID could be taken for a VID.

I do not think this is a bug, so I am not changing the logic. I will
add a comment here in the next revision, so that it is not mistaken for
an omission.

In struct rtl8365mb_l2_mc_key, vid and fid share storage. Reading the
field into key.vid therefore also sets key.fid, and with IVL=0 the
field holds the FID. Nothing is reinterpreted: it is the same value.

For unicast, vid and fid are separate members, which is why
rtl8365mb_d_l2_data_to_uc() has to split the shared hardware field by
IVL. For multicast there is nothing to split.

Keeping the field as read also makes a read-modify-write go back to the
same key through rtl8365mb_d_l2_mc_to_data(), which uses
ivl = key.ivl && key.vid and writes key.vid as the id. Clearing it for
IVL=0, as for unicast, would write a different key for an entry that
has a non-zero FID.

The driver only writes FID 0 (VID 0 gives IVL=0, FID=0), so there is no
functional difference today. The comment will say that vid and fid share
storage and why the value is kept as read.

Best regards,
Mieczyslaw Nalewaj

  reply	other threads:[~2026-11-21  9:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bc42ae96-dc7e-4b6e-b9cc-64cde5dc51ce.ref@yahoo.com>
2026-11-19 23:57 ` [PATCH net-next v12 00/13] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-19 23:58   ` [PATCH net-next v12 01/13] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-19 23:59   ` [PATCH net-next v12 02/13] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-20  0:00   ` [PATCH net-next v12 03/13] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-20  0:01   ` [PATCH net-next v12 04/13] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-20  0:02   ` [PATCH net-next v12 05/13] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-20  0:03   ` [PATCH net-next v12 06/13] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-20  0:04   ` [PATCH net-next v12 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D Mieczyslaw Nalewaj
2026-11-20 14:17     ` Gustavo Foletto Mora
2026-11-21  1:30       ` Mieczyslaw Nalewaj
2026-11-20  0:05   ` [PATCH net-next v12 08/13] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-11-20 14:18     ` Gustavo Foletto Mora
2026-11-20  0:06   ` [PATCH net-next v12 09/13] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-11-20 14:26     ` Gustavo Foletto Mora
2026-11-20  0:07   ` [PATCH net-next v12 10/13] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-20  0:07   ` [PATCH net-next v12 11/13] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-20  0:08   ` [PATCH net-next v12 12/13] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-21  9:33     ` Mieczyslaw Nalewaj [this message]
2026-11-20  0:09   ` [PATCH net-next v12 13/13] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-20 20:56     ` Gustavo Foletto Mora
2026-11-21  1:46       ` Mieczyslaw Nalewaj

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=1fb7feee-3e4b-4313-a596-29f2ad0de1dc@yahoo.com \
    --to=namiltd@yahoo.com \
    --cc=alvin.sipraga@analog.com \
    --cc=andrew@lunn.ch \
    --cc=contact@c127.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fabianotassotti@gmail.com \
    --cc=gabonpivovich@gmail.com \
    --cc=gusfmora@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuncy7@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=luizluca@gmail.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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®