public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: dsa: realtek: rtl8365mb: fix mode mask calculation
       [not found] <c1519cfa-5a66-48b6-a578-e0ac03a57484.ref@yahoo.com>
@ 2026-04-19  9:59 ` Mieczyslaw Nalewaj
  2026-04-19 19:08   ` Luiz Angelo Daros de Luca
  0 siblings, 1 reply; 2+ messages in thread
From: Mieczyslaw Nalewaj @ 2026-04-19  9:59 UTC (permalink / raw)
  To: netdev

The RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK macro was shifting
the 4-bit mask (0xF) by only (_extint % 2) bits instead of
(_extint % 2) * 4. This caused the mask to overlap with the adjacent
nibble when configuring odd-numbered external interfaces, selecting
the wrong bits entirely.

Align the shift calculation with the existing ...MODE_OFFSET macro.

Signed-off-by: Abdulkader Alrezej <alrazj.abdulkader@gmail.com>
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
---
 drivers/net/dsa/realtek/rtl8365mb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
index ad7044b295ec..b85c99216648 100644
--- a/drivers/net/dsa/realtek/rtl8365mb.c
+++ b/drivers/net/dsa/realtek/rtl8365mb.c
@@ -216,7 +216,7 @@
 		 (_extint) == 2 ? RTL8365MB_DIGITAL_INTERFACE_SELECT_REG1 : \
 		 0x0)
 #define   RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(_extint) \
-		(0xF << (((_extint) % 2)))
+		(0xF << (((_extint) % 2) * 4))
 #define   RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(_extint) \
 		(((_extint) % 2) * 4)
 
-- 
2.53.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: dsa: realtek: rtl8365mb: fix mode mask calculation
  2026-04-19  9:59 ` [PATCH] net: dsa: realtek: rtl8365mb: fix mode mask calculation Mieczyslaw Nalewaj
@ 2026-04-19 19:08   ` Luiz Angelo Daros de Luca
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Angelo Daros de Luca @ 2026-04-19 19:08 UTC (permalink / raw)
  To: Mieczyslaw Nalewaj, alrazj.abdulkader; +Cc: netdev

> The RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK macro was shifting
> the 4-bit mask (0xF) by only (_extint % 2) bits instead of
> (_extint % 2) * 4. This caused the mask to overlap with the adjacent
> nibble when configuring odd-numbered external interfaces, selecting
> the wrong bits entirely.
>
> Align the shift calculation with the existing ...MODE_OFFSET macro.
>
> Signed-off-by: Abdulkader Alrezej <alrazj.abdulkader@gmail.com>
> Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
> ---
>  drivers/net/dsa/realtek/rtl8365mb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
> index ad7044b295ec..b85c99216648 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb.c
> @@ -216,7 +216,7 @@
>                  (_extint) == 2 ? RTL8365MB_DIGITAL_INTERFACE_SELECT_REG1 : \
>                  0x0)
>  #define   RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(_extint) \
> -               (0xF << (((_extint) % 2)))
> +               (0xF << (((_extint) % 2) * 4))
>  #define   RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(_extint) \
>                 (((_extint) % 2) * 4)
>

Hello Abdulkader and Mieczyslaw,

This bug has been present since the subdriver submission. I renamed
the macro (d18b59f48b318) but I didn't change the logic. Maybe we just
got luck with defaults. The patch is good. You still missed the Fixes
tag. Just add before the first Signed-off-by:

Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver
for RTL8365MB-VC")

With that addiction, you can submit v2 with my Reviewed-by:

Regards,

Luiz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-19 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <c1519cfa-5a66-48b6-a578-e0ac03a57484.ref@yahoo.com>
2026-04-19  9:59 ` [PATCH] net: dsa: realtek: rtl8365mb: fix mode mask calculation Mieczyslaw Nalewaj
2026-04-19 19:08   ` Luiz Angelo Daros de Luca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox