aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2011-01-09 01:23:32 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-10 02:35:34 -0500
commitfc741216db156994c554ac31c1151fe0e00d8f0e (patch)
tree692c6278f1c20e4452620adee1ea3cd05d878819
parentf01a5236bd4b140198fbcc550f085e8361fd73fa (diff)
net offloading: Pass features into netif_needs_gso().
Now that there is a single function that can compute the device features relevant to a packet, we don't want to run it for each offload. This converts netif_needs_gso() to take the features of the device, rather than computing them itself. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/xen-netfront.c2
-rw-r--r--include/linux/netdevice.h12
-rw-r--r--net/core/dev.c8
3 files changed, 10 insertions, 12 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index cdbeec9f83ea..546de5749824 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -488,7 +488,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
488 488
489 if (unlikely(!netif_carrier_ok(dev) || 489 if (unlikely(!netif_carrier_ok(dev) ||
490 (frags > 1 && !xennet_can_sg(dev)) || 490 (frags > 1 && !xennet_can_sg(dev)) ||
491 netif_needs_gso(dev, skb))) { 491 netif_needs_gso(skb, netif_skb_features(skb)))) {
492 spin_unlock_irq(&np->tx_lock); 492 spin_unlock_irq(&np->tx_lock);
493 goto drop; 493 goto drop;
494 } 494 }
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d4dac09a5ad2..de2bfe6da359 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2317,16 +2317,10 @@ static inline int skb_gso_ok(struct sk_buff *skb, int features)
2317 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2317 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
2318} 2318}
2319 2319
2320static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 2320static inline int netif_needs_gso(struct sk_buff *skb, int features)
2321{ 2321{
2322 if (skb_is_gso(skb)) { 2322 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
2323 int features = netif_skb_features(skb); 2323 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
2324
2325 return (!skb_gso_ok(skb, features) ||
2326 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
2327 }
2328
2329 return 0;
2330} 2324}
2331 2325
2332static inline void netif_set_gso_max_size(struct net_device *dev, 2326static inline void netif_set_gso_max_size(struct net_device *dev,
diff --git a/net/core/dev.c b/net/core/dev.c
index a51dfd7b56fb..1444ed3861a0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2086,6 +2086,8 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2086 int rc = NETDEV_TX_OK; 2086 int rc = NETDEV_TX_OK;
2087 2087
2088 if (likely(!skb->next)) { 2088 if (likely(!skb->next)) {
2089 int features;
2090
2089 /* 2091 /*
2090 * If device doesnt need skb->dst, release it right now while 2092 * If device doesnt need skb->dst, release it right now while
2091 * its hot in this cpu cache 2093 * its hot in this cpu cache
@@ -2098,8 +2100,10 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2098 2100
2099 skb_orphan_try(skb); 2101 skb_orphan_try(skb);
2100 2102
2103 features = netif_skb_features(skb);
2104
2101 if (vlan_tx_tag_present(skb) && 2105 if (vlan_tx_tag_present(skb) &&
2102 !(dev->features & NETIF_F_HW_VLAN_TX)) { 2106 !(features & NETIF_F_HW_VLAN_TX)) {
2103 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb)); 2107 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
2104 if (unlikely(!skb)) 2108 if (unlikely(!skb))
2105 goto out; 2109 goto out;
@@ -2107,7 +2111,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2107 skb->vlan_tci = 0; 2111 skb->vlan_tci = 0;
2108 } 2112 }
2109 2113
2110 if (netif_needs_gso(dev, skb)) { 2114 if (netif_needs_gso(skb, features)) {
2111 if (unlikely(dev_gso_segment(skb))) 2115 if (unlikely(dev_gso_segment(skb)))
2112 goto out_kfree_skb; 2116 goto out_kfree_skb;
2113 if (skb->next) 2117 if (skb->next)