On Thu,  3 Dec 2015 14:06:09 +0800
Yuanhan Liu <yuanhan.liu at linux.intel.com> wrote:

> +#define COPY(dst, src) do {                                          \
> +     cpy_len = RTE_MIN(desc_avail, mbuf_avail);                      \
> +     rte_memcpy((void *)(uintptr_t)(dst),                            \
> +                (const void *)(uintptr_t)(src), cpy_len);            \
> +                                                                     \
> +     mbuf_avail  -= cpy_len;                                         \
> +     mbuf_offset += cpy_len;                                         \
> +     desc_avail  -= cpy_len;                                         \
> +     desc_offset += cpy_len;                                         \
> +} while(0)
> +

I see lots of issues here.

All those void * casts are unnecessary, C casts arguements already.
rte_memcpy is slower for constant size values than memcpy()

This macro violates the rule that ther should be no hidden variables
in a macro. I.e you are assuming cpy_len, desc_avail, and mbuf_avail
are defined in all code using the macro.

Why use an un-typed macro when an inline function would be just
as fast and give type safety?

Reply via email to