Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3915168ybi; Tue, 18 Jun 2019 08:31:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTEM9UWA/ICeXauV7khYCiogqC6TCMhy60CGxeGGrmEzhlhLCsCOskiNHNWO7xurIvgoJ9 X-Received: by 2002:a17:902:903:: with SMTP id 3mr89783699plm.281.1560871879391; Tue, 18 Jun 2019 08:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560871879; cv=none; d=google.com; s=arc-20160816; b=CQgAveGJ4kzv4pSINgcghbztXzYdod/CQZxcr9UnmNNojB6D9LsFOM7X042+IYgaE1 8v8F19Lzb28nZ/7BxunVyBv5lLe2rYJ82mR31cLNNt/ueslF528VVT5PH/JM7X0/5ngI hiNYwnpDzqcP06VnEKDfzBhud09k0zh3vT+/Jhc7Sg/qpyJDlAEp+Nzb9ZomyRRo6in0 +wY37WFZyL5nob3okkLncjBoXp97b7Gd3ixmXHmGxKYTQ6ye7t8dteKs1Yg57yA2Bxlx J0daUrpG8Fb/3cgZLOUs9kstCKCIiPwkjU4yIP1hiPtz8LHWsn3hTKEIzzT3eAGPZLa3 7ulQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:in-reply-to:subject:cc:to:from:date; bh=ElQZvlElov4BeEsgY9mvfsDRursAZWQGBuuqGmybLho=; b=fMFg93cPtq8YJQicXmQx5rAJf3oCTGd5wUvKK4FAmgie2ULUuqpo6QPBfMkjaivlt0 EHUqDf47a8c+Qcn+MW+x+FwkL5rcSFwY61yru1caZPVmxcDStieR0iGu60YmpcRFHCTR 3PZzg7GNctAuCQUYLtqE5mRtIoStgKb/cDty0cwwXxDQDKiEJL1lbqJClpFJW6Etts8u 3cy4gEPKjdu8m2fJ6Jdl+vrxU7cL4N0FSw2pQT8ShFojet3GC3eXzRcfm85oJBTyAj4r 58Tp2x+rQvOx9Hiomz93xrf1KpqU6AEXFvZUaylCAuZrPNQfrQwsdb0qGMX+RwatD4go ZyHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si466956pgi.236.2019.06.18.08.31.02; Tue, 18 Jun 2019 08:31:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729608AbfFRPaf (ORCPT + 99 others); Tue, 18 Jun 2019 11:30:35 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:40204 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1729209AbfFRPaf (ORCPT ); Tue, 18 Jun 2019 11:30:35 -0400 Received: (qmail 5734 invoked by uid 2102); 18 Jun 2019 11:30:34 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 18 Jun 2019 11:30:34 -0400 Date: Tue, 18 Jun 2019 11:30:34 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Suwan Kim cc: shuah@kernel.org, , , , Subject: Re: [PATCH] usbip: Implement map_urb_for_dma function for vhci to skip dma mapping In-Reply-To: <20190618142817.16844-1-suwan.kim027@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Jun 2019, Suwan Kim wrote: > 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 > --- > 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, If the goal is to avoid wasting CPU cycles, you probably should have a vhci_unmap_urb_for_dma routine as well. Alan Stern