Whenever a port is added to the datapath, LRO is automatically disabled.
In the future, we may want to enable LRO in some circumstances, so have
userspace disable LRO through the ethtool ioctls.

Feature #6810

Signed-off-by: Justin Pettit <jpet...@nicira.com>
---
 datapath/linux/.gitignore                       |    2 -
 datapath/linux/Modules.mk                       |    2 -
 datapath/linux/compat/dev-openvswitch.c         |   32 -----------------------
 datapath/linux/compat/include/linux/netdevice.h |    4 ---
 datapath/linux/compat/include/linux/skbuff.h    |   23 ----------------
 datapath/linux/compat/skbuff-openvswitch.c      |   14 ----------
 datapath/vport-netdev.c                         |    3 --
 lib/dpif-linux.c                                |    9 ++++++
 8 files changed, 9 insertions(+), 80 deletions(-)
 delete mode 100644 datapath/linux/compat/dev-openvswitch.c
 delete mode 100644 datapath/linux/compat/skbuff-openvswitch.c

diff --git a/datapath/linux/.gitignore b/datapath/linux/.gitignore
index 0aee746..721a022 100644
--- a/datapath/linux/.gitignore
+++ b/datapath/linux/.gitignore
@@ -8,7 +8,6 @@
 /brc_sysfs_if.c
 /brcompat.c
 /checksum.c
-/dev-openvswitch.c
 /dp_sysfs_dp.c
 /dp_sysfs_if.c
 /datapath.c
@@ -26,7 +25,6 @@
 /netdevice.c
 /random32.c
 /reciprocal_div.c
-/skbuff-openvswitch.c
 /table.c
 /time.c
 /tmp
diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
index cb68010..99698ec 100644
--- a/datapath/linux/Modules.mk
+++ b/datapath/linux/Modules.mk
@@ -1,13 +1,11 @@
 openvswitch_sources += \
        linux/compat/addrconf_core-openvswitch.c \
-       linux/compat/dev-openvswitch.c \
        linux/compat/flex_array.c \
        linux/compat/genetlink-openvswitch.c \
        linux/compat/ip_output-openvswitch.c \
        linux/compat/kmemdup.c \
        linux/compat/netdevice.c \
        linux/compat/reciprocal_div.c \
-       linux/compat/skbuff-openvswitch.c \
        linux/compat/time.c
 openvswitch_headers += \
        linux/compat/include/asm-generic/bug.h \
