[ovs-dev] [recirculation 2/3] datapath: add hash action

Andy Zhou azhou at nicira.com
Thu Apr 17 04:23:52 UTC 2014


What's the advantage of exactly matching dp_hash?  May be we could
make it a maskable action.

On Wed, Apr 16, 2014 at 7:45 PM, Pravin Shelar <pshelar at nicira.com> wrote:
> On Thu, Apr 17, 2014 at 8:12 AM, Jesse Gross <jesse at nicira.com> wrote:
>> On Wed, Apr 16, 2014 at 7:39 PM, Pravin Shelar <pshelar at nicira.com> wrote:
>>> On Wed, Apr 16, 2014 at 2:09 AM, Andy Zhou <azhou at nicira.com> wrote:
>>>> Thanks for the review. I will send V2.
>>>>
>>>> On Tue, Apr 15, 2014 at 7:14 AM, Pravin Shelar <pshelar at nicira.com> wrote:
>>>>> On Sat, Apr 12, 2014 at 3:30 AM, Andy Zhou <azhou at 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 <azhou at 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 ?



More information about the dev mailing list