On Thu, Nov 26, 2015 at 10:07 PM, Simon Horman
<simon.hor...@netronome.com> wrote:
> My understanding is that prior to linux kernel commit
> dd17c8f72993 ("percpu: remove per_cpu__ prefix.") per_cpu_var(),
> which was included in v2.6.34, was used to wrap per cpu variables
>
> In order to allow Open vSwitch to compile against  v2.6.33
> and earlier use per_cpu_var() and in order to allow compilation
> with latter kernels provide a per_cpu_var() which performs
> an identity map.
>
> In the case of v2.6.32 the kernel does not supply this_cpu_{read,inc,dec}
> and the compat code for RHEL6 in datapath/linux/compat/include/linux/percpu.h
> is used.
>
> Fixes: 60759b2b9d0c ("datapath: Remove recirc stack depth limit check")
> Signed-off-by: Simon Horman <simon.hor...@netronome.com>
>
Sorry for late reply.

> ---
> * Also applicable to branch-2.4, please consider backporting to that branch.

Since master is going to drop support for kernel older than 3.10. I
would apply such patches to branch 2.5 and older.

>
> v2
> * Add kernel version to test to .travis.yml
> ---
>  .travis.yml        |  1 +
>  datapath/actions.c | 16 +++++++++++++---
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/.travis.yml b/.travis.yml
> index ea1d7e7ebea4..141359b76c1e 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -32,6 +32,7 @@ env:
>    - KERNEL=3.10.92
>    - KERNEL=3.4.110
>    - KERNEL=3.2.72
> +  - KERNEL=2.6.33.20
>    - KERNEL=2.6.32.68
>
As mentioned in other review of compatibility patch, I think we should
not add every kernel that OVS support.

>  script: ./.travis/build.sh $OPTS
> diff --git a/datapath/actions.c b/datapath/actions.c
> index c529bbb9b6ee..e8ca114beec2 100644
> --- a/datapath/actions.c
> +++ b/datapath/actions.c
> @@ -982,12 +982,22 @@ static void process_deferred_actions(struct datapath 
> *dp)
>         action_fifo_init(fifo);
>  }
>
> +#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,33)
> +#define ovs_this_cpu_read(ptr) this_cpu_read(per_cpu_var(ptr))
> +#define ovs_this_cpu_inc(ptr) this_cpu_inc(per_cpu_var(ptr))
> +#define ovs_this_cpu_dec(ptr) this_cpu_dec(per_cpu_var(ptr))
> +#else
> +#define ovs_this_cpu_read(ptr) this_cpu_read(ptr)
> +#define ovs_this_cpu_inc(ptr) this_cpu_inc(ptr)
> +#define ovs_this_cpu_dec(ptr) this_cpu_dec(ptr)
> +#endif
> +
We could redefine this_cpu_dec for OVS in combat header files.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to