diff --git a/datapath/linux/compat/dev-openvswitch.c 
b/datapath/linux/compat/dev-openvswitch.c
deleted file mode 100644
index 5b7444b..0000000
--- a/datapath/linux/compat/dev-openvswitch.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef HAVE_DEV_DISABLE_LRO
-
-#include <linux/netdevice.h>
-
-#ifdef NETIF_F_LRO
-#include <linux/ethtool.h>
-
-/**
- *     dev_disable_lro - disable Large Receive Offload on a device
- *     @dev: device
- *
- *     Disable Large Receive Offload (LRO) on a net device.  Must be
- *     called under RTNL.  This is needed if received packets may be
- *     forwarded to another interface.
- */
-void dev_disable_lro(struct net_device *dev)
-{
-       if (dev->ethtool_ops && dev->ethtool_ops->get_flags &&
-           dev->ethtool_ops->set_flags) {
-               u32 flags = dev->ethtool_ops->get_flags(dev);
-               if (flags & ETH_FLAG_LRO) {
-                       flags &= ~ETH_FLAG_LRO;
-                       dev->ethtool_ops->set_flags(dev, flags);
-               }
-       }
-       WARN_ON(dev->features & NETIF_F_LRO);
-}
-#else
-void dev_disable_lro(struct net_device *dev) { }
-#endif /* NETIF_F_LRO */
-
-#endif /* HAVE_DEV_DISABLE_LRO */
diff --git a/datapath/linux/compat/include/linux/netdevice.h 
b/datapath/linux/compat/include/linux/netdevice.h
index 04ebd89..3226653 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -73,10 +73,6 @@ extern void unregister_netdevice_queue(struct net_device 
*dev,
 extern void unregister_netdevice_many(struct list_head *head);
 #endif
 
-#ifndef HAVE_DEV_DISABLE_LRO
-extern void dev_disable_lro(struct net_device *dev);
-#endif
-
 /* Linux 2.6.28 introduced dev_get_stats():
  * const struct net_device_stats *dev_get_stats(struct net_device *dev);
  *
diff --git a/datapath/linux/compat/include/linux/skbuff.h 
b/datapath/linux/compat/include/linux/skbuff.h
index b728c51..44cdcd5 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -205,29 +205,6 @@ static inline struct sk_buff *skb_gso_segment(struct 
sk_buff *skb,
 }
 #endif /* before 2.6.18 */
 
-#ifndef HAVE_SKB_WARN_LRO
-#ifndef NETIF_F_LRO
-static inline bool skb_warn_if_lro(const struct sk_buff *skb)
-{
-       return false;
-}
-#else
-extern void __skb_warn_lro_forwarding(const struct sk_buff *skb);
-
-static inline bool skb_warn_if_lro(const struct sk_buff *skb)
-{
-       /* LRO sets gso_size but not gso_type, whereas if GSO is really
-        * wanted then gso_type will be set. */
-       struct skb_shared_info *shinfo = skb_shinfo(skb);
-       if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) {
-               __skb_warn_lro_forwarding(skb);
-               return true;
-       }
-       return false;
-}
-#endif /* NETIF_F_LRO */
-#endif /* HAVE_SKB_WARN_LRO */
-
 #ifndef HAVE_CONSUME_SKB
 #define consume_skb kfree_skb
 #endif
diff --git a/datapath/linux/compat/skbuff-openvswitch.c 
b/datapath/linux/compat/skbuff-openvswitch.c
deleted file mode 100644
index ef43ba9..0000000
--- a/datapath/linux/compat/skbuff-openvswitch.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#if !defined(HAVE_SKB_WARN_LRO) && defined(NETIF_F_LRO)
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/netdevice.h>
-
-void __skb_warn_lro_forwarding(const struct sk_buff *skb)
-{
-       if (net_ratelimit())
-               pr_warn("%s: received packets cannot be forwarded while LRO is 
enabled\n",
-                       skb->dev->name);
-}
-
-#endif
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 3239135..d95d63c 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -158,7 +158,6 @@ static struct vport *netdev_create(const struct vport_parms 
*parms)
                goto error_put;
 
        dev_set_promiscuity(netdev_vport->dev, 1);
-       dev_disable_lro(netdev_vport->dev);
        netdev_vport->dev->priv_flags |= IFF_OVS_DATAPATH;
 
        return vport;
@@ -281,8 +280,6 @@ static void netdev_port_receive(struct vport *vport, struct 
sk_buff *skb)
        if (unlikely(!skb))
                return;
 
-       skb_warn_if_lro(skb);
-
        skb_push(skb, ETH_HLEN);
 
        if (unlikely(compute_ip_summed(skb, false))) {
diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 0f6a140..0b92fd4 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -60,6 +60,11 @@ enum { LRU_MAX_PORTS = 1024 };
 enum { LRU_MASK = LRU_MAX_PORTS - 1};
 BUILD_ASSERT_DECL(IS_POW2(LRU_MAX_PORTS));
 
+
+/* This ethtool flag was introduced in Linux 2.6.24, so it might be
+ * missing if we have old headers. */
+#define ETH_FLAG_LRO      (1 << 15)    /* LRO is enabled */
+
 struct dpif_linux_dp {
     /* Generic Netlink header. */
     uint8_t cmd;
@@ -381,6 +386,10 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev 
*netdev,
         request.options_len = options->size;
     }
 
+    if (request.type == ODP_VPORT_TYPE_NETDEV) {
+        netdev_linux_ethtool_set_flag(netdev, ETH_FLAG_LRO, false);
+    }
+
     /* Loop until we find a port that isn't used. */
     do {
         request.port_no = dpif_linux_pop_port(dpif);
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to