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.