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

Stephen Hemminger stephen at networkplumber.org
Thu May 16 18:06:52 CEST 2019


On Thu, 16 May 2019 17:03:37 +0100
Bruce Richardson <bruce.richardson at intel.com> wrote:

> 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

I agree. Then you could also remove the unaligned_uint16_t that
already exists in rte_ether.h

Do you want me to put your patch in my series?


More information about the dev mailing list