Re: changing usbnet's API to better deal with cdc-ncm

Eric Dumazet
2012-09-06T09:11:37Z

On Thu, 2012-09-06 at 10:50 +0200, Oliver Neukum wrote:
> On Thursday 06 September 2012 10:13:01 Alexey ORISHKO wrote:

> > Rx path:
> > 4. IP packets are cloned to separate skb and length of actual data
> set to eth packet size, while skb size is still the same as skb
> containing full NTB frame. This causes problems with TCP stack when
> throughput is high because of flow control in the stack, if too much
> data allocated.
> > Someone suggested a patch for it, which was rejected. Anyway, I
> don't think copy data to a new skb would be a nice solution, but
> keeping several clones with size equal to incoming skb in not good
> either.
>
> Perhaps the problem is using an skb for aggregate reception at all.
> Possibly enough buffers of fixed size should be allocated on open and
> reused,
> not freed.

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...