From: Eric Dumazet <eric.dumazet@gmail.com>
To: Oliver Neukum <oneukum@suse.de>
Cc: Alexey ORISHKO <alexey.orishko@stericsson.com>,
"bjorn@mork.no" <bjorn@mork.no>, Ming Lei <tom.leiming@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
Alexey Orishko <alexey.orishko@gmail.com>
Subject: Re: changing usbnet's API to better deal with cdc-ncm
Date: Thu, 06 Sep 2012 11:22:16 +0200 [thread overview]
Message-ID: <1346923336.2484.7.camel@edumazet-glaptop> (raw)
In-Reply-To: <1346922697.2484.5.camel@edumazet-glaptop>
On Thu, 2012-09-06 at 11:11 +0200, Eric Dumazet wrote:
> Really skb_clone() use should be removed from cdc_ncm_rx_fixup()
>
> Unless you expect 10Gbit speed from this driver, skb_clone() is the
> worst possible strategy.
>
> Allocating fresh skbs of the right size permits better memory use and
> allows TCP coalescing as well.
>
> The use of skb_clone() forces some parts of the stack to perform a full
> copy anyway.
>
> It's still unclear to me with we use up to 32KB blocks in USB drivers...
>
So I advise testing this patch :
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 4cd582a..c0821f7 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1052,12 +1052,11 @@ static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
break;
} else {
- skb = skb_clone(skb_in, GFP_ATOMIC);
+ 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);
+ skb_put(skb, len);
+ memcpy(skb->data, skb_in->data + offset, len);
usbnet_skb_return(dev, skb);
}
}
next prev parent reply other threads:[~2012-09-06 9:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 20:12 changing usbnet's API to better deal with cdc-ncm Oliver Neukum
[not found] ` <2791550.LhGu6po6Xy-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-06 3:23 ` Ming Lei
[not found] ` <CACVXFVMXz1mqANBYR56KZsh3RgN5M_og_OggDEHT02w0Pe-UiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-06 8:30 ` Bjørn Mork
[not found] ` <87a9x33656.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-09-06 16:09 ` Ming Lei
2012-09-06 17:56 ` Oliver Neukum
[not found] ` <1676538.CEPj2RtrPe-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-07 3:55 ` Ming Lei
2012-09-07 7:35 ` Oliver Neukum
[not found] ` <1446113.XC2Qbo4flT-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-07 12:01 ` Alexey ORISHKO
[not found] ` <2AC7D4AD8BA1C640B4C60C61C8E520154A6AA5741E-8ZTw5gFVCTjVH5byLeRTJxkTb7+GphCuwzqs5ZKRSiY@public.gmane.org>
2012-09-07 13:08 ` Oliver Neukum
2012-09-07 15:23 ` Alexey ORISHKO
[not found] ` <2AC7D4AD8BA1C640B4C60C61C8E520154A6AA5753D-8ZTw5gFVCTjVH5byLeRTJxkTb7+GphCuwzqs5ZKRSiY@public.gmane.org>
2012-09-07 18:23 ` Oliver Neukum
[not found] ` <1609320.M17H7UceTZ-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-10 17:10 ` Alexey ORISHKO
2012-09-06 8:13 ` Alexey ORISHKO
2012-09-06 8:50 ` Oliver Neukum
[not found] ` <6556435.5o3fR8ZcBa-ugxBuEnWX9yG/4A2pS7c2Q@public.gmane.org>
2012-09-06 9:11 ` Eric Dumazet
2012-09-06 9:22 ` Eric Dumazet [this message]
2012-09-07 12:58 ` Ming Lei
2012-09-07 13:10 ` Alexey ORISHKO
2012-09-06 8:17 ` Bjørn Mork
[not found] ` <87ehmf36qd.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-09-07 7:40 ` MBIM (was: Re: changing usbnet's API to better deal with cdc-ncm) Oliver Neukum
2012-09-07 8:53 ` MBIM Bjørn Mork
[not found] ` <87392u1afl.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-09-07 17:02 ` MBIM Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346923336.2484.7.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=alexey.orishko@gmail.com \
--cc=alexey.orishko@stericsson.com \
--cc=bjorn@mork.no \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.de \
--cc=tom.leiming@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox