Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: cdns3: improve handling of unaligned address case

When the address of a request was not aligned with an 8-byte boundary, the
USB DMA was unable to process it, necessitating the use of an internal
bounce buffer.

In these cases, the request->buf had to be copied to/from this bounce
buffer. However, if this unaligned address scenario arises, it is
unnecessary to perform heavy cache maintenance operations like
usb_gadget_map(unmap)_request_by_dev() on the request->buf, as the DMA
does not utilize it at all. it can be skipped at this case.

iperf3 tests on the rndis case:

Transmit speed (TX): Improved from 299Mbps to 440Mbps
Receive speed (RX): Improved from 290Mbps to 500Mbps

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20230518204947.3770236-1-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Frank Li and committed by
Greg Kroah-Hartman
2a1c4639 bfb46b42

+7 -4
+7 -4
drivers/usb/cdns3/cdns3-gadget.c
··· 800 800 if (request->status == -EINPROGRESS) 801 801 request->status = status; 802 802 803 - usb_gadget_unmap_request_by_dev(priv_dev->sysdev, request, 803 + if (likely(!(priv_req->flags & REQUEST_UNALIGNED))) 804 + usb_gadget_unmap_request_by_dev(priv_dev->sysdev, request, 804 805 priv_ep->dir); 805 806 806 807 if ((priv_req->flags & REQUEST_UNALIGNED) && ··· 2531 2530 if (ret < 0) 2532 2531 return ret; 2533 2532 2534 - ret = usb_gadget_map_request_by_dev(priv_dev->sysdev, request, 2533 + if (likely(!(priv_req->flags & REQUEST_UNALIGNED))) { 2534 + ret = usb_gadget_map_request_by_dev(priv_dev->sysdev, request, 2535 2535 usb_endpoint_dir_in(ep->desc)); 2536 - if (ret) 2537 - return ret; 2536 + if (ret) 2537 + return ret; 2538 + } 2538 2539 2539 2540 list_add_tail(&request->list, &priv_ep->deferred_req_list); 2540 2541