@@ -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;
@@ -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);
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(-)