Merge "next" branch into "master".
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / dev-openvswitch.c
1 #include <linux/version.h>
2 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
3
4 #include <linux/netdevice.h>
5
6 #ifndef NETIF_F_LRO
7 void dev_disable_lro(struct net_device *dev) { }
8 #else
9
10 #include <linux/ethtool.h>
11
12 /**
13  *      dev_disable_lro - disable Large Receive Offload on a device
14  *      @dev: device
15  *
16  *      Disable Large Receive Offload (LRO) on a net device.  Must be
17  *      called under RTNL.  This is needed if received packets may be
18  *      forwarded to another interface.
19  */
20 void dev_disable_lro(struct net_device *dev)
21 {
22         if (dev->ethtool_ops && dev->ethtool_ops->get_flags &&
23             dev->ethtool_ops->set_flags) {
24                 u32 flags = dev->ethtool_ops->get_flags(dev);
25                 if (flags & ETH_FLAG_LRO) {
26                         flags &= ~ETH_FLAG_LRO;
27                         dev->ethtool_ops->set_flags(dev, flags);
28                 }
29         }
30         WARN_ON(dev->features & NETIF_F_LRO);
31 }
32
33 #endif /* NETIF_F_LRO */
34
35 #endif /* kernel < 2.6.27 */