mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mieczyslaw Nalewaj <namiltd@yahoo.com>
To: "Alvin Šipraga" <alvin.sipraga@analog.com>
Cc: 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
Subject: Re: [PATCH net-next v7 09/10] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D
Date: Tue, 3 Nov 2026 17:44:13 +0100	[thread overview]
Message-ID: <15ba8390-45c2-4f45-bafa-212a129d2410@yahoo.com> (raw)
In-Reply-To: <aun7hiSq4MF5BXOc@analog.com>

On Mon, Nov 02, 2026 at 03:44:36PM +0100, Mieczyslaw Nalewaj wrote:
> +static bool rtl8365mb_l2_is_d(struct realtek_priv *priv)
> +{
> +	return rtl8365mb_get_family(priv) == RTL8365MB_FAMILY_D;
> +}

On Tue, Nov 03, 2026, Alvin wrote:
> Shouldn't this be a top-level function, like rtl8365mb_is_d()?

Yes. For v8 I'll add a single rtl8365mb_is_d() static inline to
rtl8365mb.h (in the patch that introduces the family infrastructure)
and the L2, table and main code now use it. The l2-local helper will
gone.

> +static void rtl8365mb_l2_mac_to_data(const u8 *m, u16 *data)
> +static void rtl8365mb_l2_data_to_mac(const u16 *data, u8 *m)
[...]
> From the diff it would seem that this is specific to the D family, since
> you only use it in those functions. But looking over my crappy original
> code for the C family, it's quite the same is it not? Can't you update
> the C family functions to use these helpers too?

Good catch, the packing is identical. For v8 I'll add a preparatory
patch before this one that moves the two MAC helpers above the C
serialisers and converts the C functions to use them. It is meant to
be a no-op refactor, so it can be reviewed on its own.

> +static void rtl8365mb_l2_data_to_uc_any(struct realtek_priv *priv,
> +					const u16 *data,
> +					struct rtl8365mb_l2_uc *uc)
> +{
> +	if (rtl8365mb_l2_is_d(priv))
> +		rtl8365mb_d_l2_data_to_uc(data, uc);
> +	else
> +		rtl8365mb_l2_data_to_uc(data, uc);
> +}
>
> Can't we have:
>
> rtl8365mb_l2_data_to_uc() # same as before at all callsites
>
> call into either:
>
> rtl8365mb_c_l2_data_to_uc()
> rtl8365mb_d_l2_data_to_uc()
>
> instead?
> [...]
> The above comment applies to all these _any() functions.

Agreed. In v8 the existing C serialisers are renamed to
rtl8365mb_c_l2_*() (in the same preparatory patch, so this patch
stays purely additive), and rtl8365mb_l2_{data_to_uc,uc_to_data,
data_to_mc,mc_to_data}() become the per-family dispatchers calling
the c_ or d_ variant. The _any() wrappers are dropped. The
dispatchers need to know the family, so the callsites only gain the
priv argument.

> Even though family C is the originally supported family, I guess D is an
> equal citizen, so it's good to keep things in this driver symmetric.

Agreed, D should be a peer of C rather than a special case bolted on.

Thanks for the review,
Mieczyslaw

  reply	other threads:[~2026-11-03 16:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3bf4dd70-9771-497b-8c27-e925e0ef81eb.ref@yahoo.com>
2026-11-02 14:34 ` [PATCH net-next v7 0/10] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-02 14:36   ` [PATCH net-next v7 01/10] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-02 14:37   ` [PATCH net-next v7 02/10] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-02 14:38   ` [PATCH net-next v7 03/10] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-02 14:39   ` [PATCH net-next v7 04/10] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-02 14:40   ` [PATCH net-next v7 05/10] net: dsa: realtek: rtl8365mb: set and get vlan 4k " Mieczyslaw Nalewaj
2026-11-02 14:41   ` [PATCH net-next v7 06/10] net: dsa: realtek: rtl8365mb: use raw VID for PVID on " Mieczyslaw Nalewaj
2026-11-02 14:42   ` [PATCH net-next v7 07/10] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-02 14:43   ` [PATCH net-next v7 08/10] net: dsa: realtek: rtl8365mb: re-latch the family D SerDes Mieczyslaw Nalewaj
2026-11-02 14:44   ` [PATCH net-next v7 09/10] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-03 15:36     ` Alvin Šipraga
2026-11-03 16:44       ` Mieczyslaw Nalewaj [this message]
2026-11-02 14:45   ` [PATCH net-next v7 10/10] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB 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=15ba8390-45c2-4f45-bafa-212a129d2410@yahoo.com \
    --to=namiltd@yahoo.com \
    --cc=alvin.sipraga@analog.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --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®