[ovs-discuss] Questions about the OVS group table

Ben Pfaff blp at ovn.org
Sat Jul 11 01:45:20 UTC 2020


Please don't drop the list.

No, that's not it.  All the logic for hashing groups is in
ofproto/ofproto-dpif-xlate.c.  Look around in there.

On Sat, Jul 11, 2020 at 09:43:31AM +0800, C C wrote:
> Thank you, but I would like to know more about the hashing process. Can you
> tell me how the hashing process is implemented in the code? I found this
> function in OVS code, and this is the hash function of group?
> static struct hlist_head *vport_hash_bucket(const struct datapath *dp,
>                         u16 port_no)
> {
>     return &dp->ports[port_no & (DP_VPORT_HASH_BUCKETS - 1)];
> }
> 
> Ben Pfaff <blp at ovn.org> 于2020年7月11日周六 上午12:21写道:
> 
> > On Fri, Jul 10, 2020 at 03:10:04PM +0800, C C wrote:
> > > Hello! I'm a student at USTC. I've been working on projects with OVS
> > > recently. I want to know what hash function is used by default for group
> > > select. For example, "ovs-ofctl -O OpenFlow15 add-group br0 group_id=1,
> > > type=select, selection_method=hash, fields=ip_src
> > bucket=actions=output:1".
> > > Where is this hash function in the OVS src-code? I hope you can solve my
> > > problem. Thank you!
> >
> > The FAQ says:
> >
> > Q: How does OVS divide flows among buckets in an OpenFlow "select" group?
> >
> >     A: In Open vSwitch 2.3 and earlier, Open vSwitch used the destination
> >     Ethernet address to choose a bucket in a select group.
> >
> >     Open vSwitch 2.4 and later by default hashes the source and destination
> >     Ethernet address, VLAN ID, Ethernet type, IPv4/v6 source and
> > destination
> >     address and protocol, and for TCP and SCTP only, the source and
> > destination
> >     ports.  The hash is "symmetric", meaning that exchanging source and
> >     destination addresses does not change the bucket selection.
> >
> >     Select groups in Open vSwitch 2.4 and later can be configured to use a
> >     different hash function, using a Netronome extension to the OpenFlow
> > 1.5+
> >     group_mod message.  For more information, see
> >     Documentation/group-selection-method-property.txt in the Open vSwitch
> >     source tree.
> >


More information about the discuss mailing list