All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Konstantin Ananyev" <konstantin.ananyev@huawei.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: "Vladimir Medvedkin" <vladimir.medvedkin@intel.com>
Subject: RE: [PATCH] app/test: use memcpy in ipsec test
Date: Fri, 29 May 2026 22:45:00 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F658B7@smartserver.smartshare.dk> (raw)
In-Reply-To: <cd2886ccd3134ab0a712e739bad4da5e@huawei.com>

> > This test has tables of data that get copied with rte_memcpy.
> > But when compiled without always inline the compiler gets confused
> > by the inlining of rte_memcpy and thinks that it is possible for AVX
> > code to reference past the input data.
> >
> > Workaround is to use memcpy() which is better for this test anyway
> > since regular memcpy has more static checking from compiler and
> > analyzers.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  app/test/test_ipsec.c | 13 ++++++-------
> >  1 file changed, 6 insertions(+), 7 deletions(-)
> >
> > diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c
> > index 139c1e8dec..b5a430996d 100644
> > --- a/app/test/test_ipsec.c
> > +++ b/app/test/test_ipsec.c
> > @@ -10,7 +10,6 @@
> >  #include <rte_hexdump.h>
> >  #include <rte_mbuf.h>
> >  #include <rte_malloc.h>
> > -#include <rte_memcpy.h>
> >  #include <rte_cycles.h>
> >  #include <rte_bus_vdev.h>
> >  #include <rte_ip.h>
> > @@ -559,7 +558,7 @@ setup_test_string(struct rte_mempool *mpool,
> const
> > char *string,
> >  			return NULL;
> >  		}
> >  		if (string != NULL)
> > -			rte_memcpy(dst, string, t_len);
> > +			memcpy(dst, string, t_len);
> >  		else
> >  			memset(dst, 0, t_len);
> >  	}
> > @@ -604,22 +603,22 @@ setup_test_string_tunneled(struct rte_mempool
> > *mpool, const char *string,
> >  	/* copy outer IP and ESP header */
> >  	ipv4_outer.total_length = rte_cpu_to_be_16(t_len);
> >  	ipv4_outer.packet_id = rte_cpu_to_be_16(seq);
> > -	rte_memcpy(dst, &ipv4_outer, sizeof(ipv4_outer));
> > +	memcpy(dst, &ipv4_outer, sizeof(ipv4_outer));

How about:
*dst = ipv4_outer;

Don't know if it applies here.

> >  	dst += sizeof(ipv4_outer);
> >  	m->l3_len = sizeof(ipv4_outer);
> > -	rte_memcpy(dst, &esph, sizeof(esph));
> > +	memcpy(dst, &esph, sizeof(esph));
> >  	dst += sizeof(esph);
> >
> >  	if (string != NULL) {
> >  		/* copy payload */
> > -		rte_memcpy(dst, string, len);
> > +		memcpy(dst, string, len);
> >  		dst += len;
> >  		/* copy pad bytes */
> > -		rte_memcpy(dst, esp_pad_bytes, RTE_MIN(padlen,
> > +		memcpy(dst, esp_pad_bytes, RTE_MIN(padlen,
> >  			sizeof(esp_pad_bytes)));
> >  		dst += padlen;
> >  		/* copy ESP tail header */
> > -		rte_memcpy(dst, &espt, sizeof(espt));
> > +		memcpy(dst, &espt, sizeof(espt));

Also here:
*dst = espt;

Also don't know if it applies here.

> >  	} else
> >  		memset(dst, 0, t_len);
> >
> > --
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> 
> > 2.53.0

With or without suggested changes:
Acked-by: Morten Brørup <mb@smartsharesystems.com>

If you are curious too...
Does the compiler still get confused about AVX rte_memcpy (without this patch), if applying the rte_memcpy patch?
https://patchwork.dpdk.org/project/dpdk/patch/20260521185631.116046-1-mb@smartsharesystems.com/


  reply	other threads:[~2026-05-29 20:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 15:46 [PATCH] app/test: use memcpy in ipsec test Stephen Hemminger
2026-05-29 16:42 ` Konstantin Ananyev
2026-05-29 20:45   ` Morten Brørup [this message]
2026-05-29 22:52     ` Stephen Hemminger
2026-05-30  5:31       ` Morten Brørup
2026-05-29 22:58     ` Stephen Hemminger
2026-05-30  5:36       ` Morten Brørup
2026-06-02 19:36 ` [EXTERNAL] " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35F658B7@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=stephen@networkplumber.org \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.