From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58B7CEE020B for ; Wed, 13 Sep 2023 20:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232101AbjIMUcU (ORCPT ); Wed, 13 Sep 2023 16:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230020AbjIMUcT (ORCPT ); Wed, 13 Sep 2023 16:32:19 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B6C31BC6; Wed, 13 Sep 2023 13:32:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31378C433C7; Wed, 13 Sep 2023 20:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694637135; bh=uY+EB846F61CVw8N9dFpG1XQqtaFWYaybWPzlomSKaQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LY81LAsQEBg6NW9vY0d0R/w4li29m0xY3wqU138w79z3CSIUdMNBVdR6CcFMiyjps E7/koIxPZyApqe4VL+Tq6A3IXGxVkyCmD5qXh4FvuVe1HEN67xx+2ZVJFahzFMeyV9 fYhxUhF/UADPH1lOeEq4t7BCl6+bRjOdZs2qaGcY= Date: Wed, 13 Sep 2023 22:32:12 +0200 From: Greg KH To: Randy Li Cc: linux-usb@vger.kernel.org, Linux Media Mailing List , linux-kernel@vger.kernel.org, corbet@lwn.net, linux-doc@vger.kernel.org Subject: Re: USB: DMA: mapping existing buffer is not supported? Message-ID: <2023091306-affection-lifter-3d9d@gregkh> References: <1e783efe-8659-8be1-82b7-15186302e88c@soulik.info> <2023091323-trombone-storeroom-cbd3@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Thu, Sep 14, 2023 at 04:09:06AM +0800, Randy Li wrote: > > On 2023/9/14 03:19, Greg KH wrote: > > On Thu, Sep 14, 2023 at 03:06:58AM +0800, Randy Li wrote: > > > Hello > > > > > > I was trying to understand why USB webcams (UVC) have to copy video data > > > through the CPU (uvc_video_complete() schedules uvc_video_copy_data_work() > > > for this purpose). During my investigation, I noticed that functions > > > like|usb_sg_*() and |usb_buffer_*() are not available since kernel version > > > 2.6.12. > > What do you mean by "not available"? I see them in the tree today, why > > do you think they are not present? > > > usb_buffer_dmasync_sg(), usb_buffer_map(), usb_buffer_dmasync() and usb_buffer_unmap() are all disabled > by #if 0 in include/usb/usb.h > > usb_buffer_map_sg() and usb_buffer_unmap_sg() are just declaration without definition. Sorry, I was looking at the usb_sg_* calls, those are there if you want to use them. But again, why not just use the normal sg field in the urb itself for the scatter-gather pointer? Will that not work for you? > > > If the USB subsystem can no longer work with existing buffers, I propose > > > that we consider removing the remaining documentation in the "Working with > > > existing buffers" section of Documentation/driver-api/usb/dma.rst. > > I don't understand, what is wrong with the information there exactly? > > Have you tried following the suggestions there? > Besides my answer to first question, I found no code use them today. The old-style usb-storage driver uses the usb_sg_* calls, and the uas.c driver uses the sg fields and provides line-speed transfers (the speed limit is in the device, not the kernel). thanks, greg k-h