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

Stephen Hemminger stephen at networkplumber.org
Wed Jun 23 19:03:47 CEST 2021


On Wed, 23 Jun 2021 09:49:35 -0700
David Christensen <drc at linux.vnet.ibm.com> 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.

I see rte_memcpy was already used in the patch diff

> Signed-off-by: David Christensen <drc at linux.vnet.ibm.com>
> ---
>  drivers/net/memif/rte_eth_memif.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
> index d17222c612..330c9c2fd6 100644
> --- a/drivers/net/memif/rte_eth_memif.c
> +++ b/drivers/net/memif/rte_eth_memif.c
> @@ -384,8 +384,8 @@ eth_memif_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
>  				rte_pktmbuf_pkt_len(mbuf_head) += cp_len;
>  
>  			rte_memcpy(rte_pktmbuf_mtod_offset(mbuf, void *, dst_off),
> -			       (uint8_t *)memif_get_buffer(proc_private, d0) + src_off,
> -			       cp_len);
> +			       (uint8_t *)memif_get_buffer(proc_private, d0)
> +			       + src_off, cp_len);

This just changes line break for no good reason.
>  
>  			src_off += cp_len;
>  			dst_off += cp_len;
> @@ -644,7 +644,8 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
>  			}
>  			cp_len = RTE_MIN(dst_len, src_len);
>  
> -			rte_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);
>  

ditto.

Look like this patch is confused, the description does not match the code.


More information about the dev mailing list