Thread (12 messages) 12 messages, 7 authors, 2013-08-01

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

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2013-07-31 12:45:50

On Wed, Jul 31, 2013 at 06:51:49PM +0800, Ming Lei wrote:
This patch enables 'can_dma_sg' flag for ax88179_178a device
if the attached host controller supports building packet from
discontinuous buffers(DMA SG is possible), so both frame header
and skb data buffers can be passed to usb stack via urb->sg,
then skb data copy can be saved.

With the patch, CPU utilization decreased much in iperf test at
client mode.
What is "much"?
quoted hunk ↗ jump to hunk
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1031,12 +1031,20 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
 	dev->mii.phy_id = 0x03;
 	dev->mii.supports_gmii = 1;
 
+	if (dev->udev->bus->no_sg_limit)
+		dev->can_dma_sg = 1;
I don't feel comfortable with USB drivers poking about in the USB host
controller structures like this.  If we really do this, please provide a
function call for it to make to determine this.

But even then, is this really something that we want/need to do at all?
If only some xhci controller support this, we will start to see more
driver-specific changes just to handle one type of host controller.  Why
not have the USB core handle it instead and if the host controller can
not do sg lists like this, fall back to a slower implementation?

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help