The refcnt update of stored mbufs in memif driver is redundant since
those mbufs are only freed in eth_memif_tx_zc(). No other place can
free those stored mbufs quietly. By removing this redundant update
single core dpdk memif performance can be improved by 7.5%.

testpmd stats on Arm Neoverse N1 (Ampere Altra)
+-----------------------------+-----------------------+
|        | With refcnt update | Without refcnt update |
+--------+--------------------+-----------------------+
| Rx-pps |      2748851       |         2955487       |
+--------+--------------------+-----------------------+
| Tx-pps |      2748812       |         2955436       |
+--------+--------------------+-----------------------+

Fixes: 43b815d88188 ("net/memif: support zero-copy slave")
Cc: [email protected]

Signed-off-by: Liangxing Wang <[email protected]>
Signed-off-by: Wathsala Vithanage <[email protected]>
Reviewed-by: Ruifeng Wang <[email protected]>
---
 .mailmap                          | 2 ++
 drivers/net/memif/rte_eth_memif.c | 6 ------
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/.mailmap b/.mailmap
index de339562f4..00a642fcc3 100644
--- a/.mailmap
+++ b/.mailmap
@@ -791,6 +791,7 @@ Liang Ma <[email protected]> <[email protected]> 
<[email protected]>
 Liang-Min Larry Wang <[email protected]>
 Liang Xu <[email protected]>
 Liang Zhang <[email protected]>
+Liangxing Wang <[email protected]>
 Li Feng <[email protected]>
 Li Han <[email protected]>
 Lihong Ma <[email protected]>
@@ -1506,6 +1507,7 @@ Vlad Zolotarov <[email protected]>
 Vlastimil Kosar <[email protected]>
 Volodymyr Fialko <[email protected]>
 Vu Pham <[email protected]>
+Wathsala Vithanage <[email protected]>
 Wajeeh Atrash <[email protected]>
 Walter Heymans <[email protected]>
 Wang Sheng-Hui <[email protected]>
diff --git a/drivers/net/memif/rte_eth_memif.c 
b/drivers/net/memif/rte_eth_memif.c
index 7cc8c0da91..962d390b90 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -265,8 +265,6 @@ memif_free_stored_mbufs(struct pmd_process_private 
*proc_private, struct memif_q
        cur_tail = __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE);
        while (mq->last_tail != cur_tail) {
                RTE_MBUF_PREFETCH_TO_FREE(mq->buffers[(mq->last_tail + 1) & 
mask]);
-               /* Decrement refcnt and free mbuf. (current segment) */
-               rte_mbuf_refcnt_update(mq->buffers[mq->last_tail & mask], -1);
                rte_pktmbuf_free_seg(mq->buffers[mq->last_tail & mask]);
                mq->last_tail++;
        }
@@ -825,10 +823,6 @@ memif_tx_one_zc(struct pmd_process_private *proc_private, 
struct memif_queue *mq
 next_in_chain:
        /* store pointer to mbuf to free it later */
        mq->buffers[slot & mask] = mbuf;
-       /* Increment refcnt to make sure the buffer is not freed before server
-        * receives it. (current segment)
-        */
-       rte_mbuf_refcnt_update(mbuf, 1);
        /* populate descriptor */
        d0 = &ring->desc[slot & mask];
        d0->length = rte_pktmbuf_data_len(mbuf);
-- 
2.25.1

Reply via email to