On Tue, Jun 11, 2019 at 10:29:56AM +0300, Nikolay Aleksandrov wrote: > > Have you considered using the flow dissector and doing something similar to > the bonding ? > It does a full flow dissect via skb_flow_dissect_flow_keys() and uses > whatever headers > it needs, but that will support any tunneling protocol which the flow > dissector > recognizes and will be improved upon automatically by people adding to it. > Also would avoid doing dissection by yourself. > > The bond commit which added that was: > 32819dc18348 ("bonding: modify the old and add new xmit hash policies") >
I didn't consider it and should. Thanks for pointing me to that direction. It's simpler. > > /* if skb is set it will be used and fl4 can be NULL */ > > int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4, > > const struct sk_buff *skb, struct flow_keys *flkeys) > > @@ -1828,12 +1876,13 @@ int fib_multipath_hash(const struct net *net, const > > struct flowi4 *fl4, > > struct flow_keys hash_keys; > > u32 mhash; > > > > + memset(&hash_keys, 0, sizeof(hash_keys)); > > + > > This was an optimization, it was done on purpose to avoid doing anything when > we > have L3+4 configured (1) and the skb has its hash already calculated. > Will revert to the original lines. Thanks.