diff mbox series

[net-next,3/5] net: renesas: rswitch: Alloc all 128 queues

Message ID 20230529080840.1156458-4-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: renesas: rswitch: Improve performance of TX | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 1 maintainers not CCed: alexanderduyck@fb.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: line length of 82 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yoshihiro Shimoda May 29, 2023, 8:08 a.m. UTC
To use per-queue rate limiter feature in the future, alloc all 128
queues (GWCA_AXI_CHAIN_N) of GWCA so that drop num_queues from
struct rswitch_gwca. Notes that add a condition of gwca.used flag
in rswitch_data_irq() because the previous code always set the flag
of all queues.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/net/ethernet/renesas/rswitch.c | 19 ++++++++++---------
 drivers/net/ethernet/renesas/rswitch.h |  1 -
 2 files changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 51df96de6fd5..4aab5d8aad2f 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -508,16 +508,16 @@  static int rswitch_gwca_queue_ext_ts_format(struct net_device *ndev,
 
 static int rswitch_gwca_linkfix_alloc(struct rswitch_private *priv)
 {
-	int i, num_queues = priv->gwca.num_queues;
 	struct rswitch_gwca *gwca = &priv->gwca;
 	struct device *dev = &priv->pdev->dev;
+	int i;
 
-	gwca->linkfix_table_size = sizeof(struct rswitch_desc) * num_queues;
+	gwca->linkfix_table_size = sizeof(struct rswitch_desc) * GWCA_AXI_CHAIN_N;
 	gwca->linkfix_table = dma_alloc_coherent(dev, gwca->linkfix_table_size,
 						 &gwca->linkfix_table_dma, GFP_KERNEL);
 	if (!gwca->linkfix_table)
 		return -ENOMEM;
-	for (i = 0; i < num_queues; i++)
+	for (i = 0; i < GWCA_AXI_CHAIN_N; i++)
 		gwca->linkfix_table[i].die_dt = DT_EOS;
 
 	return 0;
@@ -538,8 +538,8 @@  static struct rswitch_gwca_queue *rswitch_gwca_get(struct rswitch_private *priv)
 	struct rswitch_gwca_queue *gq;
 	int index;
 
-	index = find_first_zero_bit(priv->gwca.used, priv->gwca.num_queues);
-	if (index >= priv->gwca.num_queues)
+	index = find_first_zero_bit(priv->gwca.used, GWCA_AXI_CHAIN_N);
+	if (index >= GWCA_AXI_CHAIN_N)
 		return NULL;
 	set_bit(index, priv->gwca.used);
 	gq = &priv->gwca.queues[index];
@@ -846,7 +846,10 @@  static irqreturn_t rswitch_data_irq(struct rswitch_private *priv, u32 *dis)
 	struct rswitch_gwca_queue *gq;
 	int i, index, bit;
 
-	for (i = 0; i < priv->gwca.num_queues; i++) {
+	for (i = 0; i < GWCA_AXI_CHAIN_N; i++) {
+		if (!test_bit(i, priv->gwca.used))
+			continue;
+
 		gq = &priv->gwca.queues[i];
 		index = gq->index / 32;
 		bit = BIT(gq->index % 32);
@@ -1890,9 +1893,7 @@  static int renesas_eth_sw_probe(struct platform_device *pdev)
 	}
 
 	priv->gwca.index = AGENT_INDEX_GWCA;
-	priv->gwca.num_queues = min(RSWITCH_NUM_PORTS * NUM_QUEUES_PER_NDEV,
-				    GWCA_AXI_CHAIN_N);
-	priv->gwca.queues = devm_kcalloc(&pdev->dev, priv->gwca.num_queues,
+	priv->gwca.queues = devm_kcalloc(&pdev->dev, GWCA_AXI_CHAIN_N,
 					 sizeof(*priv->gwca.queues), GFP_KERNEL);
 	if (!priv->gwca.queues)
 		return -ENOMEM;
diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
index 550a6bff9078..c3c2c92c2a1e 100644
--- a/drivers/net/ethernet/renesas/rswitch.h
+++ b/drivers/net/ethernet/renesas/rswitch.h
@@ -956,7 +956,6 @@  struct rswitch_gwca {
 	dma_addr_t linkfix_table_dma;
 	u32 linkfix_table_size;
 	struct rswitch_gwca_queue *queues;
-	int num_queues;
 	struct rswitch_gwca_queue ts_queue;
 	struct list_head ts_info_list;
 	DECLARE_BITMAP(used, GWCA_AXI_CHAIN_N);