[dpdk-dev] [PATCH] net/memif: replace memcpy() with rte_memcpy() to improve perf

David Christensen drc at linux.vnet.ibm.com
Wed Jun 23 22:31:54 CEST 2021


Replacing memcpy() with rte_memcpy() improved 64 byte packet
performance by 33% on a POWER9 system and by 10% on an x86_64
system.

Signed-off-by: David Christensen <drc at linux.vnet.ibm.com>
---
v2: Fixed last patch which was bungled due to a bad local git squash

 drivers/net/memif/rte_eth_memif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index da7195783f..d17222c612 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -383,7 +383,7 @@ eth_memif_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			if (mbuf != mbuf_head)
 				rte_pktmbuf_pkt_len(mbuf_head) += cp_len;

-			memcpy(rte_pktmbuf_mtod_offset(mbuf, void *, dst_off),
+			rte_memcpy(rte_pktmbuf_mtod_offset(mbuf, void *, dst_off),
 			       (uint8_t *)memif_get_buffer(proc_private, d0) + src_off,
 			       cp_len);

@@ -644,7 +644,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			}
 			cp_len = RTE_MIN(dst_len, src_len);

-			memcpy((uint8_t *)memif_get_buffer(proc_private, d0) + dst_off,
+			rte_memcpy((uint8_t *)memif_get_buffer(proc_private, d0) + dst_off,
 			       rte_pktmbuf_mtod_offset(mbuf, void *, src_off),
 			       cp_len);

--
2.27.0



More information about the dev mailing list