[ovs-dev] [PATCH] flow: Extend 5-tuple hash calculation for non-IP packets

Gabor Halász gabor.halasz at ericsson.com
Fri Apr 13 11:43:24 UTC 2018


Hi Ben,
Indeed there was some problem with that line.
Instead of using the eth_addr_to_uint64() func, I have added OVS_FORCE compiler flag to keep the logic more visible.
+        hash = hash_add64(hash, *((OVS_FORCE uint64_t *) &flow->dl_dst));
+        hash = hash_add(hash, (OVS_FORCE uint32_t)
+                        *((uint8_t *) &flow->dl_dst) + sizeof(uint64_t));

Thanks,
Gabor


> I haven't properly reviewed this, but Clang reports:
> 
> ../lib/flow.c:2133:35: error: cast from 'const struct eth_addr *' to
> 'uint64_t *' (aka 'unsigned long long *') increases required alignment
> from 2 to 4 [-Werror,-Wcast-align]
> 
> which is for this line:
> 
>         hash = hash_add64(hash, *((uint64_t *) &flow->dl_dst));
> 
> Maybe you should use eth_addr_to_uint64().


More information about the dev mailing list