Skip to content

Commit

Permalink
net: cdc_ncm: reduce skb truesize in rx path
Browse files Browse the repository at this point in the history
Cloning the big skbs we use for USB buffering chokes up TCP and
SCTP because the socket memory limits are hitting earlier than
they should. It is better to unconditionally copy the unwrapped
packets to freshly allocated skbs.

Reported-by: Jim Baxter <jim_baxter@mentor.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
bmork authored and davem330 committed Jun 2, 2014
1 parent e289fd2 commit 1e2c611
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/usb/cdc_ncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,12 +1289,11 @@ int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
break;

} else {
skb = skb_clone(skb_in, GFP_ATOMIC);
/* create a fresh copy to reduce truesize */
skb = netdev_alloc_skb_ip_align(dev->net, len);
if (!skb)
goto error;
skb->len = len;
skb->data = ((u8 *)skb_in->data) + offset;
skb_set_tail_pointer(skb, len);
memcpy(skb_put(skb, len), skb_in->data + offset, len);
usbnet_skb_return(dev, skb);
payload += len; /* count payload bytes in this NTB */
}
Expand Down

0 comments on commit 1e2c611

Please sign in to comment.