[ovs-dev] [PATCH] datapath: Change ovs_flow_tbl_lookup_xx() APIs for

Andy Zhou azhou at nicira.com
Wed Nov 13 21:37:25 UTC 2013


Please ignore this patch. I have sent a v2 with more content in the commit
message.


On Wed, Nov 13, 2013 at 12:11 PM, Andy Zhou <azhou at nicira.com> wrote:

> API changes only. No functional chnages.
>
> Reported by: Ben Pfaff <blp at nicira.com>
>
> Signed-off-by: Andy Zhou <azhou at nicira.com>
> ---
>  datapath/datapath.c   |   16 ++++------------
>  datapath/flow_table.c |   10 +++++++++-
>  datapath/flow_table.h |    4 +++-
>  3 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index e4aa672..d0a8595 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -236,7 +236,7 @@ void ovs_dp_process_received_packet(struct vport *p,
> struct sk_buff *skb)
>         }
>
>         /* Look up flow. */
> -       flow = ovs_flow_tbl_lookup(&dp->table, &key, &n_mask_hit);
> +       flow = ovs_flow_tbl_lookup_stats(&dp->table, &key, &n_mask_hit);
>         if (unlikely(!flow)) {
>                 struct dp_upcall_info upcall;
>
> @@ -745,14 +745,6 @@ static struct sk_buff *ovs_flow_cmd_build_info(struct
> sw_flow *flow,
>         return skb;
>  }
>
> -static struct sw_flow *__ovs_flow_tbl_lookup(struct flow_table *tbl,
> -                                             const struct sw_flow_key
> *key)
> -{
> -       u32 __always_unused n_mask_hit;
> -
> -       return ovs_flow_tbl_lookup(tbl, key, &n_mask_hit);
> -}
> -
>  static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, struct genl_info
> *info)
>  {
>         struct nlattr **a = info->attrs;
> @@ -803,7 +795,7 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff
> *skb, struct genl_info *info)
>                 goto err_unlock_ovs;
>
>         /* Check if this is a duplicate flow */
> -       flow = __ovs_flow_tbl_lookup(&dp->table, &key);
> +       flow = ovs_flow_tbl_lookup(&dp->table, &key);
>         if (!flow) {
>                 /* Bail out if we're not allowed to create a new flow. */
>                 error = -ENOENT;
> @@ -911,7 +903,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb,
> struct genl_info *info)
>                 goto unlock;
>         }
>
> -       flow = __ovs_flow_tbl_lookup(&dp->table, &key);
> +       flow = ovs_flow_tbl_lookup(&dp->table, &key);
>         if (!flow || !ovs_flow_cmp_unmasked_key(flow, &match)) {
>                 err = -ENOENT;
>                 goto unlock;
> @@ -959,7 +951,7 @@ static int ovs_flow_cmd_del(struct sk_buff *skb,
> struct genl_info *info)
>         if (err)
>                 goto unlock;
>
> -       flow = __ovs_flow_tbl_lookup(&dp->table, &key);
> +       flow = ovs_flow_tbl_lookup(&dp->table, &key);
>         if (!flow || !ovs_flow_cmp_unmasked_key(flow, &match)) {
>                 err = -ENOENT;
>                 goto unlock;
> diff --git a/datapath/flow_table.c b/datapath/flow_table.c
> index ddb14da..f768fd4 100644
> --- a/datapath/flow_table.c
> +++ b/datapath/flow_table.c
> @@ -434,7 +434,7 @@ static struct sw_flow *masked_flow_lookup(struct
> table_instance *ti,
>         return NULL;
>  }
>
> -struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl,
> +struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *tbl,
>                                     const struct sw_flow_key *key,
>                                     u32 *n_mask_hit)
>  {
> @@ -452,6 +452,14 @@ struct sw_flow *ovs_flow_tbl_lookup(struct flow_table
> *tbl,
>         return NULL;
>  }
>
> +struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl,
> +                                   const struct sw_flow_key *key)
> +{
> +       u32 __always_unused n_mask_hit;
> +
> +       return ovs_flow_tbl_lookup_stats(tbl, key, &n_mask_hit);
> +}
> +
>  int ovs_flow_tbl_num_masks(const struct flow_table *table)
>  {
>         struct sw_flow_mask *mask;
> diff --git a/datapath/flow_table.h b/datapath/flow_table.h
> index fbe45d5..f54aa82 100644
> --- a/datapath/flow_table.h
> +++ b/datapath/flow_table.h
> @@ -69,9 +69,11 @@ void ovs_flow_tbl_remove(struct flow_table *table,
> struct sw_flow *flow);
>  int  ovs_flow_tbl_num_masks(const struct flow_table *table);
>  struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *table,
>                                        u32 *bucket, u32 *idx);
> -struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *,
> +struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *,
>                                     const struct sw_flow_key *,
>                                     u32 *n_mask_hit);
> +struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *,
> +                                   const struct sw_flow_key *);
>
>  bool ovs_flow_cmp_unmasked_key(const struct sw_flow *flow,
>                                struct sw_flow_match *match);
> --
> 1.7.9.5
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20131113/9e5daca4/attachment-0003.html>


More information about the dev mailing list