[ovs-dev] [PATCH] compat: Remove rpl_dev_queue_xmit() backport.
Joe Stringer
joe at ovn.org
Thu Feb 9 00:50:36 UTC 2017
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 <joe at ovn.org>
---
CC: Simon Horman <horms at verge.net.au>
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)
{
--
2.11.0
More information about the dev
mailing list