Thread View: linux.kernel.netdev
9 messages
9 total messages
Started by Prabhakar
Mon, 23 Nov 2026 13:08
[PATCH net v6 0/4] net: dsa: Fix various issues in rzn1-a5psw driver
Author: Prabhakar
Date: Mon, 23 Nov 2026 13:08
Date: Mon, 23 Nov 2026 13:08
35 lines
12303 bytes
12303 bytes
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Hi all, This series fixes several issues in the RZ/N1 Advanced 5-port Switch driver, including the LK_LEARNCOUNT write mode encoding, VLANTransmitted counter offset, MDIO clock divider calculation, and ensures the driver data is set in the probe function. Note these fixes were part of series [0] as suggested by the reviewers sending this series to net instead of net-next and has been marked as v6. [0] https://lore.kernel.org/all/20261120002549.1908299-1-prabhakar.mahadev-lad.rj@bp.renesas.com/ v5->v6: - Added a5psw_set_learncount() helper function - Update commit message in patch #1 - Added reviewed-by tag for patch #1, #3, and #4 Cheers, Prabhakar Lad Prabhakar (4): net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation net: dsa: rzn1-a5psw: Set driver data in probe drivers/net/dsa/rzn1_a5psw.c | 26 +++++++++++++++----------- drivers/net/dsa/rzn1_a5psw.h | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) -- 2.56.1
[PATCH net v6 1/4] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding
Author: Prabhakar
Date: Mon, 23 Nov 2026 13:08
Date: Mon, 23 Nov 2026 13:08
89 lines
14490 bytes
14490 bytes
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The LK_LEARNCOUNT register selects its write operation through the MODE
field in bits [31:30], with the new count value in the low bits. The
driver writes the raw A5PSW_LK_LEARNCOUNT_MODE_* values (0, 1, 2)
directly, so the MODE field is always 0 (SET) and the mode value ends up
in the count field instead.
Add an a5psw_set_learncount() helper that places the mode in the correct
field using FIELD_PREP(), and use it for all LEARNCOUNT writes.
Fixes: 5edf246c6869 ("net: dsa: rzn1-a5psw: add FDB support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Clément Léger <clement.leger@linux.dev>
---
v6:
- Added a5psw_set_learncount() helper function
- Update commit message to clarify the purpose of the helper function
- Added reviewed-by tag
v5: https://lore.kernel.org/all/20261120002549.1908299-9-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
drivers/net/dsa/rzn1_a5psw.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 13c46cf2c420..4c32e06a3cd2 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -5,6 +5,7 @@
* Clément Léger <clement.leger@bootlin.com>
*/
+#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/etherdevice.h>
#include <linux/if_bridge.h>
@@ -120,6 +121,12 @@ static void a5psw_port_mgmtfwd_set(struct a5psw *a5psw, int port, bool enable)
a5psw_port_pattern_set(a5psw, port, A5PSW_PATTERN_MGMTFWD, enable);
}
+static void a5psw_set_learncount(struct a5psw *a5psw, u32 mode)
+{
+ a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT,
+ FIELD_PREP(A5PSW_LK_LEARNCOUNT_MODE, mode));
+}
+
static void a5psw_port_tx_enable(struct a5psw *a5psw, int port, bool enable)
{
u32 mask = A5PSW_PORT_ENA_TX(port);
@@ -544,10 +551,8 @@ static int a5psw_port_fdb_add(struct dsa_switch *ds, int port,
if (ret)
goto lk_unlock;
- if (inc_learncount) {
- reg = A5PSW_LK_LEARNCOUNT_MODE_INC;
- a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
- }
+ if (inc_learncount)
+ a5psw_set_learncount(a5psw, A5PSW_LK_LEARNCOUNT_MODE_INC);
lk_unlock:
mutex_unlock(&a5psw->lk_lock);
@@ -603,10 +608,8 @@ static int a5psw_port_fdb_del(struct dsa_switch *ds, int port,
goto lk_unlock;
/* Decrement LEARNCOUNT */
- if (clear) {
- reg = A5PSW_LK_LEARNCOUNT_MODE_DEC;
- a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
- }
+ if (clear)
+ a5psw_set_learncount(a5psw, A5PSW_LK_LEARNCOUNT_MODE_DEC);
lk_unlock:
mutex_unlock(&a5psw->lk_lock);
@@ -963,8 +966,7 @@ static int a5psw_setup(struct dsa_switch *ds)
}
/* Reset learn count to 0 */
- reg = A5PSW_LK_LEARNCOUNT_MODE_SET;
- a5psw_reg_writel(a5psw, A5PSW_LK_LEARNCOUNT, reg);
+ a5psw_set_learncount(a5psw, A5PSW_LK_LEARNCOUNT_MODE_SET);
/* Clear VLAN resource table */
reg = A5PSW_VLAN_RES_WR_PORTMASK | A5PSW_VLAN_RES_WR_TAGMASK;
--
2.56.1
[PATCH net v6 2/4] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset
Author: Prabhakar
Date: Mon, 23 Nov 2026 13:08
Date: Mon, 23 Nov 2026 13:08
33 lines
12374 bytes
12374 bytes
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The RZ/N1 hardware manual places the VLANTransmittedOK counter at
offset 0x8f4, not 0x8ec. Correct the register offset so the driver
reads the counter from the right location.
Fixes: c7243fd4a62f ("net: dsa: rzn1-a5psw: add statistics support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v6:
- No changes from v5
v5: https://lore.kernel.org/all/20261120002549.1908299-10-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
drivers/net/dsa/rzn1_a5psw.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
index d54acedac194..9693f8503b0b 100644
--- a/drivers/net/dsa/rzn1_a5psw.h
+++ b/drivers/net/dsa/rzn1_a5psw.h
@@ -185,7 +185,7 @@
#define A5PSW_etherStatsFragments 0x8E0
#define A5PSW_VLANReceived 0x8E8
-#define A5PSW_VLANTransmitted 0x8EC
+#define A5PSW_VLANTransmitted 0x8F4
#define A5PSW_aDeferred 0x910
#define A5PSW_aMultipleCollisions 0x914
--
2.56.1
[PATCH net v6 3/4] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation
Author: Prabhakar
Date: Mon, 23 Nov 2026 13:08
Date: Mon, 23 Nov 2026 13:08
45 lines
13053 bytes
13053 bytes
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
The MDC frequency is hclk / (2 * CLKDIV + 1) on RZ/N1 as well as
RZ/T2H and RZ/N2H. The existing calculation uses the wrong divisor
formula and can set MDC above the requested clock-frequency.
Calculate the smallest CLKDIV that keeps MDC at or below the requested
frequency.
Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Clément Léger <clement.leger@linux.dev>
---
v6:
- Added reviewed-by tag
v5: https://lore.kernel.org/all/20261120002549.1908299-11-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
drivers/net/dsa/rzn1_a5psw.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 4c32e06a3cd2..7fc62956c5d0 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -11,6 +11,7 @@
#include <linux/if_bridge.h>
#include <linux/if_ether.h>
#include <linux/kernel.h>
+#include <linux/math.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
@@ -1102,7 +1103,7 @@ static int a5psw_mdio_config(struct a5psw *a5psw, u32 mdio_freq)
u32 cfgstatus;
rate = clk_get_rate(a5psw->hclk);
- div = ((rate / mdio_freq) / 2);
+ div = DIV_ROUND_UP(DIV_ROUND_UP(rate, mdio_freq) - 1, 2);
if (div > FIELD_MAX(A5PSW_MDIO_CFG_STATUS_CLKDIV) ||
div < A5PSW_MDIO_CLK_DIV_MIN) {
dev_err(a5psw->dev, "MDIO clock div %ld out of range\n", div);
--
2.56.1
[PATCH net v6 4/4] net: dsa: rzn1-a5psw: Set driver data in probe
Author: Prabhakar
Date: Mon, 23 Nov 2026 13:08
Date: Mon, 23 Nov 2026 13:08
38 lines
12738 bytes
12738 bytes
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
a5psw_remove() and a5psw_shutdown() retrieve the driver private data
using platform_get_drvdata(), but a5psw_probe() never sets it.
Consequently, both callbacks return early without unregistering or
shutting down the DSA switch.
Set the driver data in probe to ensure the remove and shutdown
callbacks can access the private data and perform the required DSA
cleanup.
Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Clément Léger <clement.leger@linux.dev>
---
v6:
- Added reviewed-by tag
v5: https://lore.kernel.org/all/20261120002549.1908299-12-prabhakar.mahadev-lad.rj@bp.renesas.com/
---
drivers/net/dsa/rzn1_a5psw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 7fc62956c5d0..4925d24ec2a3 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1219,6 +1219,7 @@ static int a5psw_probe(struct platform_device *pdev)
if (!a5psw)
return -ENOMEM;
+ platform_set_drvdata(pdev, a5psw);
a5psw->dev = dev;
mutex_init(&a5psw->lk_lock);
spin_lock_init(&a5psw->reg_lock);
--
2.56.1
Re: [PATCH net v6 0/4] net: dsa: Fix various issues in rzn1-a5psw driver
Author: netdev-bot+sinfo
Date: Mon, 23 Nov 2026 13:12
Date: Mon, 23 Nov 2026 13:12
23 lines
9127 bytes
9127 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. *IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages. -- The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH net v6 0/4] net: dsa: Fix various issues in rzn1-a5psw driver
Author: "Lad, Prabhakar"
Date: Mon, 23 Nov 2026 13:16
Date: Mon, 23 Nov 2026 13:16
26 lines
13482 bytes
13482 bytes
On Mon, Nov 23, 2026 at 1:12 PM <netdev-bot+sinfo@kernel.org> wrote: > > Hi! > > This is an automated message. This series looks like a fix, but its > commit messages seem to be missing some information: > > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. > > - Whether the issue was actually triggered, or is only theoretical > (e.g. found by LLM and not proven at runtime). If it was triggered > please include the symptoms, like the stack trace or kernel messages. > > Please do not repost the series just to address the above. Instead, > reply to this email with the missing information, so that reviewers > can take it into account. > The issues were found while manually comparing the hardware manuals for RZ/N1 and RZ/T2H SoCs. Cheers, Prabhakar
Re: [PATCH net v6 2/4] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset
Author: Clement Leger
Date: Mon, 23 Nov 2026 15:24
Date: Mon, 23 Nov 2026 15:24
42 lines
9806 bytes
9806 bytes
On 11/23/26 14:08, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> The RZ/N1 hardware manual places the VLANTransmittedOK counter at
> offset 0x8f4, not 0x8ec. Correct the register offset so the driver
> reads the counter from the right location.
>
> Fixes: c7243fd4a62f ("net: dsa: rzn1-a5psw: add statistics support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v6:
> - No changes from v5
> v5: https://lore.kernel.org/all/20261120002549.1908299-10-prabhakar.mahadev-lad.rj@bp.renesas.com/
> ---
> drivers/net/dsa/rzn1_a5psw.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
> index d54acedac194..9693f8503b0b 100644
> --- a/drivers/net/dsa/rzn1_a5psw.h
> +++ b/drivers/net/dsa/rzn1_a5psw.h
> @@ -185,7 +185,7 @@
> #define A5PSW_etherStatsFragments 0x8E0
>
> #define A5PSW_VLANReceived 0x8E8
> -#define A5PSW_VLANTransmitted 0x8EC
> +#define A5PSW_VLANTransmitted 0x8F4
>
> #define A5PSW_aDeferred 0x910
> #define A5PSW_aMultipleCollisions 0x914
Hi Prabhakar,
Reviewed-by: Clément Léger <clement.leger@linux.dev>
Thanks,
Clément
Re: [PATCH net v6 0/4] net: dsa: Fix various issues in rzn1-a5psw driver
Author: patchwork-bot+netdevbpf
Date: Mon, 30 Nov 2026 18:10
Date: Mon, 30 Nov 2026 18:10
32 lines
9259 bytes
9259 bytes
Hello:
This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 23 Nov 2026 13:08:48 +0000 you wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Hi all,
>
> This series fixes several issues in the RZ/N1 Advanced 5-port Switch
> driver, including the LK_LEARNCOUNT write mode encoding, VLANTransmitted
> counter offset, MDIO clock divider calculation, and ensures the driver
> data is set in the probe function.
>
> [...]
Here is the summary with links:
- [net,v6,1/4] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding
https://git.kernel.org/netdev/net-next/c/1c5dd3b4ece4
- [net,v6,2/4] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset
https://git.kernel.org/netdev/net-next/c/15507cfe0dd0
- [net,v6,3/4] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation
https://git.kernel.org/netdev/net-next/c/24590745aa4a
- [net,v6,4/4] net: dsa: rzn1-a5psw: Set driver data in probe
https://git.kernel.org/netdev/net-next/c/808d316d157b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads