[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230529080840.1156458-4-yoshihiro.shimoda.uh@renesas.com>
Date: Mon, 29 May 2023 17:08:38 +0900
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
To: s.shtylyov@....ru,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org,
geert+renesas@...der.be,
magnus.damm@...il.com
Cc: netdev@...r.kernel.org,
devicetree@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Subject: [PATCH net-next 3/5] net: renesas: rswitch: Alloc all 128 queues
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@...esas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 19 ++++++++++---------
drivers/net/ethernet/renesas/rswitch.h | 1 -
2 files changed, 10 insertions(+), 10 deletions(-)
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);
--
2.25.1
Powered by blists - more mailing lists