mirror of
https://github.com/openvswitch/ovs
synced 2025-10-17 14:28:02 +00:00
LRO can play fast and loose with the packets that it merges, which isn't very polite when you are bridging packets for other operating systems. This disables LRO on any underlying devices that are added to the datapath, which is the same as what the bridge does. Note that this does not disable GRO, which has a more strict set of rules about what is merged and is therefore safe for bridging. Both are typically done in software anyways.
36 lines
857 B
C
36 lines
857 B
C
#include <linux/version.h>
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#ifndef NETIF_F_LRO
|
|
void dev_disable_lro(struct net_device *dev) { }
|
|
#else
|
|
|
|
#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);
|
|
}
|
|
|
|
#endif /* NETIF_F_LRO */
|
|
|
|
#endif /* kernel < 2.6.27 */
|