aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-10-29 08:14:55 -0400
committerDavid S. Miller <davem@davemloft.net>2010-11-15 12:22:53 -0500
commit58e998c6d23988490162cef0784b19ea274d90bb (patch)
treede3bbb355639d4bd6f2858d6265537672554d13b
parentc8d5bcd1aff89199cde4bd82c5c40fb704c8bba4 (diff)
offloading: Force software GSO for multiple vlan tags.
We currently use vlan_features to check for TSO support if there is a vlan tag. However, it's quite likely that the NIC is not able to do TSO when there is an arbitrary number of tags. Therefore if there is more than one tag (in-band or out-of-band), fall back to software emulation. Signed-off-by: Jesse Gross <jesse@nicira.com> CC: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/netdevice.h7
-rw-r--r--net/core/dev.c16
2 files changed, 19 insertions, 4 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 578debb801f4..6e4cfbc53d4c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2239,6 +2239,8 @@ unsigned long netdev_fix_features(unsigned long features, const char *name);
2239void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2239void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2240 struct net_device *dev); 2240 struct net_device *dev);
2241 2241
2242int netif_get_vlan_features(struct sk_buff *skb, struct net_device *dev);
2243
2242static inline int net_gso_ok(int features, int gso_type) 2244static inline int net_gso_ok(int features, int gso_type)
2243{ 2245{
2244 int feature = gso_type << NETIF_F_GSO_SHIFT; 2246 int feature = gso_type << NETIF_F_GSO_SHIFT;
@@ -2254,10 +2256,7 @@ static inline int skb_gso_ok(struct sk_buff *skb, int features)
2254static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 2256static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
2255{ 2257{
2256 if (skb_is_gso(skb)) { 2258 if (skb_is_gso(skb)) {
2257 int features = dev->features; 2259 int features = netif_get_vlan_features(skb, dev);
2258
2259 if (skb->protocol == htons(ETH_P_8021Q) || skb->vlan_tci)
2260 features &= dev->vlan_features;
2261 2260
2262 return (!skb_gso_ok(skb, features) || 2261 return (!skb_gso_ok(skb, features) ||
2263 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 2262 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
diff --git a/net/core/dev.c b/net/core/dev.c
index 368930a988e3..8b500c3e0297 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1968,6 +1968,22 @@ static inline void skb_orphan_try(struct sk_buff *skb)
1968 } 1968 }
1969} 1969}
1970 1970
1971int netif_get_vlan_features(struct sk_buff *skb, struct net_device *dev)
1972{
1973 __be16 protocol = skb->protocol;
1974
1975 if (protocol == htons(ETH_P_8021Q)) {
1976 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
1977 protocol = veh->h_vlan_encapsulated_proto;
1978 } else if (!skb->vlan_tci)
1979 return dev->features;
1980
1981 if (protocol != htons(ETH_P_8021Q))
1982 return dev->features & dev->vlan_features;
1983 else
1984 return 0;
1985}
1986
1971/* 1987/*
1972 * Returns true if either: 1988 * Returns true if either:
1973 * 1. skb has frag_list and the device doesn't support FRAGLIST, or 1989 * 1. skb has frag_list and the device doesn't support FRAGLIST, or