On 06/10/14 at 04:47pm, Jesse Gross wrote:
> diff --git a/datapath/flow.c b/datapath/flow.c
> index f1bb95d..7b108ed 100644
> --- a/datapath/flow.c
> +++ b/datapath/flow.c
> @@ -455,6 +455,13 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, 
> struct sw_flow_key *key)
>               struct ovs_tunnel_info *tun_info = OVS_CB(skb)->tun_info;
>               memcpy(&key->tun_key, &tun_info->tunnel,
>                       sizeof(key->tun_key));
> +             if (tun_info->options) {
> +                     memcpy(GENEVE_OPTS(key, tun_info->options_len),
> +                             tun_info->options, tun_info->options_len);
> +                     key->tun_opts_len = tun_info->options_len;
> +             } else {
> +                     key->tun_opts_len = 0;
> +             }       
>       } else {
>               memset(&key->tun_key, 0, sizeof(key->tun_key));
>       }
> diff --git a/datapath/flow.h b/datapath/flow.h
> index 0ecf78b..5d8383c 100644
> --- a/datapath/flow.h
> +++ b/datapath/flow.h
> @@ -53,11 +53,20 @@ struct ovs_key_ipv4_tunnel {
>  
>  struct ovs_tunnel_info {
>       struct ovs_key_ipv4_tunnel tunnel;
> +     struct geneve_opt *options;
> +     u8 options_len;
>  };
>  
> +#define GENEVE_OPTS(flow_key, opt_len) (struct geneve_opt *) \
> +                                     ((flow_key)->tun_opts + \
> +                                     FIELD_SIZEOF(struct sw_flow_key, 
> tun_opts) - \
> +                                        opt_len)

What is the reason for storing the options at the end of the array?

>  struct sw_flow_key {
> +     u8 tun_opts[255];
> +     u8 tun_opts_len;

I wonder whether it makes sense to start allocating parts of the flow
key. This change increases the size of the flow key by 4 full cache lines
which will definitely have impact on the flow lookup speed.

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to