Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3676077rdb; Wed, 13 Sep 2023 21:47:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7hL5LwF4TM+VMvbHzce/liAoOOufoxMT7LOXinKepsewM0wjGcHmtw0A6iJ9EgnEgnPAo X-Received: by 2002:a05:6a00:a1b:b0:68f:ecb9:5fde with SMTP id p27-20020a056a000a1b00b0068fecb95fdemr5114387pfh.34.1694666867192; Wed, 13 Sep 2023 21:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694666867; cv=none; d=google.com; s=arc-20160816; b=IHRbjkzg8aMU7Pjf+dh1piP5EUGl0TRL+Pe0fWFj05cLbuKIYtHVNwL5cyR0D7RATi F5b59gjKdfKQIqKcJ3kO0vKEf7rZCwaIW/Ogno1d44ZjWAhxnOsRLZ4rUl1tV7wZtNZN kJHmxKJd6ynh9Q0tD+7z9WYJ5EKbqMa4NMmsDnO17qaNDZOw7+w48cOh3S6t6dnkghrP eG5gq3gVXEScldBlcbyohVH4rW476mK/qu3TlaFMnRIZFxRxm9uNqvP67it/Pm8nBsL7 bDMKyOUt46kZOt2RPZzLHQsu2oSy3NBrg0cHVuLKThVbPkmAtjvQ5lIfaZZ8DV7WSs1M llLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=02msGTQxTcmeZ+25JGGxV4KBdUgvZweCZla19Aubax8=; fh=lUeqPragUclany5EIpoB88gC1uB0sQSmXi3mHUEuAMs=; b=JcR3cF1oCda5r88Jxj75B0qniPdkzn/KJBsPMtYIc5nWpcBxHBkwoc3zXaJ5AhelLx UJqcQVNm/VI1IHX1hugiy1wu+FFwKZRd0lv77Sm+ZVTG5RkiVqHbToVTFIcHUbcOaQQC 6myR63qj7pYhktjnpacBk8KyZTeNOHd2bSmml6fD7VFfVJekSIHrkQjq0WiQ5MZvZxSj 5xQn3uIl+h/E3oWbJ6u4XWzfm7fjZFgkLEmtzn45yzSDDTa1JfkQ1RWdfExNxMO9WCvX UtcELoKW74KrHP1QEl6U57Xz1EUgvXkwP9xSjVpW6x+a1M2iVtEdcxR0eerAHUlRA/CT 3ppg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LY81LAsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ds4-20020a056a004ac400b006901387b0b3si794561pfb.9.2023.09.13.21.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 21:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LY81LAsQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 5077D82DFD1D; Wed, 13 Sep 2023 13:32:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232406AbjIMUcU (ORCPT + 99 others); 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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 13:32:23 -0700 (PDT) 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