net/memif: replace memcpy() with rte_memcpy() to improve perf

Message ID 20210623203154.72409-1-drc@linux.vnet.ibm.com (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers
Series net/memif: replace memcpy() with rte_memcpy() to improve perf |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot success github build: passed
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing fail Testing issues
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

David Christensen June 23, 2021, 8:31 p.m. UTC
  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>
---
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(-)

--
2.27.0
  

Comments

Tyler Retzlaff June 24, 2021, 4:15 p.m. UTC | #1
On Wed, Jun 23, 2021 at 01:31:54PM -0700, David Christensen wrote:
> 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>
  
Andrew Rybchenko July 1, 2021, 4:19 p.m. UTC | #2
On 6/24/21 7:15 PM, Tyler Retzlaff wrote:
> On Wed, Jun 23, 2021 at 01:31:54PM -0700, David Christensen wrote:
>> 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>
> 

Fixed long lines and changed summary to:

net/memif: use rte_memcpy() to improve performance

Applied, thanks.
  

Patch

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);