[ovs-dev] [PATCH v10 4/5] dpif-netdev: refactor generic implementation

Van Haaren, Harry harry.van.haaren at intel.com
Fri Jul 12 14:48:48 UTC 2019


> -----Original Message-----
> From: Ilya Maximets [mailto:i.maximets at samsung.com]
> Sent: Friday, July 12, 2019 3:43 PM
> To: Stokes, Ian <ian.stokes at intel.com>; Van Haaren, Harry
> <harry.van.haaren at intel.com>; dev at openvswitch.org
> Cc: malvika.gupta at arm.com
> Subject: Re: [PATCH v10 4/5] dpif-netdev: refactor generic implementation

<snip>

> >> +
> >> +    /* Hash the now linearized blocks of packet metadata */
> >> +    ULLONG_FOR_EACH_1(i, keys_map) {
> >> +         uint32_t hash = 0;
> >> +         uint32_t i_off = i * bit_count_total;
> >> +         for (int h = 0; h < bit_count_total; h++) {
> >> +             hash = hash_add64(hash, blocks_scratch[i_off + h]);
> >> +         }
> >> +         hashes[i] = hash_finish(hash, bit_count_total * 8);
> >
> > Can we replace magic 8 above.
> 
> Another question.
> Can we use:
> 
>     ULLONG_FOR_EACH_1 (i, keys_map) {
>          hashes[i] = hash_words64_inline(&blocks_scratch[i * bit_count_total],
>                                          bit_count_total, 0);
>     }
> ?
> There should be same effect.

Yep we can.

I did investigate hash_bytes() but this becomes a function call (unless inlined by LTO)
and the code the is less performant than the above loop due to handling non 8 byte blocks.

But I missed  hash_words64_inline()  - learning every day :)

Cheers



More information about the dev mailing list