[RFC] net: cdc_ncm: reduce skb truesize in rx path

From: =3D?UTF-8?q?Bj=3DC3=3DB8rn=3D20Mork?=3D
Date: Fri May 23 2014 - 03:40:51 EST


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@xxxxxxxxxx>
Signed-off-by: Bj=C3=B8rn Mork <bjorn@xxxxxxx>
---
drivers/net/usb/cdc_ncm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 93c9ca9924eb..2bbbd65591c7 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1289,12 +1289,11 @@ next_ndp:
break;
=20
} else {
- skb =3D skb_clone(skb_in, GFP_ATOMIC);
+ /* create a fresh copy to reduce truesize */
+ skb =3D netdev_alloc_skb_ip_align(dev->net, len);
if (!skb)
goto error;
- skb->len =3D len;
- skb->data =3D ((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 +=3D len; /* count payload bytes in this NTB */
}
--=20
2.0.0.rc4


--=-=-=--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/