From patchwork Fri Dec 11 04:03:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pravin B Shelar X-Patchwork-Id: 555479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id BC80E140157 for ; Fri, 11 Dec 2015 15:03:22 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nicira-com.20150623.gappssmtp.com header.i=@nicira-com.20150623.gappssmtp.com header.b=I46TE4GE; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id B446722C3EE; Thu, 10 Dec 2015 20:03:11 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 2A97E22C3E3 for ; Thu, 10 Dec 2015 20:03:09 -0800 (PST) Received: from bar3.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id B64C51620FA for ; Thu, 10 Dec 2015 21:03:08 -0700 (MST) X-ASG-Debug-ID: 1449806588-03dd7b6ae628ec0001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar3.cudamail.com with ESMTP id 0jSlE2hEd7FfpU37 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 10 Dec 2015 21:03:08 -0700 (MST) X-Barracuda-Envelope-From: pshelar@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mail-pa0-f48.google.com) (209.85.220.48) by mx3-pf3.cudamail.com with ESMTPS (RC4-SHA encrypted); 11 Dec 2015 04:13:37 -0000 Received-SPF: unknown (mx3-pf3.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.48 Received: by pabur14 with SMTP id ur14so58607657pab.0 for ; Thu, 10 Dec 2015 20:03:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nicira-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+rtMHqmLHN5oO2vVKVD/kQKijjxl4jZPZp+/9MpxeJQ=; b=I46TE4GE6zeLWDeCjOgq0EmTvp4Kq4H2vujKAeYRTXHh4R6GCG2vFAKl18HxF7/Dbn p2YlLBqOSLFqnXhp889+gLc5TqvPCgcsHexI/zj8cdoDgQ4HpJw1cfxoanDkUPkmXiX1 jRvZ9w4qBUBDp75j2SvnCwepUa1p5lG0jjAVcK+gv0aM7opgytxh7PHdmH9r0JvaVQdT G4m8EYY5C8WjsEhtqOXMZWKylUHBBmFytGUSAEtKsz3xrGUH3yDRpbZOAkJ+vEPEabp5 zsRSGkta8GjbKjDwkSFi7BsuCoeuXwx45+jqtU4QjxvxKApolRHP+LhF8tsKbuYySyzO CYNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+rtMHqmLHN5oO2vVKVD/kQKijjxl4jZPZp+/9MpxeJQ=; b=jjUEgxRqOWl2D2F5qnnVYvEVyhs2UbM04OdXIeB+82LJJYB7Xal5YueemmPueqj4hP xj2d1+oi2JcTN61IX3lWUaXsACpIq7S7OSmccnpFR/QSVEEZyEzsqSwcHsLqo4PjBgL9 mmF6upWN4RAJ7zsNtW7+OqKsWl0Szt2yR/ujzecqpbu2GzlWbi9VxV35T5qpTrFvOVss bdMdZy8GnWj7rGwm/wW7FwlhEqQnqL9Iahvc5IUlSUA1RJgbPKiZQp8M9z6jmIX26Rl9 xnmawHpRZnDMz5OI3SAX9h6XlXr69xzjZAOE8SWfpFO/frW7qU/U/PPk8hZQMkwB+n2p SLpg== X-Gm-Message-State: ALoCoQl0mUuF5fFRm223SXdY3QN0shei48OqJp0V9uzQ3aMpibS313+XwOb90EGmMq3uo9Nk0JvbJngd6/XrCJIuSzJKFBVsiA== X-Received: by 10.67.23.226 with SMTP id id2mr199040pad.149.1449806587385; Thu, 10 Dec 2015 20:03:07 -0800 (PST) Received: from localhost.localdomain.localdomain (c-73-162-15-99.hsd1.ca.comcast.net. [73.162.15.99]) by smtp.gmail.com with ESMTPSA id wo3sm21877043pab.25.2015.12.10.20.03.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Dec 2015 20:03:06 -0800 (PST) X-CudaMail-Envelope-Sender: pshelar@nicira.com X-Barracuda-Apparent-Source-IP: 73.162.15.99 From: Pravin B Shelar To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-1209077999 X-CudaMail-DTE: 121015 X-CudaMail-Originating-IP: 209.85.220.48 Date: Thu, 10 Dec 2015 20:03:01 -0800 X-ASG-Orig-Subj: [##CM-V3-1209077999##][PATCH 3/3] datapath: compat: Block upstream ip_tunnels functions. Message-Id: <1449806581-28010-3-git-send-email-pshelar@nicira.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1449806581-28010-1-git-send-email-pshelar@nicira.com> References: <1449806581-28010-1-git-send-email-pshelar@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1449806588 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 3/3] datapath: compat: Block upstream ip_tunnels functions. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Since upstream and compat ip_tunnel structures are not same, we can not use exported upstream functions. Following patch blocks definitions which used ip_tunnel internal structure. Function which do not depend on these structures are allows by explicitly by defining it in the header files. e.g. iptunnel_handle_offloads(), iptunnel_pull_header(). etc. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- datapath/linux/compat/include/net/gre.h | 3 ++- datapath/linux/compat/include/net/ip_tunnels.h | 27 ++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h index 09053b5..60618df 100644 --- a/datapath/linux/compat/include/net/gre.h +++ b/datapath/linux/compat/include/net/gre.h @@ -1,8 +1,10 @@ #ifndef __LINUX_GRE_WRAPPER_H #define __LINUX_GRE_WRAPPER_H +#include #include #include + #ifdef HAVE_METADATA_DST #include_next @@ -17,7 +19,6 @@ static inline void rpl_ipgre_fini(void) #else -#include #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) || \ defined(HAVE_GRE_CISCO_REGISTER) #include_next diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index 7083372..3d952d4 100644 --- a/datapath/linux/compat/include/net/ip_tunnels.h +++ b/datapath/linux/compat/include/net/ip_tunnels.h @@ -3,15 +3,14 @@ #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) +#ifdef HAVE_METADATA_DST +/* Block all ip_tunnel functions. + * Only function that do not depend on ip_tunnel structure can + * be used. Those needs to be explicitly defined in this header file. */ #include_next #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) - #include -#include -#include #include #include #include @@ -19,6 +18,7 @@ #include #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0) struct sk_buff *ovs_iptunnel_handle_offloads(struct sk_buff *skb, bool csum_help, int gso_type_mask, void (*fix_segment)(struct sk_buff *)); @@ -36,8 +36,21 @@ int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_prot #define ovs_iptunnel_handle_offloads(skb, csum_help, gso_type_mask, fix_segment) \ iptunnel_handle_offloads(skb, csum_help, gso_type_mask) +/* This macro is to make OVS build happy about declared functions name. */ +#define rpl_iptunnel_pull_header iptunnel_pull_header +int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); + +#define rpl_iptunnel_xmit iptunnel_xmit +int rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, + __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl, + __be16 df, bool xnet); + #endif /* 3.18 */ +#define rpl_iptunnel_handle_offloads iptunnel_handle_offloads +struct sk_buff *rpl_iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum, + int gso_type_mask); + #ifndef TUNNEL_CSUM #define TUNNEL_CSUM __cpu_to_be16(0x01) #define TUNNEL_ROUTING __cpu_to_be16(0x02) @@ -211,9 +224,11 @@ struct ip_tunnel_net { #ifndef HAVE_PCPU_SW_NETSTATS #define ip_tunnel_get_stats64 rpl_ip_tunnel_get_stats64 +#else +#define rpl_ip_tunnel_get_stats64 ip_tunnel_get_stats64 +#endif struct rtnl_link_stats64 *rpl_ip_tunnel_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *tot); -#endif #define ip_tunnel_get_dsfield rpl_ip_tunnel_get_dsfield static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,