From patchwork Thu Feb 9 00:50:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 725891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vJfdg5Vnlz9s2G for ; Thu, 9 Feb 2017 11:51:03 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C984EBC1; Thu, 9 Feb 2017 00:50:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id BA2B2BBD for ; Thu, 9 Feb 2017 00:50:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id E42D71E2 for ; Thu, 9 Feb 2017 00:50:48 +0000 (UTC) Received: from mfilter17-d.gandi.net (mfilter17-d.gandi.net [217.70.178.145]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id C31AEFB883; Thu, 9 Feb 2017 01:50:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter17-d.gandi.net Received: from relay6-d.mail.gandi.net ([IPv6:::ffff:217.70.183.198]) by mfilter17-d.gandi.net (mfilter17-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 0f-8k_Q69Tb9; Thu, 9 Feb 2017 01:50:46 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 369D6FB882; Thu, 9 Feb 2017 01:50:44 +0100 (CET) From: Joe Stringer To: dev@openvswitch.org Date: Wed, 8 Feb 2017 16:50:36 -0800 Message-Id: <20170209005036.2864-1-joe@ovn.org> X-Mailer: git-send-email 2.11.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] compat: Remove rpl_dev_queue_xmit() backport. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The MPLS portions of this were inadvertently broken in v2.4 due to 433637881ca5 ("datapath: define compat __skb_gso_segment()") which inverts the supports_mpls_gso() logic, then when rpl_dev_queue_xmit() backport dropped its VLAN portion in v2.6, the whole function became a no-op - since b63bf2488209 ("datapath: remove VLAN compat code from GSO"). Apparently the MPLS side of this code never worked in a released version of OVS and no-one noticed, so remove it. Signed-off-by: Joe Stringer --- CC: Simon Horman Simon, I'm not sure what the repercussions are of this but by my reading of the code the extra skb_gso_segment compat code here is never invoked anyway so I figure we can just drop it. Looks like it might've been fine when originally submitted, but by the time v2.4 came out it was already nerfed >.< That said, if we just need to fix the version check to get it working again then that's an option. Also, I see that the upstream commit 48d2ab609b6b ("net: mpls: Fixups for GSO") will further change the way that OVS deals with MPLS GSO, so perhaps we'll actually need to bring back a backport for handling those cases, when that patch is backported to the OVS tree. --- datapath/linux/compat/gso.c | 91 ------------------------- datapath/linux/compat/include/linux/netdevice.h | 5 -- 2 files changed, 96 deletions(-) diff --git a/datapath/linux/compat/gso.c b/datapath/linux/compat/gso.c index 48a56b9f5d5f..2638f1114ede 100644 --- a/datapath/linux/compat/gso.c +++ b/datapath/linux/compat/gso.c @@ -41,97 +41,6 @@ #include "gso.h" -#ifdef OVS_USE_COMPAT_GSO_SEGMENTATION -/* Strictly this is not needed and will be optimised out - * as this code is guarded by if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0). - * It is here to make things explicit should the compatibility - * code be extended in some way prior extending its life-span - * beyond v3.19. - */ -static bool supports_mpls_gso(void) -{ -/* MPLS GSO was introduced in v3.11, however it was not correctly - * activated using mpls_features until v3.19. */ -#ifdef OVS_USE_COMPAT_GSO_SEGMENTATION - return true; -#else - return false; -#endif -} - -int rpl_dev_queue_xmit(struct sk_buff *skb) -{ -#undef dev_queue_xmit - int err = -ENOMEM; - bool mpls; - - mpls = false; - - /* Avoid traversing any VLAN tags that are present to determine if - * the ethtype is MPLS. Instead compare the mac_len (end of L2) and - * skb_network_offset() (beginning of L3) whose inequality will - * indicate the presence of an MPLS label stack. */ - if (skb->mac_len != skb_network_offset(skb) && !supports_mpls_gso()) - mpls = true; - - if (mpls) { - int features; - - features = netif_skb_features(skb); - - /* As of v3.11 the kernel provides an mpls_features field in - * struct net_device which allows devices to advertise which - * features its supports for MPLS. This value defaults to - * NETIF_F_SG and as of v3.19. - * - * This compatibility code is intended for kernels older - * than v3.19 that do not support MPLS GSO and do not - * use mpls_features. Thus this code uses NETIF_F_SG - * directly in place of mpls_features. - */ - if (mpls) - features &= NETIF_F_SG; - - if (netif_needs_gso(skb, features)) { - struct sk_buff *nskb; - - nskb = skb_gso_segment(skb, features); - if (!nskb) { - if (unlikely(skb_cloned(skb) && - pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) - goto drop; - - skb_shinfo(skb)->gso_type &= ~SKB_GSO_DODGY; - goto xmit; - } - - if (IS_ERR(nskb)) { - err = PTR_ERR(nskb); - goto drop; - } - consume_skb(skb); - skb = nskb; - - do { - nskb = skb->next; - skb->next = NULL; - err = dev_queue_xmit(skb); - skb = nskb; - } while (skb); - - return err; - } - } -xmit: - return dev_queue_xmit(skb); - -drop: - kfree_skb(skb); - return err; -} -EXPORT_SYMBOL_GPL(rpl_dev_queue_xmit); -#endif /* OVS_USE_COMPAT_GSO_SEGMENTATION */ - #ifndef USE_UPSTREAM_TUNNEL_GSO static __be16 __skb_network_protocol(struct sk_buff *skb) { diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h index 75315dc16e02..dc05ee9a9ca7 100644 --- a/datapath/linux/compat/include/linux/netdevice.h +++ b/datapath/linux/compat/include/linux/netdevice.h @@ -111,11 +111,6 @@ static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev, #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0) -#define dev_queue_xmit rpl_dev_queue_xmit -int rpl_dev_queue_xmit(struct sk_buff *skb); -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) static inline struct net_device *rpl_netdev_notifier_info_to_dev(void *info) {