* [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration
@ 2025-10-23 11:21 Prabhakar
2025-10-23 11:21 ` [PATCH net-next v3 1/2] net: ravb: Make DBAT entry count configurable per-SoC Prabhakar
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Prabhakar @ 2025-10-23 11:21 UTC (permalink / raw)
To: Niklas Söderlund, Paul Barker, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-renesas-soc, linux-kernel, Prabhakar, Biju Das,
Fabrizio Castro, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi All,
This series addresses several issues in the Renesas Ethernet AVB (ravb)
driver related to SoC-specific resource configuration.
The series includes the following changes:
- Make DBAT entry count configurable per SoC
The number of descriptor base address table (DBAT) entries is not uniform
across all SoCs. Pass this information via the hardware info structure and
allocate resources accordingly.
- Allocate correct number of queues based on SoC support
Use the per-SoC configuration to determine whether a network control queue
is available, and allocate queues dynamically to match the SoC's
capability.
Note, these patches were posted previously [0] as fixes but based on the
discussion there, I've reworked them based on feedback from Jakub and
dropped the fixes tag and Cc to stable, hence sending them for net-next.
[0] https://lore.kernel.org/all/20251017151830.171062-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
Cheers,
Prabhakar
Lad Prabhakar (2):
net: ravb: Make DBAT entry count configurable per-SoC
net: ravb: Allocate correct number of queues based on SoC support
drivers/net/ethernet/renesas/ravb.h | 2 +-
drivers/net/ethernet/renesas/ravb_main.c | 16 +++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next v3 1/2] net: ravb: Make DBAT entry count configurable per-SoC
2025-10-23 11:21 [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration Prabhakar
@ 2025-10-23 11:21 ` Prabhakar
2025-10-23 11:21 ` [PATCH net-next v3 2/2] net: ravb: Allocate correct number of queues based on SoC support Prabhakar
2025-10-25 2:10 ` [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Prabhakar @ 2025-10-23 11:21 UTC (permalink / raw)
To: Niklas Söderlund, Paul Barker, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-renesas-soc, linux-kernel, Prabhakar, Biju Das,
Fabrizio Castro, Lad Prabhakar, Niklas Söderlund
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Avoid wasting coherent DMA memory by allocating the descriptor base
address table sized for the actual number of DBAT/CDARq entries supported
by the SoC. Some platforms (for example GBETH) only provide two CDARq
entries; previously the driver always allocated space for 22 entries which
needlessly consumed memory on those systems.
Pass the per-SoC dbat_entry_num via struct ravb_hw_info and use it for
allocation and initialization in probe. This sizes the table correctly and
removes the unnecessary memory overhead on SoCs with fewer DBAT entries.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
v2->v3:
- Reworded commit message for clarity.
v1->v2:
- Added Reviewed-by tag from Niklas.
---
drivers/net/ethernet/renesas/ravb.h | 2 +-
drivers/net/ethernet/renesas/ravb_main.c | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7b48060c250b..d65cd83ddd16 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -1017,7 +1017,6 @@ enum CSR2_BIT {
#define CSR2_CSUM_ENABLE (CSR2_RTCP4 | CSR2_RUDP4 | CSR2_RICMP4 | \
CSR2_RTCP6 | CSR2_RUDP6 | CSR2_RICMP6)
-#define DBAT_ENTRY_NUM 22
#define RX_QUEUE_OFFSET 4
#define NUM_RX_QUEUE 2
#define NUM_TX_QUEUE 2
@@ -1062,6 +1061,7 @@ struct ravb_hw_info {
u32 rx_max_frame_size;
u32 rx_buffer_size;
u32 rx_desc_size;
+ u32 dbat_entry_num;
unsigned aligned_tx: 1;
unsigned coalesce_irqs:1; /* Needs software IRQ coalescing */
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 9d3bd65b85ff..69d382e8757d 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2694,6 +2694,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = {
.rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
+ .dbat_entry_num = 22,
.aligned_tx = 1,
.gptp = 1,
.nc_queues = 1,
@@ -2717,6 +2718,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
.rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
+ .dbat_entry_num = 22,
.internal_delay = 1,
.tx_counters = 1,
.multi_irqs = 1,
@@ -2743,6 +2745,7 @@ static const struct ravb_hw_info ravb_gen4_hw_info = {
.rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
+ .dbat_entry_num = 22,
.internal_delay = 1,
.tx_counters = 1,
.multi_irqs = 1,
@@ -2769,6 +2772,7 @@ static const struct ravb_hw_info ravb_rzv2m_hw_info = {
.rx_buffer_size = SZ_2K +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
.rx_desc_size = sizeof(struct ravb_ex_rx_desc),
+ .dbat_entry_num = 22,
.multi_irqs = 1,
.err_mgmt_irqs = 1,
.gptp = 1,
@@ -2794,6 +2798,7 @@ static const struct ravb_hw_info gbeth_hw_info = {
.rx_max_frame_size = SZ_8K,
.rx_buffer_size = SZ_2K,
.rx_desc_size = sizeof(struct ravb_rx_desc),
+ .dbat_entry_num = 2,
.aligned_tx = 1,
.coalesce_irqs = 1,
.tx_counters = 1,
@@ -3025,7 +3030,7 @@ static int ravb_probe(struct platform_device *pdev)
ravb_parse_delay_mode(np, ndev);
/* Allocate descriptor base address table */
- priv->desc_bat_size = sizeof(struct ravb_desc) * DBAT_ENTRY_NUM;
+ priv->desc_bat_size = sizeof(struct ravb_desc) * info->dbat_entry_num;
priv->desc_bat = dma_alloc_coherent(ndev->dev.parent, priv->desc_bat_size,
&priv->desc_bat_dma, GFP_KERNEL);
if (!priv->desc_bat) {
@@ -3035,7 +3040,7 @@ static int ravb_probe(struct platform_device *pdev)
error = -ENOMEM;
goto out_rpm_put;
}
- for (q = RAVB_BE; q < DBAT_ENTRY_NUM; q++)
+ for (q = RAVB_BE; q < info->dbat_entry_num; q++)
priv->desc_bat[q].die_dt = DT_EOS;
/* Initialise HW timestamp list */
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next v3 2/2] net: ravb: Allocate correct number of queues based on SoC support
2025-10-23 11:21 [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration Prabhakar
2025-10-23 11:21 ` [PATCH net-next v3 1/2] net: ravb: Make DBAT entry count configurable per-SoC Prabhakar
@ 2025-10-23 11:21 ` Prabhakar
2025-10-25 2:10 ` [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Prabhakar @ 2025-10-23 11:21 UTC (permalink / raw)
To: Niklas Söderlund, Paul Barker, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-renesas-soc, linux-kernel, Prabhakar, Biju Das,
Fabrizio Castro, Lad Prabhakar, Niklas Söderlund
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Use the per-SoC match data flag `nc_queues` to decide how many TX/RX
queues to allocate. If the SoC does not provide a network-control queue,
fall back to a single TX/RX queue. Obtain the match data before calling
alloc_etherdev_mqs() so the allocation is sized correctly.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
v2->v3:
- Reworded commit message for clarity.
v1->v2:
- Added Reviewed-by tag from Niklas.
---
drivers/net/ethernet/renesas/ravb_main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 69d382e8757d..a200e205825a 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2926,13 +2926,14 @@ static int ravb_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(rstc),
"failed to get cpg reset\n");
+ info = of_device_get_match_data(&pdev->dev);
+
ndev = alloc_etherdev_mqs(sizeof(struct ravb_private),
- NUM_TX_QUEUE, NUM_RX_QUEUE);
+ info->nc_queues ? NUM_TX_QUEUE : 1,
+ info->nc_queues ? NUM_RX_QUEUE : 1);
if (!ndev)
return -ENOMEM;
- info = of_device_get_match_data(&pdev->dev);
-
ndev->features = info->net_features;
ndev->hw_features = info->net_hw_features;
ndev->vlan_features = info->vlan_features;
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration
2025-10-23 11:21 [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration Prabhakar
2025-10-23 11:21 ` [PATCH net-next v3 1/2] net: ravb: Make DBAT entry count configurable per-SoC Prabhakar
2025-10-23 11:21 ` [PATCH net-next v3 2/2] net: ravb: Allocate correct number of queues based on SoC support Prabhakar
@ 2025-10-25 2:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-25 2:10 UTC (permalink / raw)
To: Prabhakar
Cc: niklas.soderlund, paul, andrew+netdev, davem, edumazet, kuba,
pabeni, netdev, linux-renesas-soc, linux-kernel, biju.das.jz,
fabrizio.castro.jz, prabhakar.mahadev-lad.rj
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 23 Oct 2025 12:21:09 +0100 you wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Hi All,
>
> This series addresses several issues in the Renesas Ethernet AVB (ravb)
> driver related to SoC-specific resource configuration.
>
> [...]
Here is the summary with links:
- [net-next,v3,1/2] net: ravb: Make DBAT entry count configurable per-SoC
https://git.kernel.org/netdev/net-next/c/9078e6c5f1de
- [net-next,v3,2/2] net: ravb: Allocate correct number of queues based on SoC support
https://git.kernel.org/netdev/net-next/c/3912e804ff6a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-25 2:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-23 11:21 [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration Prabhakar
2025-10-23 11:21 ` [PATCH net-next v3 1/2] net: ravb: Make DBAT entry count configurable per-SoC Prabhakar
2025-10-23 11:21 ` [PATCH net-next v3 2/2] net: ravb: Allocate correct number of queues based on SoC support Prabhakar
2025-10-25 2:10 ` [PATCH net-next v3 0/2] net: ravb: Fix SoC-specific configuration patchwork-bot+netdevbpf
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®