On Wed, Apr 16, 2014 at 7:45 PM, Pravin Shelar <pshe...@nicira.com> wrote: > On Thu, Apr 17, 2014 at 8:12 AM, Jesse Gross <je...@nicira.com> wrote: >> On Wed, Apr 16, 2014 at 7:39 PM, Pravin Shelar <pshe...@nicira.com> wrote: >>> On Wed, Apr 16, 2014 at 2:09 AM, Andy Zhou <az...@nicira.com> wrote: >>>> Thanks for the review. I will send V2. >>>> >>>> On Tue, Apr 15, 2014 at 7:14 AM, Pravin Shelar <pshe...@nicira.com> wrote: >>>>> On Sat, Apr 12, 2014 at 3:30 AM, Andy Zhou <az...@nicira.com> wrote: >>>>>> Implements Linux kernel datapath hash action. Hash action computes >>>>>> hash and stores it into current packet key. >>>>>> >>>>>> Signed-off-by: Andy Zhou <az...@nicira.com> >>>>>> >>>>>> [OVS_KEY_ATTR_ARP] = sizeof(struct ovs_key_arp), >>>>>> [OVS_KEY_ATTR_ND] = sizeof(struct ovs_key_nd), >>>>>> + [OVS_KEY_ATTR_DP_HASH] = sizeof(u32), >>>>>> [OVS_KEY_ATTR_TUNNEL] = -1, >>>>>> }; >>>>>> >>>>>> @@ -455,6 +461,19 @@ static int ipv4_tun_to_nlattr(struct sk_buff *skb, >>>>>> static int metadata_from_nlattrs(struct sw_flow_match *match, u64 >>>>>> *attrs, >>>>>> const struct nlattr **a, bool is_mask) >>>>>> { >>>>>> + >>>>>> + if (*attrs & (1ULL << OVS_KEY_ATTR_DP_HASH)) { >>>>>> + u32 hash_val = nla_get_u32(a[OVS_KEY_ATTR_DP_HASH]); >>>>>> + >>>>>> + if (!is_mask && !hash_val) { >>>>>> + OVS_NLERR("Hash value can not be zero\n"); >>>>>> + return -EINVAL; >>>>>> + } >>>>>> + >>>>>> + SW_FLOW_KEY_PUT(match, dp_hash, hash_val, is_mask); >>>>>> + *attrs &= ~(1ULL << OVS_KEY_ATTR_DP_HASH); >>>>>> + } >>>>> Is hash allowed to be partially masked? >>>> Yes. >>> >>> How can arbitrary hash value which is outside control of vswitchd can >>> be partially masked. I think we can either exact match it or >>> completely wildcard. Am I missing something? >> >> If you are trying to split between bond slaves then you probably want >> to mask off some number of bits based on the number of interfaces to >> randomly divide the traffic. > I see. > But then we should have some control over hash function? Or is it too > expensive ?
There's some control over the hash function by being able to change the basis. However, for the most part it's not really needed assuming that the hash is reasonably well distributed. There's nothing particularly special about the userspace hash functions that we currently use. We usually use 256 hash buckets currently, so you can just mask off all but 8 bits and then setup 256 flows to steer each bit combination to roughly balance the traffic. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev