[ovs-discuss] Isn't there any way to use RSS hash instead of jhash in flow_hash()

Greg Rose gvrose8192 at gmail.com
Wed May 24 22:14:10 UTC 2017


On Wed, 2017-05-24 at 16:01 +0900, Heung Sik Choi wrote:
> Thank you for replying
> 
> 
> Are you saying that you want to add RSS to the datapath to
> move packets to different queues? Which queues? Or do you just want to
> create a Toeplitz hashing algorithm function that will return a hash
> value and it doesn't really have anything to do with RSS?
> 
> 
> Sorry to confuse you. specifically, I think a design where skb
> structure has 'rss hash value' and ovs' datapath use this value when
> it lookup flow table. the rss hash value can get in NIC driver(ex.
> ixgbe), and can be inserted in skb structure. Also If I replace the
> jhash2 in flow_hash() with Toeplitz hash, the 'rss hash' can be used
> to hash in ovs. How do you think about it? please let me know if you
> have any insights.

So let me make sure I have this right.  You want to use the RSS hash
value from NIC HW for the flow table lookup?

If so this seems very HW specific to me.  And not all HW has RSS and if
it does then not all HW exposes the resulting RSS hash value in their
receive packet descriptor indication. Instead the packet is just routed
to the indicated RX queue.  I suppose some method of determining whether
the underlying HW has the RSS feature and exposes the RSS hash value is
possible.  And then adds some features for using that RSS hash in the
SKB for flow lookups instead of using the kernel jhash2 value, and thus
saving the computational overhead, is possible.  However, it seems
pretty complex and dependent on HW quirks.  I'd need to see some code.
If you have some RFC patches we could look at then please feel free to
post for comment and review.

> 
> 
> > I insert only one rule 'ovs-ofctl add-flow ovs-br1
> > nw_dst=100.1.1.1,actions=mod_dl_dst:90:e2:ba:5b:88:2c,in_port'.
> > Strangely, mac_src, mac_dst, ip_src, ip_dst, and port value in
> struct
> > sw_flow_key is changed after calling  ovs_flow_mask_key() in
> > masked_flow_lookup(). I can not understand why mask processing turn
> on
> > and why mask processing change almost all values in sw_flow_key.
> 
> 
> 
> I insert printk for log in masked_flow_lookup() function which is in
> openvswitch-2.4.0/datapath/flow_table.c.  here is my code.
> 
> 
>         // printk for log 
>         printk(KERN_ALERT "flow_table.c: masked_flow_lookup call :
> mac_src: %d ip_src: %d\n", unmasked->eth.src,
> unmasked->ipv4.addr.src);
> 
> 
> 
> 
>         ovs_flow_mask_key(&masked_key, unmasked, mask);
> 
> 
>         // printk for log 
>         printk(KERN_ALERT "flow_table.c: masked_flow_lookup
> call2(masked_key) : mac_src: %d ip_src: %d\n", masked_key.eth.src,
> masked_key.ipv4.addr.src);
> 
> 
> 
> 
> And then, result is here.
> 
> 
> [  526.101151] flow_table.c: masked_flow_lookup call : mac_src:
> 1740651620 ip_src: 16843018
> [  526.101158] flow_table.c: masked_flow_lookup call2(masked_key) :
> mac_src: 1740650956 ip_src: 0
> 

It looks to me like it copies source to destination while applying a
mask.

        for (i = 0; i < len; i += sizeof(long))
                *d++ = *s++ & *m++;

So it seems to be working as designed.

Thanks,

- Greg

> 
> ovs is sent packet from dpdk-pktgen. I cannot understand why mask
> processing change almost all values in sw_flow_key.
> 
> 
> please let me know if you have any insights.
> 
> 
> 2017-05-24 1:50 GMT+09:00 Greg Rose <gvrose8192 at gmail.com>:
>         On Tue, 2017-05-23 at 16:42 +0900, Heung Sik Choi wrote:
>         > Hi,
>         >
>         >
>         > In many articles about ovs, there are some mention that
>         hashing
>         > function cause quite significant overhead. Also, I did 'perf
>         record'
>         > performing OVS L3 forwarding, and found that.
>         >
>         >
>         > So, an idea comes up, which is that implement RSS hash
>         > algorithm(Toeplitz hash algorithm) in kernel datapath
>         module.
>         
>         I'm somewhat confused by this comment.  RSS will use a
>         Toeplitz hash
>         algorithm to create a hash value that will then be used by the
>         NIC to
>         select one of multiple HW receive queues.  It's more than just
>         a hash
>         algorithm.  Are you saying that you want to add RSS to the
>         datapath to
>         move packets to different queues? Which queues? Or do you just
>         want to
>         create a Toeplitz hashing algorithm function that will return
>         a hash
>         value and it doesn't really have anything to do with RSS?
>         
>         > However, I stucked in processing mask the 'struct
>         sw_flow_key'.
>         >
>         >
>         > I insert only one rule 'ovs-ofctl add-flow ovs-br1
>         >
>         nw_dst=100.1.1.1,actions=mod_dl_dst:90:e2:ba:5b:88:2c,in_port'.
>         > Strangely, mac_src, mac_dst, ip_src, ip_dst, and port value
>         in  struct
>         > sw_flow_key is changed after calling  ovs_flow_mask_key() in
>         > masked_flow_lookup(). I can not understand why mask
>         processing turn on
>         > and why mask processing change almost all values in
>         sw_flow_key.
>         
>         I have no idea about that.  I'll see if I can find time to
>         repro on my
>         own testing environment.
>         
>         - Greg
>         
>         >
>         >
>         >  Please let me know if you have any insights.
>         > _______________________________________________
>         > discuss mailing list
>         > discuss at openvswitch.org
>         > https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>         
>         
>         
>         _______________________________________________
>         discuss mailing list
>         discuss at openvswitch.org
>         https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
> 
> 





More information about the discuss mailing list