Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp124178lqb; Tue, 28 May 2024 10:30:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwkwHmuYoi7bB9ASXq+B8GGqdC45gFU1kuEJ/UCHm8RtGaoWDN3t8rP9CxX5nhOPjGuYWlGj8Ti7Wc2kd9t+z2sfj+iyXEv9zJh7/8FQ== X-Google-Smtp-Source: AGHT+IG1Uba8ZY6VlNTmNVs+s/iQUgsKCeLDtPJJB8nrHDs77wv0KXjaufAMkkSZd4gYv276hxU9 X-Received: by 2002:a05:620a:1a1f:b0:790:a3ce:a761 with SMTP id af79cd13be357-794aa7c4f84mr2565933985a.2.1716917445431; Tue, 28 May 2024 10:30:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716917445; cv=pass; d=google.com; s=arc-20160816; b=zKdQ/xAKxyi9LtIqaMuz9v53RgqREHPz67numAAFcrBrI984I3jlzHVjPDuJfy5hIJ Ipi44ASGB8MGDsS66RI4emyWODnGDICAfqDwySARxXbo1xSNwLpucFe4czGUSBLVGkOz X1Y1UeWCgQN5BNixX+pv1agrACX++v4CfeJLmNQhntBCV1FLhcbGBC7P+TG5iF0uWoPh csHZnl3EDepafpycFGNQnMTCN6B8onZ2nvt6pZhrwDQu1lfWzpbsEOWQqYcMd/Y4Kno6 iN9BNNa0wN0aD4RQKAflHOJZUM8zrf5mmYt+pgbZW89MNfXCu5zMPLy0A6k1Nm1up1AU gYCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=5NMJAa0oCy+b2YV+284BegcExfEuoJFA55q3jP4zsXs=; fh=1EMmVAB9A8EHGtkddnqu1vx7vNGB8ehURzsjZOCbv0Q=; b=XyD4eJ1lu+SR6LDtjGc3wZoFmZVrl9DpoS9EAlMSg8PXOfaFt3DObWiKe0PidoqKlD ehH9cc8BRut4psVcSKbN/LZHVGTmkww1QIjzG2Ulx+gsuOh/tgfwiHjxQmthcxAD6ILg YpZI0eEmBTqOuPJgLqr9K8OFw6ko+1HgTKzmQM1FOPFPn+23nqQqVZ3UtWwiuTs/MHMq 4XieWnGrdxqsSkGo9C2GmF2f17hIteRBST6vJ2K42sLY3VhCmUovkDNySYPrGr4LZ/jT mKj8obtXzfQnnft5bqSCDxPhw64xnrIFK88IYoWeXp7oZC3Zu0GP18EkaTFPlNHiyuUZ 2bsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TdpnJJ5j; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-192808-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192808-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794d11274cdsi223550185a.452.2024.05.28.10.30.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 10:30:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192808-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TdpnJJ5j; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-192808-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192808-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1D77C1C22CC1 for ; Tue, 28 May 2024 17:30:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED1C02563; Tue, 28 May 2024 17:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TdpnJJ5j" Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DAE917E8E6 for ; Tue, 28 May 2024 17:30:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716917435; cv=none; b=nB3uFdorIK7ayk2IqFGyV8/Z0isDs592yvWXvnqJ1AbpVLPXsHB713maXutRZDSOU+J/RTo7cS9ioJVYZq47FQbm8CQu5tY70yeqm7ramBPQBcqIcu+Wu5J+3ex/+u47Vmjm8Jnf7RKXcRCkBhMRULJBRk8YEHpP+NWj9KtVvVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716917435; c=relaxed/simple; bh=KGx/wumGhf3qNCMf0kJPQWaWTf0TglZC8EptQFFR77k=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=s5QRyx5zZfE0mhtc22qz98k9ZnjqaMdIiile/YhXedrb6bz/R27fSGE39WFHQdE8+jdIfcplzMzxOOzJ5ikZmSa8Fk+Arj7QfdK8I4J396A/9t/AS1OjzQXLewY/IQYUeRLFW/k0zceXN0J+uEFGPVRUtDipZkCTUl070BvQg5Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TdpnJJ5j; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1f4a5344ec7so212205ad.1 for ; Tue, 28 May 2024 10:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1716917433; x=1717522233; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=5NMJAa0oCy+b2YV+284BegcExfEuoJFA55q3jP4zsXs=; b=TdpnJJ5jFN1YU3Cw8HZclIISR9eS9E7QMt5Zj4eMJInCBy22fhFQDpIBySCQ8kKqRK 5j/rduumOg1PJstf0mIF5NL5PMmKoyWWtHaeMnkDznOxjzbz5ppGdeHyvtkCmRuHcIFE 93ANWIErPyzh4iUy+cwzDhSUTvXsfO+AISBf2YBmgxYzrGQUjnYuRsIuBvxW8+7GAyGP vPenHAL67MU3ceNq6vcUP3vEuIrT7w1wKOHfjOyGr+E6s52u6YxHcGM5kXj5aO9oUZtn b28mTreIVlHDwSFReqlz0GM3abvS09NEwe27eakrIXBmT1hvW6wTJIL6CslOK9AEh0mI p/nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716917433; x=1717522233; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5NMJAa0oCy+b2YV+284BegcExfEuoJFA55q3jP4zsXs=; b=alaQNwhs82I2JI2W7ulVC+RIC2K3epQULjTTaPf3eRSU5sSN2YNomqHhRNoCiGTn2z 5bBd0JsVBsgPh1gKtnY0SoR1f84/DwEjMjNQVzqghlqiVUOTTEWkwrrk07s0k3D4Wcph auRSgKLZkdGO/a1dlbAIn8biFbSAm3esGEDP1T+tdDaMnDwaCEMFQO8MVtBRN+S2wq+V M2hINoiylfWXKlzQdKLFE+h8TvYAu9OVzdnxlTg377NKYWoFb9U35u/SJc7GTGSyQqU+ rrPAVv+TVVOVFIdYljRGUmKgSAci3aWxKsgftaFHp6dALf4Wk9Ib5r5Sx48NEPzuynIK Hc8Q== X-Forwarded-Encrypted: i=1; AJvYcCV2LmicMzPzeSUCsbK4NNbtPj14DK59dueWbJMGfXD6GO9fxeTehKDDH4iHTueGB9WyF8kUPyW2D+QM2Vr1FVGnCthyNagavUpQrfWA X-Gm-Message-State: AOJu0Yyg3nojLQaRpUlMZDQa+uVMNIgVhwzhL6IeHtqk3zpRHz6vnYo+ blan7GQiPYxPKNZDbvrysrCrYtEaN5NRD84/dUXbPKzdmEeZOvArIuZvCxXrRQ== X-Received: by 2002:a17:902:d505:b0:1f4:58c6:d5b with SMTP id d9443c01a7336-1f458c60fb1mr187183385ad.28.1716917432641; Tue, 28 May 2024 10:30:32 -0700 (PDT) Received: from [192.168.60.239] (213.126.145.34.bc.googleusercontent.com. [34.145.126.213]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f44c9d899dsm82419885ad.290.2024.05.28.10.30.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 May 2024 10:30:32 -0700 (PDT) Message-ID: Date: Tue, 28 May 2024 10:30:30 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Avichal Rakesh Subject: Re: [PATCH 0/3] usb: gadget: uvc: allocate requests based on frame interval length and buffersize To: Michael Grzeschik Cc: Alan Stern , Laurent Pinchart , Daniel Scally , Greg Kroah-Hartman , Jayant Chowdhary , "etalvala@google.com" , Michael Riesch , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Thinh Nguyen References: <17192e0f-7f18-49ae-96fc-71054d46f74a@google.com> <20240424022806.uo73nwpeg63vexiv@synopsys.com> <20240517014359.p2s44ypl4bix4odm@synopsys.com> <20240522014132.xlf7azgq2urfff2d@synopsys.com> <3f404a27-50e8-42c5-a497-b46751154613@rowland.harvard.edu> <20240522171640.iuol4672rnklc35g@synopsys.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 5/22/24 10:37, Michael Grzeschik wrote: > On Wed, May 22, 2024 at 05:17:02PM +0000, Thinh Nguyen wrote: >> On Wed, May 22, 2024, Alan Stern wrote: >>> On Wed, May 22, 2024 at 01:41:42AM +0000, Thinh Nguyen wrote: >>> > On Wed, May 22, 2024, Michael Grzeschik wrote: >>> > > On Fri, May 17, 2024 at 01:44:05AM +0000, Thinh Nguyen wrote: >>> > > > For isoc endpoint IN, yes. If the host requests for isoc data IN while >>> > > > no TRB is prepared, then the controller will automatically send 0-length >>> > > > packet respond. >>> > > >>> > > Perfect! This will help a lot and will make active queueing of own >>> > > zero-length requests run unnecessary. >>> > >>> > Yes, if we rely on the current start/stop isoc transfer scheme for UVC, >>> > then this will work. >>> >>> You shouldn't rely on this behavior.  Other device controllers might not >>> behave this way; they might send no packet at all to the host (causing a >>> USB protocol error) instead of sending a zero-length packet. >> >> I agree. The dwc3 driver has this workaround to somewhat work with the >> UVC. This behavior is not something the controller expected, and this >> workaround should not be a common behavior for different function >> driver/protocol. Since this behavior was added a long time ago, it will >> remain the default behavior in dwc3 to avoid regression with UVC (at >> least until the UVC is changed). However, it would be nice for UVC to >> not rely on this. > > With "this" you mean exactly the following commit, right? > > (f5e46aa4 usb: dwc3: gadget: when the started list is empty stop the active xfer) > > When we start questioning this, then lets dig deeper here. > > With the fast datarate of at least usb superspeed shouldn't they not all > completely work asynchronous with their in flight trbs? > > In my understanding this validates that, with at least superspeed we are > unlikely to react fast enough to maintain a steady isoc dataflow, since > the driver above has to react to errors in the processing context. > > This runs the above patch (f5e46aa4) a gadget independent solution > which has nothing to do with uvc in particular IMHO. > > How do other controllers and their drivers work? > >> Side note, when the dwc3 driver reschedules/starts isoc transfer again, >> the first transfer will be scheduled go out at some future interval and >> not the next immediate microframe. For UVC, it probably won't be a >> problem since it doesn't seem to need data going out every interval. > > It should not make a difference. [TM] > Sorry for being absent for a lot of this discussion. I want to take a step back from the details of how we're solving the problem to what problems we're trying to solve. So, question(s) for Michael, because I don't see an explicit answer in this thread (and my sincerest apologies if they've been answered already and I missed it): What exactly is the bug (or bugs) we're trying to solve here? So far, it looks like there are two main problems being discussed: 1. Reducing the bandwidth usage of individual usb_requests 2. Error handling for when transmission over the wire fails. Is that correct, or are there other issues at play here? (1) in isolation should be relatively easy to solve: Just smear the encoded frame across some percentage (prefereably < 100%) of the usb_requests in one video frame interval. (2) is more complicated, and your suggestion is to have a sentinel request between two video frames that tells the host if the transmission of "current" video frame was successful or not. (Is that correct?) Assuming my understanding of (2) is correct, how should the host behave if the transmission of the sentinel request fails after the video frame was sent successfully (isoc is best effort so transmission is never guaranteed)? Best, Avi.