From: Lance Richardson Date: Tue, 2 Mar 2021 15:16:08 +0000 (-0500) Subject: net/bnxt: refactor mbuf pointer reset X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0f4d2afb09d1a4605ae8b636f3e11edccf3c9f07;p=dpdk.git 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 Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index 53a9b52a46..2b0d3d4ac7 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -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]) { diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c index b0981da0f4..3d54d9d59d 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c @@ -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); diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c index 7ae6f5c098..7a58434ce9 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c @@ -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);