summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/myricom
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-10-20 10:10:03 +0000
committerDavid S. Miller <davem@davemloft.net>2011-10-20 17:04:20 -0400
commit924a4c7d2e962b4e6a8e9ab3aabfd2bb29e5ada9 (patch)
tree5b415d660ba9866304041006ef26ccaf86246c1d /drivers/net/ethernet/myricom
parent7b8b59617ead5acc6ff041a9ad2ea1fe7a58094f (diff)
downloadlinux-924a4c7d2e962b4e6a8e9ab3aabfd2bb29e5ada9.tar.bz2
myri10ge: fix truesize underestimation
skb->truesize must account for allocated memory, not the used part of it. Doing this work is important to avoid unexpected OOM situations. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Jon Mason <mason@myri.com> Acked-by: Jon Mason <mason@myri.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/myricom')
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index c970a48436dc..0778edcf7b9a 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -1210,7 +1210,6 @@ myri10ge_rx_skb_build(struct sk_buff *skb, u8 * va,
struct skb_frag_struct *skb_frags;
skb->len = skb->data_len = len;
- skb->truesize = len + sizeof(struct sk_buff);
/* attach the page(s) */
skb_frags = skb_shinfo(skb)->frags;
@@ -1385,6 +1384,8 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, int len, __wsum csum,
if (skb_frag_size(&skb_shinfo(skb)->frags[0]) <= 0) {
skb_frag_unref(skb, 0);
skb_shinfo(skb)->nr_frags = 0;
+ } else {
+ skb->truesize += bytes * skb_shinfo(skb)->nr_frags;
}
skb->protocol = eth_type_trans(skb, dev);
skb_record_rx_queue(skb, ss - &mgp->ss[0]);