[dpdk-dev,1/5] net/bnxt: fix size of tx ring in HW

Message ID 20180122062046.81908-2-ajit.khaparde@broadcom.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Ajit Khaparde Jan. 22, 2018, 6:20 a.m. UTC
  During Tx ring allocation, the actual ring size configured in the HW
ends up being twice the number of txd parameter specified to the driver.
The power of 2 ring size wrongly adds a +1 while sending the ring
create command to the FW.

Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_txr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Jan. 22, 2018, 12:22 p.m. UTC | #1
On 1/22/2018 6:20 AM, Ajit Khaparde wrote:
> During Tx ring allocation, the actual ring size configured in the HW
> ends up being twice the number of txd parameter specified to the driver.
> The power of 2 ring size wrongly adds a +1 while sending the ring
> create command to the FW.
> 
> Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")

If you request this fix to be backported to the stable trees, please add
following line in commit log just below "Fixes:" line:
Cc: stable@dpdk.org

> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_txr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
> index ac77434b7..2f2c87119 100644
> --- a/drivers/net/bnxt/bnxt_txr.c
> +++ b/drivers/net/bnxt/bnxt_txr.c
> @@ -101,7 +101,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
>  	if (ring == NULL)
>  		return -ENOMEM;
>  	txr->tx_ring_struct = ring;
> -	ring->ring_size = rte_align32pow2(txq->nb_tx_desc + 1);
> +	ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
>  	ring->ring_mask = ring->ring_size - 1;
>  	ring->bd = (void *)txr->tx_desc_ring;
>  	ring->bd_dma = txr->tx_desc_mapping;
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index ac77434b7..2f2c87119 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -101,7 +101,7 @@  int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id)
 	if (ring == NULL)
 		return -ENOMEM;
 	txr->tx_ring_struct = ring;
-	ring->ring_size = rte_align32pow2(txq->nb_tx_desc + 1);
+	ring->ring_size = rte_align32pow2(txq->nb_tx_desc);
 	ring->ring_mask = ring->ring_size - 1;
 	ring->bd = (void *)txr->tx_desc_ring;
 	ring->bd_dma = txr->tx_desc_mapping;