Commit 58e998c6 authored by Jesse Gross's avatar Jesse Gross Committed by David S. Miller

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: default avatarJesse Gross <jesse@nicira.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c8d5bcd1
...@@ -2239,6 +2239,8 @@ unsigned long netdev_fix_features(unsigned long features, const char *name); ...@@ -2239,6 +2239,8 @@ unsigned long netdev_fix_features(unsigned long features, const char *name);
void netif_stacked_transfer_operstate(const struct net_device *rootdev, void netif_stacked_transfer_operstate(const struct net_device *rootdev,
struct net_device *dev); struct net_device *dev);
int netif_get_vlan_features(struct sk_buff *skb, struct net_device *dev);
static inline int net_gso_ok(int features, int gso_type) static inline int net_gso_ok(int features, int gso_type)
{ {
int feature = gso_type << NETIF_F_GSO_SHIFT; int feature = gso_type << NETIF_F_GSO_SHIFT;
...@@ -2254,10 +2256,7 @@ static inline int skb_gso_ok(struct sk_buff *skb, int features) ...@@ -2254,10 +2256,7 @@ static inline int skb_gso_ok(struct sk_buff *skb, int features)
static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
{ {
if (skb_is_gso(skb)) { if (skb_is_gso(skb)) {
int features = dev->features; int features = netif_get_vlan_features(skb, dev);
if (skb->protocol == htons(ETH_P_8021Q) || skb->vlan_tci)
features &= dev->vlan_features;
return (!skb_gso_ok(skb, features) || return (!skb_gso_ok(skb, features) ||
unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
......
...@@ -1968,6 +1968,22 @@ static inline void skb_orphan_try(struct sk_buff *skb) ...@@ -1968,6 +1968,22 @@ static inline void skb_orphan_try(struct sk_buff *skb)
} }
} }
int netif_get_vlan_features(struct sk_buff *skb, struct net_device *dev)
{
__be16 protocol = skb->protocol;
if (protocol == htons(ETH_P_8021Q)) {
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
protocol = veh->h_vlan_encapsulated_proto;
} else if (!skb->vlan_tci)
return dev->features;
if (protocol != htons(ETH_P_8021Q))
return dev->features & dev->vlan_features;
else
return 0;
}
/* /*
* Returns true if either: * Returns true if either:
* 1. skb has frag_list and the device doesn't support FRAGLIST, or * 1. skb has frag_list and the device doesn't support FRAGLIST, or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment