* [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes
@ 2021-06-16 17:55 Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 1/4] net/bnxt: fix ring and context memory allocation Lance Richardson
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Lance Richardson @ 2021-06-16 17:55 UTC (permalink / raw)
Cc: dev
[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]
Several fixes for the bnxt PMD:
- Fix NUMA-aware memory allocations.
- Fix transmit descriptor status implementation.
- Fix handling of transmit completions in non-vector path.
- Remove dead code.
Lance Richardson (4):
net/bnxt: fix ring and context memory allocation
net/bnxt: fix tx desc status implementation
net/bnxt: fix scalar Tx completion handling
net/bnxt: remove dead code
drivers/net/bnxt/bnxt_cpr.h | 17 -------
drivers/net/bnxt/bnxt_ethdev.c | 71 +++++++++++++++------------
drivers/net/bnxt/bnxt_hwrm.c | 2 -
drivers/net/bnxt/bnxt_ring.c | 31 ++++++------
drivers/net/bnxt/bnxt_ring.h | 2 +-
drivers/net/bnxt/bnxt_rxq.c | 4 +-
drivers/net/bnxt/bnxt_rxr.c | 11 -----
drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 3 --
drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 3 --
drivers/net/bnxt/bnxt_txq.c | 4 +-
drivers/net/bnxt/bnxt_txr.c | 22 ++++-----
drivers/net/bnxt/bnxt_vnic.c | 3 +-
12 files changed, 70 insertions(+), 103 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 1/4] net/bnxt: fix ring and context memory allocation
2021-06-16 17:55 [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Lance Richardson
@ 2021-06-16 17:55 ` Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 2/4] net/bnxt: fix tx desc status implementation Lance Richardson
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2021-06-16 17:55 UTC (permalink / raw)
To: Ajit Khaparde, Somnath Kotur, David Christensen, Stephen Hurd, Kalesh AP
Cc: dev, stable
[-- Attachment #1: Type: text/plain, Size: 9558 bytes --]
Use requested socket ID when allocating memory for transmit rings,
receive rings, and completion queues. Use device NUMA ID when
allocating context memory, notification queue rings, async
completion queue rings, and VNIC attributes.
Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
Fixes: 9738793f28ec ("net/bnxt: add VNIC functions and structs")
Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Fixes: bd0a14c99f65 ("net/bnxt: use dedicated CPR for async events")
Fixes: 683e5cf79249 ("net/bnxt: use common NQ ring")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 17 +++++++++--------
drivers/net/bnxt/bnxt_ring.c | 30 ++++++++++++++----------------
drivers/net/bnxt/bnxt_ring.h | 2 +-
drivers/net/bnxt/bnxt_rxq.c | 4 ++--
drivers/net/bnxt/bnxt_txq.c | 4 ++--
drivers/net/bnxt/bnxt_vnic.c | 3 ++-
6 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d859ef503..d4b8762d5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -580,13 +580,14 @@ static int bnxt_register_fc_ctx_mem(struct bnxt *bp)
return rc;
}
-static int bnxt_alloc_ctx_mem_buf(char *type, size_t size,
+static int bnxt_alloc_ctx_mem_buf(struct bnxt *bp, char *type, size_t size,
struct bnxt_ctx_mem_buf_info *ctx)
{
if (!ctx)
return -EINVAL;
- ctx->va = rte_zmalloc(type, size, 0);
+ ctx->va = rte_zmalloc_socket(type, size, 0,
+ bp->eth_dev->device->numa_node);
if (ctx->va == NULL)
return -ENOMEM;
rte_mem_lock_page(ctx->va);
@@ -610,7 +611,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp)
sprintf(type, "bnxt_rx_fc_in_" PCI_PRI_FMT, pdev->addr.domain,
pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
/* 4 bytes for each counter-id */
- rc = bnxt_alloc_ctx_mem_buf(type,
+ rc = bnxt_alloc_ctx_mem_buf(bp, type,
max_fc * 4,
&bp->flow_stat->rx_fc_in_tbl);
if (rc)
@@ -619,7 +620,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp)
sprintf(type, "bnxt_rx_fc_out_" PCI_PRI_FMT, pdev->addr.domain,
pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
/* 16 bytes for each counter - 8 bytes pkt_count, 8 bytes byte_count */
- rc = bnxt_alloc_ctx_mem_buf(type,
+ rc = bnxt_alloc_ctx_mem_buf(bp, type,
max_fc * 16,
&bp->flow_stat->rx_fc_out_tbl);
if (rc)
@@ -628,7 +629,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp)
sprintf(type, "bnxt_tx_fc_in_" PCI_PRI_FMT, pdev->addr.domain,
pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
/* 4 bytes for each counter-id */
- rc = bnxt_alloc_ctx_mem_buf(type,
+ rc = bnxt_alloc_ctx_mem_buf(bp, type,
max_fc * 4,
&bp->flow_stat->tx_fc_in_tbl);
if (rc)
@@ -637,7 +638,7 @@ static int bnxt_init_fc_ctx_mem(struct bnxt *bp)
sprintf(type, "bnxt_tx_fc_out_" PCI_PRI_FMT, pdev->addr.domain,
pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
/* 16 bytes for each counter - 8 bytes pkt_count, 8 bytes byte_count */
- rc = bnxt_alloc_ctx_mem_buf(type,
+ rc = bnxt_alloc_ctx_mem_buf(bp, type,
max_fc * 16,
&bp->flow_stat->tx_fc_out_tbl);
if (rc)
@@ -4518,7 +4519,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp,
if (!mz) {
mz = rte_memzone_reserve_aligned(mz_name,
rmem->nr_pages * 8,
- SOCKET_ID_ANY,
+ bp->eth_dev->device->numa_node,
RTE_MEMZONE_2MB |
RTE_MEMZONE_SIZE_HINT_ONLY |
RTE_MEMZONE_IOVA_CONTIG,
@@ -4541,7 +4542,7 @@ static int bnxt_alloc_ctx_mem_blk(struct bnxt *bp,
if (!mz) {
mz = rte_memzone_reserve_aligned(mz_name,
mem_size,
- SOCKET_ID_ANY,
+ bp->eth_dev->device->numa_node,
RTE_MEMZONE_1GB |
RTE_MEMZONE_SIZE_HINT_ONLY |
RTE_MEMZONE_IOVA_CONTIG,
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index e4055fa49..4a90ac264 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -94,7 +94,7 @@ int bnxt_alloc_ring_grps(struct bnxt *bp)
* tx bd ring - Only non-zero length if tx_ring_info is not NULL
* rx bd ring - Only non-zero length if rx_ring_info is not NULL
*/
-int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
+int bnxt_alloc_rings(struct bnxt *bp, unsigned int socket_id, uint16_t qidx,
struct bnxt_tx_queue *txq,
struct bnxt_rx_queue *rxq,
struct bnxt_cp_ring_info *cp_ring_info,
@@ -203,7 +203,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
mz = rte_memzone_lookup(mz_name);
if (!mz) {
mz = rte_memzone_reserve_aligned(mz_name, total_alloc_len,
- SOCKET_ID_ANY,
+ socket_id,
RTE_MEMZONE_2MB |
RTE_MEMZONE_SIZE_HINT_ONLY |
RTE_MEMZONE_IOVA_CONTIG,
@@ -435,24 +435,23 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp)
struct bnxt_cp_ring_info *nqr;
struct bnxt_ring *ring;
int ring_index = BNXT_NUM_ASYNC_CPR(bp);
- unsigned int socket_id;
uint8_t ring_type;
int rc = 0;
if (!BNXT_HAS_NQ(bp) || bp->rxtx_nq_ring)
return 0;
- socket_id = rte_lcore_to_socket_id(rte_get_main_lcore());
-
nqr = rte_zmalloc_socket("nqr",
sizeof(struct bnxt_cp_ring_info),
- RTE_CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE,
+ bp->eth_dev->device->numa_node);
if (nqr == NULL)
return -ENOMEM;
ring = rte_zmalloc_socket("bnxt_cp_ring_struct",
sizeof(struct bnxt_ring),
- RTE_CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE,
+ bp->eth_dev->device->numa_node);
if (ring == NULL) {
rte_free(nqr);
return -ENOMEM;
@@ -467,7 +466,8 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp)
ring->fw_ring_id = INVALID_HW_RING_ID;
nqr->cp_ring_struct = ring;
- rc = bnxt_alloc_rings(bp, 0, NULL, NULL, nqr, NULL, "l2_nqr");
+ rc = bnxt_alloc_rings(bp, bp->eth_dev->device->numa_node, 0, NULL,
+ NULL, nqr, NULL, "l2_nqr");
if (rc) {
rte_free(ring);
rte_free(nqr);
@@ -805,22 +805,21 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp)
{
struct bnxt_cp_ring_info *cpr = NULL;
struct bnxt_ring *ring = NULL;
- unsigned int socket_id;
if (BNXT_NUM_ASYNC_CPR(bp) == 0)
return 0;
- socket_id = rte_lcore_to_socket_id(rte_get_main_lcore());
-
cpr = rte_zmalloc_socket("cpr",
sizeof(struct bnxt_cp_ring_info),
- RTE_CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE,
+ bp->eth_dev->device->numa_node);
if (cpr == NULL)
return -ENOMEM;
ring = rte_zmalloc_socket("bnxt_cp_ring_struct",
sizeof(struct bnxt_ring),
- RTE_CACHE_LINE_SIZE, socket_id);
+ RTE_CACHE_LINE_SIZE,
+ bp->eth_dev->device->numa_node);
if (ring == NULL) {
rte_free(cpr);
return -ENOMEM;
@@ -836,7 +835,6 @@ int bnxt_alloc_async_ring_struct(struct bnxt *bp)
bp->async_cp_ring = cpr;
cpr->cp_ring_struct = ring;
- return bnxt_alloc_rings(bp, 0, NULL, NULL,
- bp->async_cp_ring, NULL,
- "def_cp");
+ return bnxt_alloc_rings(bp, bp->eth_dev->device->numa_node, 0, NULL,
+ NULL, bp->async_cp_ring, NULL, "def_cp");
}
diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h
index b8b666bb9..ef9586e64 100644
--- a/drivers/net/bnxt/bnxt_ring.h
+++ b/drivers/net/bnxt/bnxt_ring.h
@@ -67,7 +67,7 @@ struct bnxt_rx_ring_info;
struct bnxt_cp_ring_info;
void bnxt_free_ring(struct bnxt_ring *ring);
int bnxt_alloc_ring_grps(struct bnxt *bp);
-int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
+int bnxt_alloc_rings(struct bnxt *bp, unsigned int socket_id, uint16_t qidx,
struct bnxt_tx_queue *txq,
struct bnxt_rx_queue *rxq,
struct bnxt_cp_ring_info *cp_ring_info,
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 45e0c3d01..44b09e9c6 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -345,8 +345,8 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
eth_dev->data->rx_queues[queue_idx] = rxq;
/* Allocate RX ring hardware descriptors */
- rc = bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
- "rxr");
+ rc = bnxt_alloc_rings(bp, socket_id, queue_idx, NULL, rxq, rxq->cp_ring,
+ NULL, "rxr");
if (rc) {
PMD_DRV_LOG(ERR,
"ring_dma_zone_reserve for rx_ring failed!\n");
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index d95e1f752..bc789224d 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -149,8 +149,8 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
txq->port_id = eth_dev->data->port_id;
/* Allocate TX ring hardware descriptors */
- if (bnxt_alloc_rings(bp, queue_idx, txq, NULL, txq->cp_ring, NULL,
- "txr")) {
+ if (bnxt_alloc_rings(bp, socket_id, queue_idx, txq, NULL, txq->cp_ring,
+ NULL, "txr")) {
PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!");
rc = -ENOMEM;
goto err;
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index de5c14566..26253a7e1 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -145,7 +145,8 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
mz = rte_memzone_lookup(mz_name);
if (!mz) {
mz = rte_memzone_reserve(mz_name,
- entry_length * max_vnics, SOCKET_ID_ANY,
+ entry_length * max_vnics,
+ bp->eth_dev->device->numa_node,
RTE_MEMZONE_2MB |
RTE_MEMZONE_SIZE_HINT_ONLY |
RTE_MEMZONE_IOVA_CONTIG);
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 2/4] net/bnxt: fix tx desc status implementation
2021-06-16 17:55 [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 1/4] net/bnxt: fix ring and context memory allocation Lance Richardson
@ 2021-06-16 17:55 ` Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 3/4] net/bnxt: fix scalar Tx completion handling Lance Richardson
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2021-06-16 17:55 UTC (permalink / raw)
To: Ajit Khaparde, Somnath Kotur; +Cc: dev, stable
[-- Attachment #1: Type: text/plain, Size: 2847 bytes --]
With tx completion batching, a single transmit completion
can correspond to one or more transmit descriptors, adjust
implementation to account for this.
RTE_ETH_TX_DESC_DONE should be returned for descriptors that
are available for use instead of RTE_ETH_TX_DESC_UNAVAIL.
Fixes: 5735eb241947 ("net/bnxt: support Tx batching")
Fixes: 478ed3bb7b9d "(net/bnxt: support Tx descriptor status")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 54 +++++++++++++++++++---------------
1 file changed, 31 insertions(+), 23 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d4b8762d5..a4a0142e8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3296,41 +3296,49 @@ static int
bnxt_tx_descriptor_status_op(void *tx_queue, uint16_t offset)
{
struct bnxt_tx_queue *txq = (struct bnxt_tx_queue *)tx_queue;
- struct bnxt_tx_ring_info *txr;
- struct bnxt_cp_ring_info *cpr;
- struct rte_mbuf **tx_buf;
- struct tx_pkt_cmpl *txcmp;
- uint32_t cons, cp_cons;
+ struct bnxt_cp_ring_info *cpr = txq->cp_ring;
+ uint32_t ring_mask, raw_cons, nb_tx_pkts = 0;
+ struct bnxt_ring *cp_ring_struct;
+ struct cmpl_base *cp_desc_ring;
int rc;
- if (!txq)
- return -EINVAL;
-
rc = is_bnxt_in_error(txq->bp);
if (rc)
return rc;
- cpr = txq->cp_ring;
- txr = txq->tx_ring;
-
if (offset >= txq->nb_tx_desc)
return -EINVAL;
- cons = RING_CMP(cpr->cp_ring_struct, offset);
- txcmp = (struct tx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
- cp_cons = cpr->cp_raw_cons;
+ /* Return "desc done" if descriptor is available for use. */
+ if (bnxt_tx_bds_in_hw(txq) <= offset)
+ return RTE_ETH_TX_DESC_DONE;
- if (cons > cp_cons) {
- if (CMPL_VALID(txcmp, cpr->valid))
- return RTE_ETH_TX_DESC_UNAVAIL;
- } else {
- if (CMPL_VALID(txcmp, !cpr->valid))
- return RTE_ETH_TX_DESC_UNAVAIL;
+ raw_cons = cpr->cp_raw_cons;
+ cp_desc_ring = cpr->cp_desc_ring;
+ cp_ring_struct = cpr->cp_ring_struct;
+ ring_mask = cpr->cp_ring_struct->ring_mask;
+
+ /* Check to see if hw has posted a completion for the descriptor. */
+ while (1) {
+ struct tx_cmpl *txcmp;
+ uint32_t cons;
+
+ cons = RING_CMPL(ring_mask, raw_cons);
+ txcmp = (struct tx_cmpl *)&cp_desc_ring[cons];
+
+ if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
+ break;
+
+ if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)
+ nb_tx_pkts += rte_le_to_cpu_32(txcmp->opaque);
+
+ if (nb_tx_pkts > offset)
+ return RTE_ETH_TX_DESC_DONE;
+
+ raw_cons = NEXT_RAW_CMP(raw_cons);
}
- tx_buf = &txr->tx_buf_ring[cons];
- if (*tx_buf == NULL)
- return RTE_ETH_TX_DESC_DONE;
+ /* Descriptor is pending transmit, not yet completed by hardware. */
return RTE_ETH_TX_DESC_FULL;
}
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 3/4] net/bnxt: fix scalar Tx completion handling
2021-06-16 17:55 [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 1/4] net/bnxt: fix ring and context memory allocation Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 2/4] net/bnxt: fix tx desc status implementation Lance Richardson
@ 2021-06-16 17:55 ` Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 4/4] net/bnxt: remove dead code Lance Richardson
2021-06-23 15:45 ` [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Ajit Khaparde
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2021-06-16 17:55 UTC (permalink / raw)
To: Ajit Khaparde, Somnath Kotur; +Cc: dev, stable
[-- Attachment #1: Type: text/plain, Size: 2327 bytes --]
Preserve the raw (unmasked) transmit completion ring
consumer index.
Remove cache prefetches that have no measurable performance
benefit.
Fixes: c7de4195cc4c ("net/bnxt: modify ring index logic")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_txr.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 27459960d..54eaab34a 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -444,30 +444,26 @@ static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts)
static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
{
+ uint32_t nb_tx_pkts = 0, cons, ring_mask, opaque;
struct bnxt_cp_ring_info *cpr = txq->cp_ring;
uint32_t raw_cons = cpr->cp_raw_cons;
- uint32_t cons;
- uint32_t nb_tx_pkts = 0;
+ struct bnxt_ring *cp_ring_struct;
struct tx_cmpl *txcmp;
- struct cmpl_base *cp_desc_ring = cpr->cp_desc_ring;
- struct bnxt_ring *cp_ring_struct = cpr->cp_ring_struct;
- uint32_t ring_mask = cp_ring_struct->ring_mask;
- uint32_t opaque = 0;
if (bnxt_tx_bds_in_hw(txq) < txq->tx_free_thresh)
return 0;
+ cp_ring_struct = cpr->cp_ring_struct;
+ ring_mask = cp_ring_struct->ring_mask;
+
do {
cons = RING_CMPL(ring_mask, raw_cons);
txcmp = (struct tx_cmpl *)&cpr->cp_desc_ring[cons];
- rte_prefetch_non_temporal(&cp_desc_ring[(cons + 2) &
- ring_mask]);
- if (!CMPL_VALID(txcmp, cpr->valid))
+ if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
break;
- opaque = rte_cpu_to_le_32(txcmp->opaque);
- NEXT_CMPL(cpr, cons, cpr->valid, 1);
- rte_prefetch0(&cp_desc_ring[cons]);
+
+ opaque = rte_le_to_cpu_32(txcmp->opaque);
if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)
nb_tx_pkts += opaque;
@@ -475,9 +471,11 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
RTE_LOG_DP(ERR, PMD,
"Unhandled CMP type %02x\n",
CMP_TYPE(txcmp));
- raw_cons = cons;
+ raw_cons = NEXT_RAW_CMP(raw_cons);
} while (nb_tx_pkts < ring_mask);
+ cpr->valid = !!(raw_cons & cp_ring_struct->ring_size);
+
if (nb_tx_pkts) {
if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
bnxt_tx_cmp_fast(txq, nb_tx_pkts);
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 4/4] net/bnxt: remove dead code
2021-06-16 17:55 [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Lance Richardson
` (2 preceding siblings ...)
2021-06-16 17:55 ` [dpdk-dev] [PATCH 3/4] net/bnxt: fix scalar Tx completion handling Lance Richardson
@ 2021-06-16 17:55 ` Lance Richardson
2021-06-23 15:45 ` [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Ajit Khaparde
4 siblings, 0 replies; 6+ messages in thread
From: Lance Richardson @ 2021-06-16 17:55 UTC (permalink / raw)
To: Ajit Khaparde, Somnath Kotur, Jerin Jacob, Ruifeng Wang,
Bruce Richardson, Konstantin Ananyev
Cc: dev
[-- Attachment #1: Type: text/plain, Size: 6992 bytes --]
Code related to maintaining completion ring "valid" state is
no longer needed, remove it.
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_cpr.h | 17 -----------------
drivers/net/bnxt/bnxt_hwrm.c | 2 --
drivers/net/bnxt/bnxt_ring.c | 1 -
drivers/net/bnxt/bnxt_rxr.c | 11 -----------
drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 3 ---
drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 3 ---
drivers/net/bnxt/bnxt_txr.c | 2 --
7 files changed, 39 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h
index 28c0a9049..2a56ec52c 100644
--- a/drivers/net/bnxt/bnxt_cpr.h
+++ b/drivers/net/bnxt/bnxt_cpr.h
@@ -15,14 +15,6 @@ struct bnxt_db_info;
(!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) & \
CMPL_BASE_V) == !((raw_cons) & ((ring)->ring_size)))
-#define CMPL_VALID(cmp, v) \
- (!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) & \
- CMPL_BASE_V) == !(v))
-
-#define NQ_CMP_VALID(nqcmp, raw_cons, ring) \
- (!!((nqcmp)->v & rte_cpu_to_le_32(NQ_CN_V)) == \
- !((raw_cons) & ((ring)->ring_size)))
-
#define CMP_TYPE(cmp) \
(((struct cmpl_base *)cmp)->type & CMPL_BASE_TYPE_MASK)
@@ -35,18 +27,10 @@ struct bnxt_db_info;
#define RING_CMP(ring, idx) ((idx) & (ring)->ring_mask)
#define RING_CMPL(ring_mask, idx) ((idx) & (ring_mask))
#define NEXT_CMP(idx) RING_CMP(ADV_RAW_CMP(idx, 1))
-#define FLIP_VALID(cons, mask, val) ((cons) >= (mask) ? !(val) : (val))
#define DB_CP_REARM_FLAGS (DB_KEY_CP | DB_IDX_VALID)
#define DB_CP_FLAGS (DB_KEY_CP | DB_IDX_VALID | DB_IRQ_DIS)
-#define NEXT_CMPL(cpr, idx, v, inc) do { \
- (idx) += (inc); \
- if (unlikely((idx) >= (cpr)->cp_ring_struct->ring_size)) { \
- (v) = !(v); \
- (idx) = 0; \
- } \
-} while (0)
#define B_CP_DB_REARM(cpr, raw_cons) \
rte_write32((DB_CP_REARM_FLAGS | \
DB_RING_IDX(&((cpr)->cp_db), raw_cons)), \
@@ -107,7 +91,6 @@ struct bnxt_cp_ring_info {
uint32_t hw_stats_ctx_id;
struct bnxt_ring *cp_ring_struct;
- bool valid;
};
#define RX_CMP_L2_ERRORS \
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6eab2342f..9ec65ad22 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2670,7 +2670,6 @@ void bnxt_free_nq_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
memset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size *
sizeof(*cpr->cp_desc_ring));
cpr->cp_raw_cons = 0;
- cpr->valid = 0;
}
void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
@@ -2684,7 +2683,6 @@ void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
memset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size *
sizeof(*cpr->cp_desc_ring));
cpr->cp_raw_cons = 0;
- cpr->valid = 0;
}
void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 4a90ac264..cb18dfba7 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -769,7 +769,6 @@ int bnxt_alloc_async_cp_ring(struct bnxt *bp)
return rc;
cpr->cp_raw_cons = 0;
- cpr->valid = 0;
bnxt_set_db(bp, &cpr->cp_db, ring_type, 0,
cp_ring->fw_ring_id, cp_ring->ring_mask);
diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 756a45ba9..0dee73af8 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -297,9 +297,6 @@ static int bnxt_agg_bufs_valid(struct bnxt_cp_ring_info *cpr,
raw_cp_cons = ADV_RAW_CMP(raw_cp_cons, agg_bufs);
last_cp_cons = RING_CMP(cpr->cp_ring_struct, raw_cp_cons);
agg_cmpl = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[last_cp_cons];
- cpr->valid = FLIP_VALID(raw_cp_cons,
- cpr->cp_ring_struct->ring_mask,
- cpr->valid);
return CMP_VALID(agg_cmpl, raw_cp_cons, cpr->cp_ring_struct);
}
@@ -898,10 +895,6 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
if (!CMP_VALID(rxcmp1, tmp_raw_cons, cpr->cp_ring_struct))
return -EBUSY;
- cpr->valid = FLIP_VALID(cp_cons,
- cpr->cp_ring_struct->ring_mask,
- cpr->valid);
-
if (cmp_type == RX_TPA_START_CMPL_TYPE_RX_TPA_START ||
cmp_type == RX_TPA_START_V2_CMPL_TYPE_RX_TPA_START_V2) {
bnxt_tpa_start(rxq, (struct rx_tpa_start_cmpl *)rxcmp,
@@ -1086,10 +1079,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct))
break;
- cpr->valid = FLIP_VALID(cons,
- cpr->cp_ring_struct->ring_mask,
- cpr->valid);
-
if (CMP_TYPE(rxcmp) == CMPL_BASE_TYPE_HWRM_DONE) {
PMD_DRV_LOG(ERR, "Rx flush done\n");
} else if ((CMP_TYPE(rxcmp) >= CMPL_BASE_TYPE_RX_TPA_START_V2) &&
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
index b4e920256..263e6ec3c 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
@@ -296,8 +296,6 @@ recv_burst_vec_neon(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rxq->rxrearm_nb += nb_rx_pkts;
cpr->cp_raw_cons += 2 * nb_rx_pkts;
- cpr->valid =
- !!(cpr->cp_raw_cons & cpr->cp_ring_struct->ring_size);
bnxt_db_cq(cpr);
}
@@ -353,7 +351,6 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)
raw_cons = NEXT_RAW_CMP(raw_cons);
} while (nb_tx_pkts < ring_mask);
- cpr->valid = !!(raw_cons & cp_ring_struct->ring_size);
if (nb_tx_pkts) {
if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
bnxt_tx_cmp_vec_fast(txq, nb_tx_pkts);
diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
index c479697ac..9a53d1fba 100644
--- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
+++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c
@@ -277,8 +277,6 @@ recv_burst_vec_sse(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rxq->rxrearm_nb += nb_rx_pkts;
cpr->cp_raw_cons += 2 * nb_rx_pkts;
- cpr->valid =
- !!(cpr->cp_raw_cons & cpr->cp_ring_struct->ring_size);
bnxt_db_cq(cpr);
}
@@ -334,7 +332,6 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)
raw_cons = NEXT_RAW_CMP(raw_cons);
} while (nb_tx_pkts < ring_mask);
- cpr->valid = !!(raw_cons & cp_ring_struct->ring_size);
if (nb_tx_pkts) {
if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
bnxt_tx_cmp_vec_fast(txq, nb_tx_pkts);
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 54eaab34a..8eb949399 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -474,8 +474,6 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
raw_cons = NEXT_RAW_CMP(raw_cons);
} while (nb_tx_pkts < ring_mask);
- cpr->valid = !!(raw_cons & cp_ring_struct->ring_size);
-
if (nb_tx_pkts) {
if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
bnxt_tx_cmp_fast(txq, nb_tx_pkts);
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes
2021-06-16 17:55 [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Lance Richardson
` (3 preceding siblings ...)
2021-06-16 17:55 ` [dpdk-dev] [PATCH 4/4] net/bnxt: remove dead code Lance Richardson
@ 2021-06-23 15:45 ` Ajit Khaparde
4 siblings, 0 replies; 6+ messages in thread
From: Ajit Khaparde @ 2021-06-23 15:45 UTC (permalink / raw)
To: Lance Richardson; +Cc: dpdk-dev
[-- Attachment #1: Type: text/plain, Size: 1290 bytes --]
On Wed, Jun 16, 2021 at 11:09 AM Lance Richardson
<lance.richardson@broadcom.com> wrote:
>
> Several fixes for the bnxt PMD:
> - Fix NUMA-aware memory allocations.
> - Fix transmit descriptor status implementation.
> - Fix handling of transmit completions in non-vector path.
> - Remove dead code.
>
> Lance Richardson (4):
> net/bnxt: fix ring and context memory allocation
> net/bnxt: fix tx desc status implementation
> net/bnxt: fix scalar Tx completion handling
> net/bnxt: remove dead code
Patchset applied to dpdk-next-net-brcm for-next-net branch.
>
> drivers/net/bnxt/bnxt_cpr.h | 17 -------
> drivers/net/bnxt/bnxt_ethdev.c | 71 +++++++++++++++------------
> drivers/net/bnxt/bnxt_hwrm.c | 2 -
> drivers/net/bnxt/bnxt_ring.c | 31 ++++++------
> drivers/net/bnxt/bnxt_ring.h | 2 +-
> drivers/net/bnxt/bnxt_rxq.c | 4 +-
> drivers/net/bnxt/bnxt_rxr.c | 11 -----
> drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 3 --
> drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 3 --
> drivers/net/bnxt/bnxt_txq.c | 4 +-
> drivers/net/bnxt/bnxt_txr.c | 22 ++++-----
> drivers/net/bnxt/bnxt_vnic.c | 3 +-
> 12 files changed, 70 insertions(+), 103 deletions(-)
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-23 15:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 17:55 [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 1/4] net/bnxt: fix ring and context memory allocation Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 2/4] net/bnxt: fix tx desc status implementation Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 3/4] net/bnxt: fix scalar Tx completion handling Lance Richardson
2021-06-16 17:55 ` [dpdk-dev] [PATCH 4/4] net/bnxt: remove dead code Lance Richardson
2021-06-23 15:45 ` [dpdk-dev] [PATCH 0/4] net/bnxt: various fixes Ajit Khaparde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).