[ovs-dev] [PATCH] datapath: compat: Fix compilation 3.11

Pravin Shelar pshelar at nicira.com
Mon Oct 13 18:07:27 UTC 2014


On Mon, Oct 13, 2014 at 9:22 AM, Andy Zhou <azhou at nicira.com> wrote:
> Thanks for explaining.  I don't think we necessarily need to tie the
> use of ip_tunnel kernel API
> to the existence on vxlan kernel API. On the other hand. It is not a big deal.
>
We can do that later, as part of larger cleanup.

> Acked-by: Andy Zhou <azhou at nicira.com>
>

I pushed it to master and branch-2.3.

Thanks.
>
>
> On Fri, Oct 10, 2014 at 7:38 PM, Pravin Shelar <pshelar at nicira.com> wrote:
>> On Fri, Oct 10, 2014 at 5:47 PM, Andy Zhou <azhou at nicira.com> wrote:
>>> O.K.  Coming back to this patch. Would you please explain why this
>>> patch needs to affect how GRE, or iptunnel API is used?
>>>
>>
>> OVS has compat code for GRE, VXLAN and ip-tunnel APIs. this is
>> controlled by GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS. But vxlan
>> availability is not  checked for defining
>> GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS. 3.11 has GRE API but no vxlan API,
>> that cause compilation error.
>> This patch add check for vxlan and rename this symbol to USE_KERNEL_TUNNEL_API.
>>
>>
>>> On Fri, Oct 10, 2014 at 4:18 PM, Pravin Shelar <pshelar at nicira.com> wrote:
>>>> On Fri, Oct 10, 2014 at 3:29 PM, Andy Zhou <azhou at nicira.com> wrote:
>>>>> Would it be better to use kernel's CONFIG_VXLAN setting to determine
>>>>> if vxlan compat code should
>>>>> be used?
>>>>>
>>>> tunnel compat code do not check for CONFIG option. User is expected to
>>>> have these module options turned on to use OVS tunneling to get
>>>> optimal performance.
>>>>
>>>>> On Fri, Oct 10, 2014 at 8:21 AM, Pravin B Shelar <pshelar at nicira.com> wrote:
>>>>>> Kernel 3.11 is only kernel where GRE APIs are available but
>>>>>> not vxlan. Add check for vxlan xmit to detect this case.
>>>>>>
>>>>>> Reported-by: Dave Benson <dbenson at verdantnetworks.com>
>>>>>> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
>>>>>> ---
>>>>>>  acinclude.m4                                   |    1 +
>>>>>>  datapath/linux/compat/gre.c                    |    2 +-
>>>>>>  datapath/linux/compat/include/net/gre.h        |    2 +-
>>>>>>  datapath/linux/compat/include/net/ip_tunnels.h |    7 ++++---
>>>>>>  datapath/linux/compat/include/net/vxlan.h      |    2 +-
>>>>>>  datapath/linux/compat/ip_tunnels_core.c        |    2 +-
>>>>>>  datapath/linux/compat/vxlan.c                  |    2 +-
>>>>>>  datapath/vport-geneve.c                        |    1 -
>>>>>>  8 files changed, 10 insertions(+), 9 deletions(-)
>>>>>>
>>>>>> diff --git a/acinclude.m4 b/acinclude.m4
>>>>>> index 9a7f809..9a7ea84 100644
>>>>>> --- a/acinclude.m4
>>>>>> +++ b/acinclude.m4
>>>>>> @@ -379,6 +379,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>>>>>>
>>>>>>    OVS_GREP_IFELSE([$KSRC/include/linux/openvswitch.h], [openvswitch_handle_frame_hook],
>>>>>>                    [OVS_DEFINE([HAVE_RHEL_OVS_HOOK])])
>>>>>> +  OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [vxlan_xmit_skb])
>>>>>>    OVS_GREP_IFELSE([$KSRC/include/net/vxlan.h], [bool xnet],
>>>>>>                    [OVS_DEFINE([HAVE_VXLAN_XMIT_SKB_XNET_ARG])])
>>>>>>    OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_flow_src_port],
>>>>>> diff --git a/datapath/linux/compat/gre.c b/datapath/linux/compat/gre.c
>>>>>> index de3d6eb..c7f2551 100644
>>>>>> --- a/datapath/linux/compat/gre.c
>>>>>> +++ b/datapath/linux/compat/gre.c
>>>>>> @@ -268,7 +268,7 @@ int gre_cisco_unregister(struct gre_cisco_protocol *proto)
>>>>>>
>>>>>>  #endif /* !HAVE_GRE_CISCO_REGISTER */
>>>>>>
>>>>>> -#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
>>>>>> +#ifndef USE_KERNEL_TUNNEL_API
>>>>>>
>>>>>>  /* GRE TX side. */
>>>>>>  static void gre_csum_fix(struct sk_buff *skb)
>>>>>> diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h
>>>>>> index f091b32..b4bf2f1 100644
>>>>>> --- a/datapath/linux/compat/include/net/gre.h
>>>>>> +++ b/datapath/linux/compat/include/net/gre.h
>>>>>> @@ -81,7 +81,7 @@ static inline __be16 tnl_flags_to_gre_flags(__be16 tflags)
>>>>>>  #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
>>>>>>  #endif /* HAVE_GRE_CISCO_REGISTER */
>>>>>>
>>>>>> -#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
>>>>>> +#ifndef USE_KERNEL_TUNNEL_API
>>>>>>
>>>>>>  #define gre_build_header rpl_gre_build_header
>>>>>>  void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
>>>>>> diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h
>>>>>> index 9afab8c..d03be75 100644
>>>>>> --- a/datapath/linux/compat/include/net/ip_tunnels.h
>>>>>> +++ b/datapath/linux/compat/include/net/ip_tunnels.h
>>>>>> @@ -3,14 +3,15 @@
>>>>>>
>>>>>>  #include <linux/version.h>
>>>>>>  #if defined(HAVE_GRE_HANDLE_OFFLOADS) && \
>>>>>> -     LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
>>>>>> +     LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && \
>>>>>> +     defined(HAVE_VXLAN_XMIT_SKB)
>>>>>>  /* RHEL6 and RHEL7 both has backported tunnel API but RHEL6 has
>>>>>>   * older version, so avoid using RHEL6 backports.
>>>>>>   */
>>>>>> -#define GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
>>>>>> +#define USE_KERNEL_TUNNEL_API
>>>>>>  #endif
>>>>>>
>>>>>> -#ifdef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
>>>>>> +#ifdef USE_KERNEL_TUNNEL_API
>>>>>>  #include_next <net/ip_tunnels.h>
>>>>>>
>>>>>>  #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
>>>>>> diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h
>>>>>> index 1b801dd..099d824 100644
>>>>>> --- a/datapath/linux/compat/include/net/vxlan.h
>>>>>> +++ b/datapath/linux/compat/include/net/vxlan.h
>>>>>> @@ -7,7 +7,7 @@
>>>>>>  #include <net/gre.h>
>>>>>>
>>>>>>  #include <linux/version.h>
>>>>>> -#ifdef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
>>>>>> +#ifdef USE_KERNEL_TUNNEL_API
>>>>>>  #include_next <net/vxlan.h>
>>>>>>
>>>>>>  static inline int rpl_vxlan_xmit_skb(struct vxlan_sock *vs,
>>>>>> diff --git a/datapath/linux/compat/ip_tunnels_core.c b/datapath/linux/compat/ip_tunnels_core.c
>>>>>> index 007cd17..6cf38d0 100644
>>>>>> --- a/datapath/linux/compat/ip_tunnels_core.c
>>>>>> +++ b/datapath/linux/compat/ip_tunnels_core.c
>>>>>> @@ -35,7 +35,7 @@
>>>>>>  #include "compat.h"
>>>>>>  #include "gso.h"
>>>>>>
>>>>>> -#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
>>>>>> +#ifndef USE_KERNEL_TUNNEL_API
>>>>>>  int iptunnel_xmit(struct sock *sk, struct rtable *rt,
>>>>>>                   struct sk_buff *skb,
>>>>>>                   __be32 src, __be32 dst, __u8 proto,
>>>>>> diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
>>>>>> index 7f5918b..f13cc89 100644
>>>>>> --- a/datapath/linux/compat/vxlan.c
>>>>>> +++ b/datapath/linux/compat/vxlan.c
>>>>>> @@ -58,7 +58,7 @@
>>>>>>  #include "datapath.h"
>>>>>>  #include "gso.h"
>>>>>>  #include "vlan.h"
>>>>>> -#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
>>>>>> +#ifndef USE_KERNEL_TUNNEL_API
>>>>>>
>>>>>>  #define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
>>>>>>
>>>>>> diff --git a/datapath/vport-geneve.c b/datapath/vport-geneve.c
>>>>>> index d79e27b..7c08577 100644
>>>>>> --- a/datapath/vport-geneve.c
>>>>>> +++ b/datapath/vport-geneve.c
>>>>>> @@ -31,7 +31,6 @@
>>>>>>  #include <net/ip.h>
>>>>>>  #include <net/route.h>
>>>>>>  #include <net/udp.h>
>>>>>> -#include <net/vxlan.h>
>>>>>>  #include <net/xfrm.h>
>>>>>>
>>>>>>  #include "datapath.h"
>>>>>> --
>>>>>> 1.7.1
>>>>>>
>>>>>> _______________________________________________
>>>>>> dev mailing list
>>>>>> dev at openvswitch.org
>>>>>> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list