From: Mieczyslaw Nalewaj <namiltd@yahoo.com>
To: "Luiz Angelo Daros de Luca" <luizluca@gmail.com>,
"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,
maxime.chevallier@bootlin.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v7 05/10] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
Date: Mon, 9 Nov 2026 23:06:17 +0100 [thread overview]
Message-ID: <3d61128d-bcd2-4f31-8ba0-e35b488b5205@yahoo.com> (raw)
In-Reply-To: <CAJq09z7djw7MAbjc8jZuNsj12JhNCUOsGj-Ve73XwRjjHHO=JQ@mail.gmail.com>
On Mon, Nov 9, 2026 at 2:31 AM, Luiz Angelo Daros de Luca wrote:
> This is how I'm structuring it now, though it might migrate to
> function pointers later. A family check inside a shared function only
> makes sense for very localized differences. Since family A is shaping
> up well and family B sits conceptually between A and C, `is_d` doesn't
> scale well for future variants.
We are completely on the same page here. In the upcoming v10 patchset,
I have already migrated to function pointers to handle these
family-specific differences cleanly.
I introduced a dedicated `struct rtl8365mb_family_info` which has made it possible to reduce the use of `switch` statements:
struct rtl8365mb_family_info {
enum rtl8365mb_family family;
unsigned int num_ports;
const struct rtl8365mb_jam_tbl_entry *jam_table;
size_t jam_size;
int (*ext_config_forcemode)(struct realtek_priv *priv, int port,
bool link, int speed, int duplex,
bool tx_pause, bool rx_pause);
int (*vlan_4k_read)(struct realtek_priv *priv, u16 vid,
struct rtl8365mb_vlan4k *vlan4k);
int (*vlan_4k_write)(struct realtek_priv *priv,
const struct rtl8365mb_vlan4k *vlan4k);
size_t l2_entry_size;
void (*l2_data_to_uc)(const u16 *data, struct rtl8365mb_l2_uc *uc);
void (*l2_uc_to_data)(const struct rtl8365mb_l2_uc *uc, u16 *data);
void (*l2_data_to_mc)(const u16 *data, struct rtl8365mb_l2_mc *mc);
void (*l2_mc_to_data)(const struct rtl8365mb_l2_mc *mc, u16 *data);
};
static const struct rtl8365mb_family_info rtl8365mb_family_c = {
.family = RTL8365MB_FAMILY_C,
.num_ports = RTL8365MB_C_MAX_NUM_PORTS,
.jam_table = rtl8365mb_init_jam_8365mb_vc,
.jam_size = ARRAY_SIZE(rtl8365mb_init_jam_8365mb_vc),
.ext_config_forcemode = rtl8365mb_c_ext_config_forcemode,
.vlan_4k_read = rtl8365mb_c_vlan_4k_read,
.vlan_4k_write = rtl8365mb_c_vlan_4k_write,
.l2_entry_size = RTL8365MB_C_L2_ENTRY_SIZE,
.l2_data_to_uc = rtl8365mb_c_l2_data_to_uc,
.l2_uc_to_data = rtl8365mb_c_l2_uc_to_data,
.l2_data_to_mc = rtl8365mb_c_l2_data_to_mc,
.l2_mc_to_data = rtl8365mb_c_l2_mc_to_data,
};
static const struct rtl8365mb_family_info rtl8365mb_family_d = {
.family = RTL8365MB_FAMILY_D,
.num_ports = RTL8365MB_D_MAX_NUM_PORTS,
.jam_table = rtl8365mb_init_jam_8365mb_vc,
.jam_size = ARRAY_SIZE(rtl8365mb_init_jam_8365mb_vc),
.ext_config_forcemode = rtl8365mb_d_ext_config_forcemode,
.vlan_4k_read = rtl8365mb_d_vlan_4k_read,
.vlan_4k_write = rtl8365mb_d_vlan_4k_write,
.l2_entry_size = RTL8365MB_D_L2_ENTRY_SIZE,
.l2_data_to_uc = rtl8365mb_d_l2_data_to_uc,
.l2_uc_to_data = rtl8365mb_d_l2_uc_to_data,
.l2_data_to_mc = rtl8365mb_d_l2_data_to_mc,
.l2_mc_to_data = rtl8365mb_d_l2_mc_to_data,
};
This infrastructure should make it very straightforward to hook up
your upcoming Family A support without duplicating logic or bloating
the shared functions.
Best regards,
Mieczyslaw
next prev parent reply other threads:[~2026-11-09 22:06 UTC|newest]
Thread overview: 42+ 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-04 12:20 ` Alvin Šipraga
2026-11-02 14:39 ` [PATCH net-next v7 04/10] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-04 12:39 ` Alvin Šipraga
2026-11-05 7:56 ` Mieczyslaw Nalewaj
2026-11-05 12:39 ` Alvin Šipraga
2026-11-05 15:27 ` Mieczyslaw Nalewaj
2026-11-06 13:50 ` Alvin Šipraga
2026-11-06 14:56 ` Mieczyslaw Nalewaj
2026-11-06 15:15 ` Alvin Šipraga
2026-11-06 16:43 ` Mieczyslaw Nalewaj
2026-11-06 15:11 ` 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-04 12:45 ` Alvin Šipraga
2026-11-09 1:31 ` Luiz Angelo Daros de Luca
2026-11-09 22:06 ` Mieczyslaw Nalewaj [this message]
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-09 2:01 ` Luiz Angelo Daros de Luca
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-04 12:57 ` Alvin Šipraga
2026-11-05 7:18 ` Mieczyslaw Nalewaj
2026-11-05 8:52 ` Alvin Šipraga
2026-11-05 10:24 ` Mieczyslaw Nalewaj
2026-11-05 12:09 ` Alvin Šipraga
2026-11-06 14:28 ` Alvin Šipraga
2026-11-06 14:56 ` Mieczyslaw Nalewaj
2026-11-06 15:46 ` Alvin Šipraga
2026-11-06 15:49 ` Andrew Lunn
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
2026-11-09 2:34 ` Luiz Angelo Daros de Luca
2026-11-02 14:45 ` [PATCH net-next v7 10/10] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-03 22:52 ` Alvin Šipraga
2026-11-03 23:41 ` Mieczyslaw Nalewaj
2026-11-04 9:40 ` Mieczyslaw Nalewaj
2026-11-04 13:14 ` Alvin Šipraga
2026-11-04 16:37 ` 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=3d61128d-bcd2-4f31-8ba0-e35b488b5205@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®