summaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-10-20 13:56:04 +0000
committerDavid S. Miller <davem@davemloft.net>2010-10-21 01:26:52 -0700
commit7b9c60903714bf0a19d746b228864bad3497284e (patch)
treec9dd632ea640b1f56634de8a1f029dd88dea2599 /include/linux/netdevice.h
parenteab6d18d20fc5b5ba04a7e7fcd6f357197870e51 (diff)
downloadop-kernel-dev-7b9c60903714bf0a19d746b228864bad3497284e.zip
op-kernel-dev-7b9c60903714bf0a19d746b228864bad3497284e.tar.gz
vlan: Enable software emulation for vlan accleration.
Currently users of hardware vlan accleration need to know whether the device supports it before generating packets. However, vlan acceleration will soon be available in a more flexible manner so knowing ahead of time becomes much more difficult. This adds a software fallback path for vlan packets on devices without the necessary offloading support, similar to other types of hardware accleration. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 880d565..2861565 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2248,9 +2248,17 @@ 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)
{
- return skb_is_gso(skb) &&
- (!skb_gso_ok(skb, dev->features) ||
- unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
+ if (skb_is_gso(skb)) {
+ int features = dev->features;
+
+ if (skb->protocol == htons(ETH_P_8021Q) || skb->vlan_tci)
+ features &= dev->vlan_features;
+
+ return (!skb_gso_ok(skb, features) ||
+ unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
+ }
+
+ return 0;
}
static inline void netif_set_gso_max_size(struct net_device *dev,
OpenPOWER on IntegriCloud