Skip to content

Commit

Permalink
net/memif: fix extra mbuf refcnt update in zero copy Tx
Browse files Browse the repository at this point in the history
[ upstream commit aa3e97fcb55d7b68fef864aa76078bdae375ad3d ]

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: 43b815d ("net/memif: support zero-copy slave")

Signed-off-by: Liangxing Wang <liangxing.wang@arm.com>
Signed-off-by: Wathsala Vithanage <wathsala.vithanage@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
  • Loading branch information
Wathsala Vithanage authored and bluca committed Mar 7, 2024
1 parent f90918d commit 8603dea
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,7 @@ Walter Heymans <walter.heymans@corigine.com>
Wang Sheng-Hui <shhuiw@gmail.com>
Wangyu (Eric) <seven.wangyu@huawei.com>
Waterman Cao <waterman.cao@intel.com>
Wathsala Vithanage <wathsala.vithanage@arm.com>
Weichun Chen <weichunx.chen@intel.com>
Wei Dai <wei.dai@intel.com>
Weifeng Li <liweifeng96@126.com>
Expand Down
6 changes: 0 additions & 6 deletions drivers/net/memif/rte_eth_memif.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,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++;
}
Expand Down Expand Up @@ -707,10 +705,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);
Expand Down

0 comments on commit 8603dea

Please sign in to comment.