[ovs-dev] Q on FLOW_SIG_SIZE and hashing

Ravi.Kerur at telekom.com Ravi.Kerur at telekom.com
Tue Feb 21 17:21:02 UTC 2012


Hi,

I am facing some issues w.r.t hashing when FLOW_SIG_SIZE > 130. What I did was to move around members of struct flow such that FLOW_SIG_SIZE = (112 + FLOW_N_REGS * 4). Note that struct flow is not packed so depending on where members are added, due to padding size can increase. The easier way to achieve this is to add two bytes to struct flow, pack it and change related code in line number 98, 99 and 100 in lib/flow.h and then compile and load ovs-switch. What happens with the changes is that none of the flows extracted from the packet match the rules and all packets are dropped.

Why am I doing this? I have added 4 bytes for mpls to update mpls label and traffic class extracted from the packet into struct flow. After I added it and changed other related code as mentioned earlier, behavior of flow matching is pretty unpredictable based on where the new variable is placed in the structure. I looked closely hash_bytes function but didn't find anything suspicious. I have tested it on x86 and x86_64 and it's the same behavior.

Since the reserved field is used to get full struct flow size to be 64 bits aligned, I believe it can be changed based on FLOW_SIG_SIZE and it doesn't have any other inherent meaning and since it is not used for calculating hash I believe changing reserved size should be ok. Secondly, any other changes I need to do or areas of code to look at to fix this problem?

Thanks
Ravi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20120221/05104f3b/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_mpls_diffs
Type: application/octet-stream
Size: 1592 bytes
Desc: test_mpls_diffs
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20120221/05104f3b/attachment-0004.obj>


More information about the dev mailing list