Re: [PATCH 4/4] USBNET: ax88179_178a: enable tso if host supports sg dma

Eric Dumazet
2013-07-31T15:15:11Z

On Wed, 2013-07-31 at 16:02 +0200, Oliver Neukum wrote:
> On Wed, 2013-07-31 at 21:50 +0800, Ming Lei wrote:
>
> > In the usbnet case, the driver already supports non-sg well. Actually,
> > all current drivers should support non-sg well because urb->sg wasn't
> > introduced for very long time. We can think it as a new feature or DMA
> > enhancement for xHCI controller.
> >
> > If you mean buffer debounce for dma sg support on ehci/uhci/ohci/..,
> > maybe we need to discuss and evaluate further.
>
> We cannot lie to the networking layer. Either we can do sg in hardware
> or we cannot. This is unfortunately determined by the HC not the device
> on the bus. How else but from the host driver would we get the
> information?
>

Hmm, I would rather make sure SG is really supported before adding TSO
support.

TCP stack can build skb with fragments of any size, not multiple
of 512 or 1024 bytes.

commit 20f0170377264e8449b6987041f0bcc4d746d3ed

usbnet: do not pretend to support SG/TSO

usbnet doesn't support yet SG, so drivers should not advertise SG or TSO
capabilities, as they allow TCP stack to build large TSO packets that
need to be linearized and might use order-5 pages.

This adds an extra copy overhead and possible allocation failures.

Current code ignore skb_linearize() return code so crashes are even
possible.

Best is to not pretend SG/TSO is supported, and add this again when/if
usbnet really supports SG for devices who could get a performance gain.

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