net/bnxt: refactor mbuf pointer reset

Remove code for setting consumed mbuf pointers to NULL from the
vector receive functions as a minor performance optimization.

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>
This commit is contained in:
Lance Richardson 2021-03-02 10:16:08 -05:00 committed by Ajit Khaparde
parent 25fefa2b17
commit 0f4d2afb09
3 changed files with 12 additions and 32 deletions

View File

@ -213,6 +213,16 @@ void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
sw_ring = rxq->rx_ring->rx_buf_ring;
if (sw_ring) {
#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
/*
* The vector receive burst function does not set used
* mbuf pointers to NULL, do that here to simplify
* cleanup logic.
*/
for (i = 0; i < rxq->rxrearm_nb; i++)
sw_ring[rxq->rxrearm_start + i] = NULL;
rxq->rxrearm_nb = 0;
#endif
for (i = 0;
i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
if (sw_ring[i]) {

View File

@ -274,22 +274,8 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
num_valid = (sizeof(uint64_t) / sizeof(uint16_t)) -
(__builtin_clzl(valid & desc_valid_mask) / 16);
switch (num_valid) {
case 4:
rxr->rx_buf_ring[mbcons + 3] = NULL;
/* FALLTHROUGH */
case 3:
rxr->rx_buf_ring[mbcons + 2] = NULL;
/* FALLTHROUGH */
case 2:
rxr->rx_buf_ring[mbcons + 1] = NULL;
/* FALLTHROUGH */
case 1:
rxr->rx_buf_ring[mbcons + 0] = NULL;
if (num_valid == 0)
break;
case 0:
goto out;
}
descs_to_mbufs(rxcmp, rxcmp1, mb_init, &rx_pkts[nb_rx_pkts],
rxr);
@ -299,7 +285,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
break;
}
out:
if (nb_rx_pkts) {
rxr->rx_raw_prod = RING_ADV(rxr->rx_raw_prod, nb_rx_pkts);

View File

@ -256,22 +256,8 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
valid = _mm_cvtsi128_si64(_mm_packs_epi32(info3_v, info3_v));
num_valid = __builtin_popcountll(valid & desc_valid_mask);
switch (num_valid) {
case 4:
rxr->rx_buf_ring[mbcons + 3] = NULL;
/* FALLTHROUGH */
case 3:
rxr->rx_buf_ring[mbcons + 2] = NULL;
/* FALLTHROUGH */
case 2:
rxr->rx_buf_ring[mbcons + 1] = NULL;
/* FALLTHROUGH */
case 1:
rxr->rx_buf_ring[mbcons + 0] = NULL;
if (num_valid == 0)
break;
case 0:
goto out;
}
descs_to_mbufs(rxcmp, rxcmp1, mbuf_init, &rx_pkts[nb_rx_pkts],
rxr);
@ -281,7 +267,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
break;
}
out:
if (nb_rx_pkts) {
rxr->rx_raw_prod = RING_ADV(rxr->rx_raw_prod, nb_rx_pkts);