From patchwork Fri Dec 18 04:50:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 558736 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 B19A91402B4 for ; Fri, 18 Dec 2015 15:50:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b=obj3Fn5I; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id A228310A05; Thu, 17 Dec 2015 20:50:25 -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 9AC9110A02 for ; Thu, 17 Dec 2015 20:50:24 -0800 (PST) Received: from bar4.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 9A625161128 for ; Thu, 17 Dec 2015 21:50:23 -0700 (MST) X-ASG-Debug-ID: 1450414221-03dc213fed127b90001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar4.cudamail.com with ESMTP id y2Si6Ww4zWSVD15H (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 17 Dec 2015 21:50:21 -0700 (MST) X-Barracuda-Envelope-From: simon.horman@netronome.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mail-pa0-f51.google.com) (209.85.220.51) by mx3-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 18 Dec 2015 04:50:16 -0000 Received-SPF: none (mx3-pf2.cudamail.com: domain at netronome.com does not designate permitted sender hosts) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.51 Received: by mail-pa0-f51.google.com with SMTP id jx14so25209010pad.2 for ; Thu, 17 Dec 2015 20:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ddceicIdv/HVCPERvEW7RvwSetCUQUA3y32G6e5PMvs=; b=obj3Fn5I5BKuWYi2iuSfh3gm1SN2/R+gll82JsAufbSBKLugmkkH3VppK1bGLuiuHf arQJfm+KdqKGyISO/MPy9vwbIhp2UB8B9K5yksAgXtcqnUfnn39IUl9SVE1esw4TtCM7 +T6dVbntOVuqH57VcssBTtynmVwPo0QJccQZgbighN8ye7NOtVBqa6Oseck7rWVJ6EIC jlvEY7p81eej91T0JplpV5+1a+qCR2tj/lpm+zGPKm6FBMicO9/p6rv5hisNlDtDBZD7 qLgjmnv/sBwhR6Jl99xlXgdz2bnDWb+ctGogkPmbFEt2WUceUYKyx9uB3KEETifxvHYj NpVQ== 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=ddceicIdv/HVCPERvEW7RvwSetCUQUA3y32G6e5PMvs=; b=nM9jLMhyZt+CZJIoc0mt2srRstckBqH4zbShLBqJDCk0AbdYGuUEbp1jOCaYKrfSBU yKR5eJWsduVEYRoZsrSngnprVN6xB+wYQo5OhwULUnuYRoW/+OEIaRkYjEfpo7m76awX vRIWeHqFG8DDPZCufUtVu9ihs3KsSJ+yQ1Ywpyl/pExC8L5z3WH8KoDmrmL+bUaemHU+ uV0dbie5R+Km+28S9iYozOy/edGZ3URZsqCOVM/BFb+S/tvI6pruhW7Ti7Fw4ZyofaCe mIHac83R38y2Vto9GRrx3i8TvpTrJt945Oa2SBDwxQzwr6Fzy7jb2UqrfAN6p93UHuBb vQtg== X-Gm-Message-State: ALoCoQmatvME7pq7tjoEMoNQ+91BMX8h0mKyPL6ZaedrmY/QS1bSwzAS+5AFxVv4TCkNQHHzRJTZS5czWJ52L1HCxKsPSylYag== X-Received: by 10.66.219.194 with SMTP id pq2mr2220528pac.107.1450414215840; Thu, 17 Dec 2015 20:50:15 -0800 (PST) Received: from reginn.isobedori.kobe.vergenet.net (p1027-ipbfp1401kobeminato.hyogo.ocn.ne.jp. [114.152.28.27]) by smtp.gmail.com with ESMTPSA id r90sm14560225pfi.80.2015.12.17.20.50.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Dec 2015 20:50:14 -0800 (PST) X-CudaMail-Envelope-Sender: simon.horman@netronome.com X-Barracuda-Apparent-Source-IP: 114.152.28.27 From: Simon Horman To: dev@openvswitch.org X-CudaMail-MID: CM-V2-1216071164 X-CudaMail-DTE: 121715 X-CudaMail-Originating-IP: 209.85.220.51 Date: Fri, 18 Dec 2015 13:50:00 +0900 X-ASG-Orig-Subj: [##CM-V2-1216071164##][PATCH 1/5] datapath: correct {new, del}link compat code Message-Id: <1450414204-9038-2-git-send-email-simon.horman@netronome.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1450414204-9038-1-git-send-email-simon.horman@netronome.com> References: <1450414204-9038-1-git-send-email-simon.horman@netronome.com> X-GBUdb-Analysis: 0, 209.85.220.51, Ugly c=0.396759 p=-0.234043 Source Normal X-MessageSniffer-Rules: 0-0-0-16768-c X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1450414221 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 1.10 X-Barracuda-Spam-Status: No, SCORE=1.10 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_RULE7568M, BSF_SC5_MJ1963, DKIM_SIGNED, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.25366 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.50 BSF_RULE7568M Custom Rule 7568M 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: Simon Horman Subject: [ovs-dev] [PATCH 1/5] datapath: correct {new,del}link compat code 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" * The net parameter of newlink and the head parameter of dellink were introduced introduced in v2.6.33 * The head parameter of dellink cannot be used if its not present Fixes: e23775f20e1a ("datapath: Add support for lwtunnel") Signed-off-by: Simon Horman --- .travis.yml | 3 +++ datapath/linux/compat/dev-openvswitch.c | 2 +- datapath/linux/compat/geneve.c | 22 ++++++++++++++-------- datapath/linux/compat/ip_gre.c | 4 ++-- datapath/linux/compat/lisp.c | 14 ++++++++++---- datapath/linux/compat/vxlan.c | 23 ++++++++++++++++------- 6 files changed, 46 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea1d7e7ebea4..90df67454a22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,9 @@ env: - KERNEL=3.10.92 - KERNEL=3.4.110 - KERNEL=3.2.72 + - KERNEL=2.6.38.8 + - KERNEL=2.6.37.6 + - KERNEL=2.6.33.20 - KERNEL=2.6.32.68 script: ./.travis/build.sh $OPTS diff --git a/datapath/linux/compat/dev-openvswitch.c b/datapath/linux/compat/dev-openvswitch.c index d7d4224a1cb3..5fe356a1cefd 100644 --- a/datapath/linux/compat/dev-openvswitch.c +++ b/datapath/linux/compat/dev-openvswitch.c @@ -103,7 +103,7 @@ int rpl_rtnl_delete_link(struct net_device *dev) if (!ops || !ops->dellink) return -EOPNOTSUPP; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) ops->dellink(dev); #else { diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c index 297593ce6e1a..38e8abbc0c36 100644 --- a/datapath/linux/compat/geneve.c +++ b/datapath/linux/compat/geneve.c @@ -909,15 +909,15 @@ static int geneve_configure(struct net *net, struct net_device *dev, return 0; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) -static int geneve_newlink(struct net_device *dev, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +static int geneve_newlink(struct net *net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { - struct net *net = &init_net; #else -static int geneve_newlink(struct net *net, struct net_device *dev, +static int geneve_newlink(struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { + struct net *net = &init_net; #endif __be16 dst_port = htons(GENEVE_UDP_PORT); __u8 ttl = 0, tos = 0; @@ -947,17 +947,23 @@ static int geneve_newlink(struct net *net, struct net_device *dev, ttl, tos, dst_port, metadata); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) -static void geneve_dellink(struct net_device *dev) -#else +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static void geneve_dellink(struct net_device *dev, struct list_head *head) -#endif { struct geneve_dev *geneve = netdev_priv(dev); list_del(&geneve->next); unregister_netdevice_queue(dev, head); } +#else +static void geneve_dellink(struct net_device *dev) +{ + struct geneve_dev *geneve = netdev_priv(dev); + + list_del(&geneve->next); + unregister_netdevice(dev); +} +#endif static size_t geneve_get_size(const struct net_device *dev) { diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index c9197e9652fd..3abcf4149d92 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -482,7 +482,7 @@ static void ipgre_tap_setup(struct net_device *dev) ip_tunnel_setup(dev, gre_tap_net_id); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) #else @@ -606,7 +606,7 @@ struct net_device *rpl_gretap_fb_dev_create(struct net *net, const char *name, t = netdev_priv(dev); t->collect_md = true; /* Configure flow based GRE device. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) err = ipgre_newlink(net, dev, tb, NULL); #else err = ipgre_newlink(dev, tb, NULL); diff --git a/datapath/linux/compat/lisp.c b/datapath/linux/compat/lisp.c index e5a6a7fe00a4..6e8231691db1 100644 --- a/datapath/linux/compat/lisp.c +++ b/datapath/linux/compat/lisp.c @@ -557,7 +557,7 @@ static int lisp_configure(struct net *net, struct net_device *dev, return 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static int lisp_newlink(struct net *net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) { @@ -576,17 +576,23 @@ static int lisp_newlink(struct net_device *dev, return lisp_configure(net, dev, dst_port); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static void lisp_dellink(struct net_device *dev, struct list_head *head) +{ + struct lisp_dev *lisp = netdev_priv(dev); + + list_del(&lisp->next); + unregister_netdevice_queue(dev, head); +} #else static void lisp_dellink(struct net_device *dev) -#endif { struct lisp_dev *lisp = netdev_priv(dev); list_del(&lisp->next); - unregister_netdevice_queue(dev, head); + unregister_netdevice(dev); } +#endif static size_t lisp_get_size(const struct net_device *dev) { diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c index dd0015d01c32..c40c914d3e8f 100644 --- a/datapath/linux/compat/vxlan.c +++ b/datapath/linux/compat/vxlan.c @@ -2006,7 +2006,7 @@ struct net_device *rpl_vxlan_dev_create(struct net *net, const char *name, } EXPORT_SYMBOL_GPL(rpl_vxlan_dev_create); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) static int vxlan_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[], struct nlattr *data[]) #else @@ -2017,11 +2017,7 @@ static int vxlan_newlink(struct net_device *dev, return -EINVAL; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) -static void vxlan_dellink(struct net_device *dev, struct list_head *head) -#else -static void vxlan_dellink(struct net_device *dev) -#endif +static void vxlan_dellink__(struct net_device *dev) { struct vxlan_dev *vxlan = netdev_priv(dev); struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); @@ -2032,8 +2028,21 @@ static void vxlan_dellink(struct net_device *dev) spin_unlock(&vn->sock_lock); list_del(&vxlan->next); +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) +static void vxlan_dellink(struct net_device *dev, struct list_head *head) +{ + vxlan_dellink__(dev); unregister_netdevice_queue(dev, head); } +#else +static void vxlan_dellink(struct net_device *dev) +{ + vxlan_dellink__(dev); + unregister_netdevice(dev); +} +#endif static size_t vxlan_get_size(const struct net_device *dev) { @@ -2116,7 +2125,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn, * is 0 here, so no matches. */ if (dst->remote_ifindex == dev->ifindex) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33) vxlan_dellink(vxlan->dev, &list_kill); #else vxlan_dellink(vxlan->dev);