lkml.org 
[lkml]   [2019]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usbip: Implement map_urb_for_dma function for vhci to skip dma mapping
Date
vhci doesn’t do dma for remote device. Actually, the real dma
operation is done by network card driver. So, vhci doesn’t use and
need dma address of transfer buffer of urb.

But hcd provides dma mapping function by defualt in usb_hcd_submit_urb()
and it causes unnecessary dma mapping which will be done again at
NIC driver and it wastes CPU cycles. So, implement map_urb_for_dma
function for vhci in order to skip the dma mapping procedure.

Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
---
drivers/usb/usbip/vhci_hcd.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index 667d9c0ec905..9df4d9e36788 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -1287,6 +1287,13 @@ static int vhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev,
return 0;
}

+static int vhci_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
+ gfp_t mem_flags)
+{
+ dev_dbg(hcd->self.controller, "vhci does not map urb for dma\n");
+ return 0;
+}
+
static const struct hc_driver vhci_hc_driver = {
.description = driver_name,
.product_desc = driver_desc,
@@ -1302,6 +1309,7 @@ static const struct hc_driver vhci_hc_driver = {
.urb_dequeue = vhci_urb_dequeue,

.get_frame_number = vhci_get_frame_number,
+ .map_urb_for_dma = vhci_map_urb_for_dma,

.hub_status_data = vhci_hub_status,
.hub_control = vhci_hub_control,
--
2.20.1
\
 
 \ /
  Last update: 2019-06-18 16:29    [W:0.038 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site