From: Ming Lei Date: Thu, 8 Aug 2013 13:48:25 +0000 (+0800) Subject: USBNET: ax88179_178a: enable tso if usb host supports sg dma X-Git-Tag: v4.14-rc1~9092^2~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3804fad45411b48233b48003e33a78f290d227c8;p=platform%2Fkernel%2Flinux-rpi.git USBNET: ax88179_178a: enable tso if usb host supports sg dma 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 TSO can be enabled and skb fragment buffers can be passed to usb stack via urb->sg directly. With the patch, system CPU utilization decreased ~50% and throughput increased by ~10% when doing iperf client test on one ARM A15 dual core board. Cc: Ben Hutchings Cc: Grant Grundler Cc: Oliver Neukum Cc: Alan Stern Cc: Freddy Xin Signed-off-by: Ming Lei Acked-by: Eric Dumazet Acked-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 2bc87e3..4233c05 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1028,12 +1028,20 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) dev->mii.phy_id = 0x03; dev->mii.supports_gmii = 1; + if (usb_device_no_sg_constraint(dev->udev)) + dev->can_dma_sg = 1; + dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM; + if (dev->can_dma_sg) { + dev->net->features |= NETIF_F_SG | NETIF_F_TSO; + dev->net->hw_features |= NETIF_F_SG | NETIF_F_TSO; + } + /* Enable checksum offload */ *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6;