diff options
author | Jim Baxter <jim_baxter@mentor.com> | 2014-07-07 19:33:19 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-07-10 15:49:39 +0200 |
commit | 66847062a6e33fa54b98714c7c954353e2596645 (patch) | |
tree | 6de2759b3523e2f3607c1a8071148d6e0d31d099 /drivers/usb | |
parent | usb: gadget: NCM: Add transmit multi-frame. (diff) | |
download | linux-66847062a6e33fa54b98714c7c954353e2596645.tar.xz linux-66847062a6e33fa54b98714c7c954353e2596645.zip |
usb: gadget: NCM: Stop RX TCP Bursts getting dropped.
This fixes a problem with dropped packets over 16k CDC-NCM
when the connection is being heavily used.
The issue was that the extracted frames cloned from the
received frame were consuming more memory than necessary
resulting in the truesize being ~32KB instead of ~2KB, this
meant there was a high chance of reaching the sk_rcvbuf
limit.
Signed-off-by: Jim Baxter <jim_baxter@mentor.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/f_ncm.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c index 5452fb663762..bcdc882cd415 100644 --- a/drivers/usb/gadget/f_ncm.c +++ b/drivers/usb/gadget/f_ncm.c @@ -1229,16 +1229,17 @@ static int ncm_unwrap_ntb(struct gether *port, index2 = get_ncm(&tmp, opts->dgram_item_len); dg_len2 = get_ncm(&tmp, opts->dgram_item_len); - skb2 = skb_clone(skb, GFP_ATOMIC); + /* + * Copy the data into a new skb. + * This ensures the truesize is correct + */ + skb2 = netdev_alloc_skb_ip_align(ncm->netdev, + dg_len - crc_len); if (skb2 == NULL) goto err; + memcpy(skb_put(skb2, dg_len - crc_len), + skb->data + index, dg_len - crc_len); - if (!skb_pull(skb2, index)) { - ret = -EOVERFLOW; - goto err; - } - - skb_trim(skb2, dg_len - crc_len); skb_queue_tail(list, skb2); ndp_len -= 2 * (opts->dgram_item_len * 2); |