[dpdk-dev] [RFC 4/4] net/ether: use bitops to speedup comparison

Bruce Richardson bruce.richardson at intel.com
Thu May 16 18:03:37 CEST 2019


On Wed, May 15, 2019 at 03:19:52PM -0700, Stephen Hemminger wrote:
> Using bit operations like or and xor is faster than a loop
> on all architectures. Really just explicit unrolling.
> 
> Similar cast to uint16 unaligned is already done in
> other functions here.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  lib/librte_net/rte_ether.h | 17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
Rather than casting to unaligned values, which gives compiler warnings in
some cases, I believe we should just mark the ethernet addresses as always
being 2-byte aligned and simplify things. [unless we have a good use case
where we won't have 2-byte alignment???].

See patch: http://patches.dpdk.org/patch/53482/

Regards,
/Bruce


More information about the dev mailing list