summaryrefslogtreecommitdiff
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2010-06-02 12:24:37 +0000
committerDavid S. Miller <davem@davemloft.net>2010-06-05 02:23:16 -0700
commitb78462ebc6a4ef9074aa80abebcdd470dc5f0ce0 (patch)
treefba32dab1e3dca2c5bb5b7d73a64a77c2b6872e8 /include/linux/skbuff.h
parent55c95e738da85373965cb03b4f975d0fd559865b (diff)
downloadlwn-b78462ebc6a4ef9074aa80abebcdd470dc5f0ce0.tar.gz
lwn-b78462ebc6a4ef9074aa80abebcdd470dc5f0ce0.zip
skbuff: add check for non-linear to warn_if_lro and needs_linearize
We can avoid an unecessary cache miss by checking if the skb is non-linear before accessing gso_size/gso_type in skb_warn_if_lro, the same can also be done to avoid a cache miss on nr_frags if data_len is 0. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bf243fc54959..645e78d395fd 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2129,7 +2129,8 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb)
/* LRO sets gso_size but not gso_type, whereas if GSO is really
* wanted then gso_type will be set. */
struct skb_shared_info *shinfo = skb_shinfo(skb);
- if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) {
+ if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 &&
+ unlikely(shinfo->gso_type == 0)) {
__skb_warn_lro_forwarding(skb);
return true;
}