RE: [PATCH 03/61] test: use memcpy instead of rte_memcpy
Morten Brørup <[email protected]>
| Newsgroups | org.dpdk.dev |
|---|---|
| Message-ID | <[email protected]> |
> From: Stephen Hemminger [mailto:[email protected]] > Sent: Thursday, 20 August 2026 18.23 > > 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. OK. I agree with that. Then the patch description needs an update; it only mentions fixed-size copies. Also the cover letter should mention that tests replace all uses of rte_memcpy(), not just fixed-size copies. Acked-by: Morten Brørup <[email protected]>