diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-04-07 11:15:50 -0700 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-04-07 11:15:50 -0700 |
commit | 454abcc57f1d48a976291bc4af73b5f087e21d70 (patch) | |
tree | 5bba999ea3f31527da02b60604531cc5fb52ea57 /net/core/dev.c | |
parent | 88aab9341a315d81118be6b41c45e4fe32b94bc1 (diff) | |
parent | 6221f222c0ebf1acdf7abcf927178f40e1a65e2a (diff) | |
download | blackbird-op-linux-454abcc57f1d48a976291bc4af73b5f087e21d70.tar.gz blackbird-op-linux-454abcc57f1d48a976291bc4af73b5f087e21d70.zip |
Merge commit 'v2.6.39-rc2' into spi/merge
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 563ddc28139d..3da9fb06d47a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1454,6 +1454,27 @@ static inline void net_timestamp_check(struct sk_buff *skb) __net_timestamp(skb); } +static inline bool is_skb_forwardable(struct net_device *dev, + struct sk_buff *skb) +{ + unsigned int len; + + if (!(dev->flags & IFF_UP)) + return false; + + len = dev->mtu + dev->hard_header_len + VLAN_HLEN; + if (skb->len <= len) + return true; + + /* if TSO is enabled, we don't care about the length as the packet + * could be forwarded without being segmented before + */ + if (skb_is_gso(skb)) + return true; + + return false; +} + /** * dev_forward_skb - loopback an skb to another netif * @@ -1477,8 +1498,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) skb_orphan(skb); nf_reset(skb); - if (unlikely(!(dev->flags & IFF_UP) || - (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) { + if (unlikely(!is_skb_forwardable(dev, skb))) { atomic_long_inc(&dev->rx_dropped); kfree_skb(skb); return NET_RX_DROP; |