net: Disable LRO on devices that are forwarding
Large Receive Offload (LRO) is only appropriate for packets that are destined for the host, and should be disabled if received packets may be forwarded. It can also confuse the GSO on output. Add dev_disable_lro() function which uses the appropriate ethtool ops to disable LRO if enabled. Add calls to dev_disable_lro() in br_add_if() and functions that enable IPv4 and IPv6 forwarding. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
2e3216cd54
commit
0187bdfb05
@@ -90,6 +90,7 @@
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/net_namespace.h>
|
||||
@@ -1123,6 +1124,29 @@ int dev_close(struct net_device *dev)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
EXPORT_SYMBOL(dev_disable_lro);
|
||||
|
||||
|
||||
static int dev_boot_phase = 1;
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user