Jim Baxter <jim_bax...@mentor.com> writes: >> I'll create and test a patch for the cdc_ncm host driver unless someone >> else wants to do that. I haven't really played with the gadget driver >> before, so I'd prefer if someone knowing it (Jim maybe?) could take care >> of it. If not, then I can always make an attempt using dummy_hcd to >> test it. > I can create a patch for the host driver, I will issue the gadget patch > first to resolve any issues, the fix would be similar.
Well, I couldn't help myself. I just had to test it. The attached patch works for me, briefly tested with an Ericsson H5321gw NCM device. I have no ideas about the performance impact as that modem is limited to 21 Mbps HSDPA. Bjørn
>From 4c7431cd046a6972e153e23249ad490a3692f9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bj...@mork.no> Date: Fri, 23 May 2014 09:40:51 +0200 Subject: [RFC] net: cdc_ncm: reduce skb truesize in rx path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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_bax...@mentor.com> Signed-off-by: Bjørn Mork <bj...@mork.no> --- 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; } 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 */ } -- 2.0.0.rc4