Commit 56865678 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-ravb-soc-specific-configuration'

Lad Prabhakar says:

====================
net: ravb: SoC-specific configuration

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.

v2: https://lore.kernel.org/20251017151830.171062-1-prabhakar.mahadev-lad.rj@bp.renesas.com
====================

Link: https://patch.msgid.link/20251023112111.215198-1-prabhakar.mahadev-lad.rj@bp.renesas.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents c09b183d 3912e804
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 */

+11 −5
Original line number Diff line number Diff line
@@ -2714,6 +2714,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,
@@ -2737,6 +2738,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,
@@ -2763,6 +2765,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,
@@ -2789,6 +2792,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,
@@ -2814,6 +2818,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,
@@ -2941,13 +2946,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;
@@ -3045,7 +3051,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) {
@@ -3055,7 +3061,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 */