Re: [PATCH 03/61] test: use memcpy instead of rte_memcpy

Stephen Hemminger <[email protected]>
Newsgroups org.dpdk.dev
Message-ID <[email protected]>
On Thu, 20 Aug 2026 08:22:09 +0200
Morten Brørup <[email protected]> wrote:

> > 
> >  static inline void
> >  copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt,
> > unsigned offset)
> >  {
> >  	if (offset + len <= pkt->data_len) {
> > -		rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset),
> > buf,
> > +		memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf,
> >  			   (size_t) len);  
> 
> It looks like size is not constant in the above instances.
> 
> Try writing an intermediate wrapper using __rte_constant() to verify at build time.
> Something like (assuming the return value is unused):
> 
> #define rte_memcpy_const_size(dst, src, n) \
> do { \
> 	RTE_BUILD_BUG_ON(!__rte_constant(n)); \
> 	memcpy(dst, src, n); \
> } while (0)

The goal of this series is to hit as many places where rte_memcpy
is unnecessary. For tests, this includes all tests except those tests
specifically targeting testing rte_memcpy.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.