net: ravb: Fix SoC-specific configuration
Subsystems (3)
v3 cover net: ravb: Fix SoC-specific configuration
From: Lad Prabhakar <[email protected]>
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/[email protected]/
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(-)
Signature · 1 line
2.43.0
PATCH v3 1/2 net: ravb: Make DBAT entry count configurable per-SoC
From: Lad Prabhakar <[email protected]>
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.
---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(-)
drivers/net/ethernet/renesas/ravb.h +1 -1
@@ -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 */
drivers/net/ethernet/renesas/ravb_main.c +7 -2
@@ -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 */
Signature · 1 line
2.43.0
PATCH v3 2/2 net: ravb: Allocate correct number of queues based on SoC support
In reply to PrabhakarFrom: Lad Prabhakar <[email protected]>
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.
---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(-)
drivers/net/ethernet/renesas/ravb_main.c +4 -3
@@ -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;
Signature · 1 line
2.43.0
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 23 Oct 2025 12:21:09 +0100 you wrote:
From: Lad Prabhakar <[email protected]>
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html