To use per-queue rate limiter feature in the future, use AXI_TLIM_N queues if a TX queue. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> --- drivers/net/ethernet/renesas/rswitch.c | 10 ++++++---- drivers/net/ethernet/renesas/rswitch.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c index 4aab5d8aad2f..4ae34b0206cd 100644 --- a/drivers/net/ethernet/renesas/rswitch.c +++ b/drivers/net/ethernet/renesas/rswitch.c @@ -533,12 +533,14 @@ static void rswitch_gwca_linkfix_free(struct rswitch_private *priv) gwca->linkfix_table = NULL; } -static struct rswitch_gwca_queue *rswitch_gwca_get(struct rswitch_private *priv) +static struct rswitch_gwca_queue *rswitch_gwca_get(struct rswitch_private *priv, + bool dir_tx) { struct rswitch_gwca_queue *gq; int index; - index = find_first_zero_bit(priv->gwca.used, GWCA_AXI_CHAIN_N); + index = find_next_zero_bit(priv->gwca.used, GWCA_AXI_CHAIN_N, + dir_tx ? GWCA_AXI_TRIM_BASE : 0); if (index >= GWCA_AXI_CHAIN_N) return NULL; set_bit(index, priv->gwca.used); @@ -561,7 +563,7 @@ static int rswitch_txdmac_alloc(struct net_device *ndev) struct rswitch_private *priv = rdev->priv; int err; - rdev->tx_queue = rswitch_gwca_get(priv); + rdev->tx_queue = rswitch_gwca_get(priv, true); if (!rdev->tx_queue) return -EBUSY; @@ -595,7 +597,7 @@ static int rswitch_rxdmac_alloc(struct net_device *ndev) struct rswitch_private *priv = rdev->priv; int err; - rdev->rx_queue = rswitch_gwca_get(priv); + rdev->rx_queue = rswitch_gwca_get(priv, false); if (!rdev->rx_queue) return -EBUSY; diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h index c3c2c92c2a1e..7ba45ddab42a 100644 --- a/drivers/net/ethernet/renesas/rswitch.h +++ b/drivers/net/ethernet/renesas/rswitch.h @@ -49,7 +49,9 @@ #define GWRO RSWITCH_GWCA0_OFFSET #define GWCA_AXI_CHAIN_N 128 +#define GWCA_AXI_TLIM_N 32 #define GWCA_NUM_IRQ_REGS (GWCA_AXI_CHAIN_N / BITS_PER_TYPE(u32)) +#define GWCA_AXI_TRIM_BASE (GWCA_AXI_CHAIN_N - GWCA_AXI_TLIM_N) #define GWCA_TS_IRQ_RESOURCE_NAME "gwca0_rxts0" #define GWCA_TS_IRQ_NAME "rswitch: gwca0_rxts0" -- 2.25.1