diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-06-19 19:15:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-19 19:15:47 -0400 |
commit | 0187bdfb05674147774ca79a79942537f3ad54bd (patch) | |
tree | 43980261ce9e2b6ef76356dbbbc7efe3dbb60a02 /net/core/dev.c | |
parent | 2e3216cd54b142ba605e87522e15f42e0c4e3996 (diff) |
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>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index a495f712d38c..f6944ecd5b2e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -90,6 +90,7 @@ | |||
90 | #include <linux/if_ether.h> | 90 | #include <linux/if_ether.h> |
91 | #include <linux/netdevice.h> | 91 | #include <linux/netdevice.h> |
92 | #include <linux/etherdevice.h> | 92 | #include <linux/etherdevice.h> |
93 | #include <linux/ethtool.h> | ||
93 | #include <linux/notifier.h> | 94 | #include <linux/notifier.h> |
94 | #include <linux/skbuff.h> | 95 | #include <linux/skbuff.h> |
95 | #include <net/net_namespace.h> | 96 | #include <net/net_namespace.h> |
@@ -1123,6 +1124,29 @@ int dev_close(struct net_device *dev) | |||
1123 | } | 1124 | } |
1124 | 1125 | ||
1125 | 1126 | ||
1127 | /** | ||
1128 | * dev_disable_lro - disable Large Receive Offload on a device | ||
1129 | * @dev: device | ||
1130 | * | ||
1131 | * Disable Large Receive Offload (LRO) on a net device. Must be | ||
1132 | * called under RTNL. This is needed if received packets may be | ||
1133 | * forwarded to another interface. | ||
1134 | */ | ||
1135 | void dev_disable_lro(struct net_device *dev) | ||
1136 | { | ||
1137 | if (dev->ethtool_ops && dev->ethtool_ops->get_flags && | ||
1138 | dev->ethtool_ops->set_flags) { | ||
1139 | u32 flags = dev->ethtool_ops->get_flags(dev); | ||
1140 | if (flags & ETH_FLAG_LRO) { | ||
1141 | flags &= ~ETH_FLAG_LRO; | ||
1142 | dev->ethtool_ops->set_flags(dev, flags); | ||
1143 | } | ||
1144 | } | ||
1145 | WARN_ON(dev->features & NETIF_F_LRO); | ||
1146 | } | ||
1147 | EXPORT_SYMBOL(dev_disable_lro); | ||
1148 | |||
1149 | |||
1126 | static int dev_boot_phase = 1; | 1150 | static int dev_boot_phase = 1; |
1127 | 1151 | ||
1128 | /* | 1152 | /* |