Re: [PATCH 2/2] usb: gadget: f_ncm: add support for scatter/gather SKB to enable GSO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

16.08.2016, 13:56, Felipe Balbi kirjoitti:
> Jussi Kivilinna <jussi.kivilinna@xxxxxxxxxxx> writes:
>>> Jussi Kivilinna <jussi.kivilinna@xxxxxxxxxxx> writes:
>>>> Enabling SG allows enabling GSO (generic segmentation offload) feature
>>>> of linux networking layer. This increases TCP throughput with NCM
>>>> on Cortex-A15+USB3380 based device from 300 Mbit/s to 1.1 Gbit/s.
>>>>
>>>> Signed-off-by: Jussi Kivilinna <jussi.kivilinna@xxxxxxxxxxx>
>>>
>>> this is AWESOME!! :-) But here's the thing, any chance we can build this
>>> in u_ether.c ? Also, NETIF_F_SG should be conditional on
>>> gadget->sg_supported so that we don't break UDCs that don't support
>>> sglists.
>>>
>>
>> Actually, no sglists are passed to UDC. Reason why this work
>> with minimal changes for NCM is that NCM does tx buffering
>> in its wrap function.. 'ncm_wrap_ntb' copies input skbuffs to
>> larger skbuff, so enabling SG is  only matter of changing that
>> skbuff data copy from 'memcpy' to 'skb_copy_bits' (and changing
>> CRC calculation work with skbuff fragments). Since NCM already
>> does copying, SG can be enabled for NCM without extra overhead.
> 
> aha, understood. Now what if we skip copying altogether? If we have an
> sg and a UDC that supports sg (gadget->sg_supported = 1), then we can
> avoid copying, right?

Skip copying might difficult for NCM because buffering, but might work
for other networking gadgets.

> 
>> To see if NETIF_F_SG with skbuff copying made difference with
>> other networking gadgets, I made quick test for RNDIS gadget to
>> enable NETIF_F_SG by adding skb_linearize_cow call to
>> 'rndis_add_header' wrap function. TCP transfer from device to
>> host:
>>  without SG: 265 Mbit/s
>>  with SG:    326 Mbit/s
>>
>> So, adding NETIF_F_SG with skbuff linearization in u_ether
>> could improve performance little bit.
> 
> interesting. Does USB3380 support sglists? We could check how much more
> we get if we skip copying altogether.

SG support net2280.c does not appear to be complete, for example
PIO-mode 'write_fifo' accesses (struct usb_request).buf directly.

Data book reads that USB3380 has Scatter/Gather DMA mode support.
However errata list has two "DMA channel may hang under specific
conditions" problems for rev.AA with workaround: use single DMA
mode instead.

-Jussi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux