From: "Bjørn Mork" <bjorn@mork.no>
To: David Miller <davem@davemloft.net>
Cc: eric.dumazet@gmail.com, jim_baxter@mentor.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, kamal@canonical.com,
bhutchings@solarflare.com, edumazet@google.com, mszeredi@suse.cz,
fw@strlen.de
Subject: Re: skbuff truesize incorrect.
Date: Fri, 23 May 2014 09:07:56 +0200 [thread overview]
Message-ID: <87ppj5vupf.fsf@nemi.mork.no> (raw)
In-Reply-To: <20140522.171033.1040508444998374401.davem@davemloft.net> (David Miller's message of "Thu, 22 May 2014 17:10:33 -0400 (EDT)")
David Miller <davem@davemloft.net> writes:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 22 May 2014 14:03:21 -0700
>
>> On Thu, 2014-05-22 at 13:58 -0700, Eric Dumazet wrote:
>>
>>> I would set rx_max (rx_urb_size) to SKB_MAX_HEAD(0) so that you do not
>>> use high order allocations.
>>
>> Correction, that would need SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN),
>> because drivers/net/usb/usbnet.c calls __netdev_alloc_skb_ip_align().
>
> I seem to recall that this driver has a lot of strange buffering
> restrictions and that Bjorn Mork was talking a lot about this
> recently.
Yes, I have been following this discussion with great interest, learning
a lot.
But although the problem is the same, I believe the driver in question
isn't the one I have been looking at recently. The posted code snippet
was from the NCM gadget driver (drivers/usb/gadget/f_ncm.c), isn't that
right Jim?
That driver implements the same protocol with the same inherent issues,
but for the device side. The implementations are independent for
historical reasons. This happened before I started looking at these
things so I don't know exactly why. In an ideal world they should have
shared pretty much everything except setup.
> Bjorn people are getting really burnt because the driver ends up
> having a skb->truesize of 32K for the buffers it allocates on receive
> and this chokes up TCP and SCTP because the socket memory limits
> are hitting earlier than they should.
>
> We've just in the past few postings been discussing whether the just
> copy every packet into a more appropriately sized buffer, and it isn't
> clear if that's a good idea of the data rates handled here.
Yes, judging by this discussion I guess we should unconditionally copy
instead of cloning in these drivers. We'll always have bad
payload/truesize ratio for cloned skbs, often less than 1/10 even for
max size payload.
Actually, I thought we already did copy in the host cdc_ncm driver. But
I was wrong. I was thinking of the cdc_mbim driver (which is different
enough to have its own implementation of this part of the rx code). The
cdc_ncm driver is cloning and the cdc_mbim driver is copying. So we're
not even consistent...
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.
BTW, wrt the data rates: These drivers are USB class drivers and we
should really think of *all* possible rates, even future ones. This is
not limited to 480 Mbps USB2. AFAICS, there isn't anything preventing
the gadget driver from being used with e.g. a USB3380 controller to
create a 5 Gbps NCM device. I'm sure the future will bring us even
faster USB devices. The drivers will be the same. Which is sort of
beautiful and scaring at the same time :-)
But I assume the bad payload/truesize ratio is the most important factor
here, so we should still copy?
Bjørn
next prev parent reply other threads:[~2014-05-23 7:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 19:07 skbuff truesize incorrect Jim Baxter
2014-05-22 19:21 ` David Miller
2014-05-22 20:21 ` Jim Baxter
2014-05-22 20:30 ` Eric Dumazet
2014-05-22 20:58 ` David Miller
2014-05-23 9:21 ` Jim Baxter
2014-05-23 9:27 ` David Laight
2014-05-23 16:46 ` David Miller
2014-05-22 19:25 ` Vlad Yasevich
2014-05-22 19:39 ` Jim Baxter
2014-05-22 19:59 ` Eric Dumazet
2014-05-22 20:21 ` Jim Baxter
2014-05-22 20:58 ` Eric Dumazet
2014-05-22 21:03 ` Eric Dumazet
2014-05-22 21:10 ` David Miller
2014-05-23 7:07 ` Bjørn Mork [this message]
2014-05-23 8:58 ` Jim Baxter
2014-05-23 9:33 ` Bjørn Mork
2014-05-23 14:00 ` Eric Dumazet
2014-05-23 15:44 ` Rick Jones
2014-05-23 16:00 ` Eric Dumazet
2014-05-23 8:52 ` David Laight
2014-05-23 9:48 ` Bjørn Mork
2014-05-23 10:45 ` David Laight
2014-05-23 11:13 ` Jim Baxter
2014-05-23 13:47 ` Eric Dumazet
2014-05-23 15:00 ` Jim Baxter
2014-05-23 15:30 ` David Laight
2014-05-23 15:41 ` Eric Dumazet
2014-05-23 20:18 ` David Miller
2014-05-27 15:23 ` David Laight
2014-05-27 15:52 ` David Miller
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=87ppj5vupf.fsf@nemi.mork.no \
--to=bjorn@mork.no \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=jim_baxter@mentor.com \
--cc=kamal@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mszeredi@suse.cz \
--cc=netdev@vger.kernel.org \
/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