[v2,2/9] net/bnxt: fix ring alignment for thor-based adapters
diff mbox series

Message ID 20191004034903.85233-3-ajit.khaparde@broadcom.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • bnxt patchset
Related show

Checks

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

Commit Message

Ajit Khaparde Oct. 4, 2019, 3:48 a.m. UTC
From: Lance Richardson <lance.richardson@broadcom.com>

When using transmit/receive queue sizes smaller than 256, alignment
requirements are not being met for Thor-based adapters. Fix by
forcing memory addresses used for transmit/receive/aggregation ring
allocations to be on 4K boundaries.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ring.c | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox series

diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index a3e5a68714..4662e94132 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -162,18 +162,21 @@  int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	int nq_ring_len = BNXT_CHIP_THOR(bp) ? cp_ring_len : 0;
 
 	int tx_ring_start = nq_ring_start + nq_ring_len;
+	tx_ring_start = RTE_ALIGN(tx_ring_start, 4096);
 	int tx_ring_len = tx_ring_info ?
 	    RTE_CACHE_LINE_ROUNDUP(tx_ring_info->tx_ring_struct->ring_size *
 				   sizeof(struct tx_bd_long)) : 0;
 	tx_ring_len = RTE_ALIGN(tx_ring_len, 4096);
 
 	int rx_ring_start = tx_ring_start + tx_ring_len;
+	rx_ring_start = RTE_ALIGN(rx_ring_start, 4096);
 	int rx_ring_len =  rx_ring_info ?
 		RTE_CACHE_LINE_ROUNDUP(rx_ring_info->rx_ring_struct->ring_size *
 		sizeof(struct rx_prod_pkt_bd)) : 0;
 	rx_ring_len = RTE_ALIGN(rx_ring_len, 4096);
 
 	int ag_ring_start = rx_ring_start + rx_ring_len;
+	ag_ring_start = RTE_ALIGN(ag_ring_start, 4096);
 	int ag_ring_len = rx_ring_len * AGG_RING_SIZE_FACTOR;
 	ag_ring_len = RTE_ALIGN(ag_ring_len, 4096);