net/memif: improve memcpy performance
authorDavid Christensen <drc@linux.vnet.ibm.com>
Wed, 23 Jun 2021 20:31:54 +0000 (13:31 -0700)
committerAndrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru>
Fri, 2 Jul 2021 17:03:03 +0000 (19:03 +0200)
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@linux.vnet.ibm.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
drivers/net/memif/rte_eth_memif.c

index da71957..de6becd 100644 (file)
@@ -383,9 +383,10 @@ next_slot:
                        if (mbuf != mbuf_head)
                                rte_pktmbuf_pkt_len(mbuf_head) += cp_len;
 
-                       memcpy(rte_pktmbuf_mtod_offset(mbuf, void *, dst_off),
-                              (uint8_t *)memif_get_buffer(proc_private, d0) + src_off,
-                              cp_len);
+                       rte_memcpy(rte_pktmbuf_mtod_offset(mbuf, void *,
+                                                          dst_off),
+                               (uint8_t *)memif_get_buffer(proc_private, d0) +
+                               src_off, cp_len);
 
                        src_off += cp_len;
                        dst_off += cp_len;
@@ -644,9 +645,10 @@ next_in_chain:
                        }
                        cp_len = RTE_MIN(dst_len, src_len);
 
-                       memcpy((uint8_t *)memif_get_buffer(proc_private, d0) + dst_off,
-                              rte_pktmbuf_mtod_offset(mbuf, void *, src_off),
-                              cp_len);
+                       rte_memcpy((uint8_t *)memif_get_buffer(proc_private,
+                                                              d0) + dst_off,
+                               rte_pktmbuf_mtod_offset(mbuf, void *, src_off),
+                               cp_len);
 
                        mq->n_bytes += cp_len;
                        src_off += cp_len;