[ovs-dev] [PATCH] odp-util.c: Fix dp_hash execution with slowpath actions.

Ben Pfaff blp at ovn.org
Tue Jun 16 21:45:42 UTC 2020

On Thu, Jun 11, 2020 at 03:15:13PM +0200, Ilya Maximets wrote:
> I understand that this patch fixes this particular case, however I still
> think it's dangerous to pass the hash calculated in userspace to kernel
> since it might cause mismatch for the later packets in case where the
> flow doesn't have actions that requires sending to userspace.
> One more thing.  We have such a comment in odp-execute.c:
>         /* Calculate a hash value directly. This might not match the         
>          * value computed by the datapath, but it is much less expensive,    
>          * and the current use case (bonding) does not require a strict      
>          * match to work properly. */
> But we're using dp_hash not only for bonding for a long time now.
> And this doesn't look correct.  Even for bonding I'm not sure if that
> is a fully correct assumption.

It's been a problem a long time.  We were aware of the issue from the
day we introduced dp_hash, and we've come up with various workarounds
over the years.  It was never clear before that the problem caused by
not passing dp_hash around was such a big deal.

I think that a real solution would be to reconcile the hash functions.
I guess that this would have to amount to userspace adopting the kernel
hash function, at least for the cases where it matters, since we can't
expect the kernel to change.  I don't know how hard that would be (I do
know that userspace could check that it was correct by probing some
sample packets).

More information about the dev mailing list