[ovs-dev] [PATCH] flow: Extend 5-tuple hash calculation for non-IP packets
blp at ovn.org
Fri Apr 13 16:38:53 UTC 2018
OVS_FORCE does not affect Clang, only sparse.
On Fri, Apr 13, 2018 at 11:43:24AM +0000, Gabor Halász wrote:
> 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));
> > 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