[ovs-dev] [PATCH] streamline tunnel port lookup

Jesse Gross jesse at nicira.com
Fri Sep 30 02:35:55 UTC 2011


On Thu, Sep 29, 2011 at 6:52 PM, Pravin Shelar <pshelar at nicira.com> wrote:
> -static u32 port_hash(struct port_lookup_key *k)
> +static u32 port_hash(const struct port_lookup_key *k)
>  {
>        u32 x = jhash_3words((__force u32)k->saddr, (__force u32)k->daddr,
>                             k->tunnel_type, 0);
> -       return jhash_2words((__force u64)k->key >> 32, (__force u32)k->key, x);
> +       return jhash_2words((__force u64)k->in_key >> 32,
> +                           (__force u32)k->in_key, x);
>  }

Since the values are now in one contiguous block you can use jhash2() directly.

> @@ -973,8 +945,8 @@ static struct rtable *find_route(struct vport *vport,
>                if (unlikely(ip_route_output_key(&init_net, &rt, &fl)))
>                        return NULL;
>  #else
> -               struct flowi4 fl = { .daddr = mutable->daddr,
> -                                    .saddr = mutable->saddr,
> +               struct flowi4 fl = { .daddr = mutable->key.daddr,
> +                                    .saddr = mutable->key.saddr,
>                                     .flowi4_tos = tos,
>                                     .flowi4_proto = tnl_vport->tnl_ops->ipproto };

The other half of this #if statement needs to be updated as well -
currently this doesn't compile on kernels before 2.6.39.


More information about the dev mailing list