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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux