On Wed, Aug 27, 2014 at 4:13 AM, Andy Zhou <az...@nicira.com> wrote:
> Future pathces will make use of those functions.
>
> Signed-off-by: Andy Zhou <az...@nicira.com>
> ---
>  datapath/Modules.mk |  1 +
>  datapath/actions.c  | 57 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  datapath/actions.h  | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  datapath/datapath.c |  4 ++++
>  datapath/datapath.h |  4 +---
>  5 files changed, 117 insertions(+), 3 deletions(-)
>  create mode 100644 datapath/actions.h
>
....
> diff --git a/datapath/actions.h b/datapath/actions.h
> new file mode 100644
> index 0000000..5f98ad4
> --- /dev/null
> +++ b/datapath/actions.h
> @@ -0,0 +1,54 @@
> +/* Copyright (c) 2007-2014 Nicira, Inc.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of version 2 of the GNU General Public
> + * License as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> + * 02110-1301, USA
> + */
> +
> +#ifndef ACTION_H
> +#define ACTION_H 1
> +
> +#include <linux/kernel.h>
> +#include <linux/mutex.h>
> +#include <linux/netdevice.h>
> +#include <linux/skbuff.h>
> +
> +#include "compat.h"
> +#include "flow.h"
> +#include "flow_table.h"
> +#include "vlan.h"
> +#include "vport.h"
> +
> +#define OVS_ACTION_STACK_LIMIT 10
> +
> +struct ovs_deferred_action {
> +       struct sk_buff *skb;
> +       struct nlattr *actions;
> +       int rem;
> +
We can keep whole nested attribute so that no need to store netlink attr length.

> +       /* Store pkt_key clone during recirc */
> +       struct sw_flow_key pkt_key;
> +};
> +
> +struct ovs_action_stack {
> +       /* Deffered action stack */
> +       int top;
> +       struct ovs_deferred_action stack[OVS_ACTION_STACK_LIMIT];
> +};
> +
> +void ovs_action_stacks_init(void);
> +void ovs_action_stacks_exit(void);;
> +int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, struct 
> sw_flow_actions *acts);
> +void ovs_process_action_stack(void);
> +
Most of stack related are API can be static.

> +#endif /* actions.h */
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index a668222..b61e0ae 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -61,6 +61,7 @@
>  #include "vlan.h"
>  #include "vport-internal_dev.h"
>  #include "vport-netdev.h"
> +#include "actions.h"
>
>  int ovs_net_id __read_mostly;
>
> @@ -2151,6 +2152,8 @@ static int __init dp_init(void)
>         if (err < 0)
>                 goto error_unreg_notifier;
>
> +       ovs_action_stacks_init();
> +
>         return 0;
>
>  error_unreg_notifier:
> @@ -2173,6 +2176,7 @@ static void dp_cleanup(void)
>         rcu_barrier();
>         ovs_vport_exit();
>         ovs_flow_exit();
> +       ovs_action_stacks_exit();
>  }
>
>  module_init(dp_init);
> diff --git a/datapath/datapath.h b/datapath/datapath.h
> index eba2fc4..dbe58d4 100644
> --- a/datapath/datapath.h
> +++ b/datapath/datapath.h
> @@ -31,6 +31,7 @@
>  #include "flow_table.h"
>  #include "vlan.h"
>  #include "vport.h"
> +#include "actions.h"
>
>  #define DP_MAX_PORTS           USHRT_MAX
>  #define DP_VPORT_HASH_BUCKETS  1024
> @@ -196,9 +197,6 @@ int ovs_dp_upcall(struct datapath *, struct sk_buff *,
>  const char *ovs_dp_name(const struct datapath *dp);
>  struct sk_buff *ovs_vport_cmd_build_info(struct vport *, u32 portid, u32 seq,
>                                          u8 cmd);
> -
> -int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
> -                       struct sw_flow_actions *acts);
>  void ovs_dp_notify_wq(struct work_struct *work);
>
>  #define OVS_NLERR(fmt, ...)                                    \
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to