Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2220110ybc; Wed, 13 Nov 2019 10:50:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzLKA3jAvfT0vSBpsJ97icV+eLjQBXQoQ86S3QzyXBgEurcHzw8ntRbT48YnL5mf9Wzmb5i X-Received: by 2002:aa7:c2c7:: with SMTP id m7mr5298376edp.295.1573671014141; Wed, 13 Nov 2019 10:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573671014; cv=none; d=google.com; s=arc-20160816; b=j/0H7DJS+fHeDkOfpEnH6bkTG1LVULBR+n8UbFVZta4mcJ2S9Oj0vmYscWvzy+r09C PGj7yfcLz3AdNkHOcx4XfuUVsi+kuahzaaut+oaVYZWQ2ilnY8aaAS7X3l7ypkMClt2l J6a9UJm5yYBCgUjm0hKPkw2dcI16dgWlvLq9+DelYcHeeGLqVuZkbQrw+7zJSEgpctZm 2VKSaYj0GWZbEswstSYQJStWEk4y9lIYSSCs9fchZwp2xhQSa31eKSYgpE2jXnLDJpA3 kx9Wee68MOMtW+u0mapEAOJgdCWRb0bQLUMrB5jFbVHqt+bAadLvQtZ+Vtp2GbD4wZK/ wXuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=g0z7j0URyCgWcHdjJX5oY+QXOHKIG76OYQt7bKnjFow=; b=p3pJlNY1JgQoxkAX8SbFpAznQid55ypMoFNjr92UbLZnSyqdkooIzGni2LEiXMg+Np UxsyZnpV+xOn7qIbkurBfh2Cl0D5HlNeS0fd+z5FsrGzeIFpGRjjWVtoseDaRhbTpVi+ VDGXnKf811pFItbHfMkwudgw0gwX7qk9vlfu3oDAVvNMshkP4weVnYpadeNjeczcWL0y xrWZZG1LJ6mLvWVqULPR3I8mv9tuR3+tOmihT2gYoKCse4zUk4CcFidkMgbdrTel2jPD U3aVtW8jubtHHNk/Lbq13yorwQjk5+fxTYlV7CLafBLuX+S2HlujVP0l9IIgowMj1o4e vtTg== 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 c31si2249161edb.56.2019.11.13.10.49.50; Wed, 13 Nov 2019 10:50:14 -0800 (PST) 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 S1727975AbfKMPjS (ORCPT + 99 others); Wed, 13 Nov 2019 10:39:18 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:41324 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727515AbfKMPjS (ORCPT ); Wed, 13 Nov 2019 10:39:18 -0500 Received: (qmail 2537 invoked by uid 2102); 13 Nov 2019 10:39:17 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 13 Nov 2019 10:39:17 -0500 Date: Wed, 13 Nov 2019 10:39:17 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Michael Olbrich cc: Thinh Nguyen , "linux-usb@vger.kernel.org" , Felipe Balbi , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" Subject: Re: [PATCH 2/2] usb: dwc3: gadget: restart the transfer if a isoc request is queued too late In-Reply-To: <20191113075308.qwwgpg7kpfcyjxau@pengutronix.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Nov 2019, Michael Olbrich wrote: > On Wed, Nov 13, 2019 at 03:55:01AM +0000, Thinh Nguyen wrote: > > Michael Olbrich wrote: > > > Currently, most gadget drivers handle isoc transfers on a best effort > > > bases: If the request queue runs empty, then there will simply be gaps in > > > the isoc data stream. > > > > > > The UVC gadget depends on this behaviour. It simply provides new requests > > > when video frames are available and assumes that they are sent as soon as > > > possible. > > > > > > The dwc3 gadget currently works differently: It assumes that there is a > > > contiguous stream of requests without any gaps. If a request is too late, > > > then it is dropped by the hardware. > > > For the UVC gadget this means that a live stream stops after the first > > > frame because all following requests are late. > > > > Can you explain little more how UVC gadget fails? > > dwc3 controller expects a steady stream of data otherwise it will result > > in missed_isoc status, and it should be fine as long as new requests are > > queued. The controller doesn't just drop the request unless there's some > > other failure. > > UVC (with a live stream) does not fill the complete bandwidth of an > isochronous endpoint. Let's assume for the example that one video frame > fills 3 requests. Because it is a live stream, there will be a gap between > video frames. This is unavoidable, especially for compressed video. So the > UVC gadget will have requests for the frame numbers 1 2 3 5 6 7 9 10 11 13 14 > 15 and so on. > The dwc3 hardware tries to send those with frame numbers 1 2 3 4 5 6 7 8 9 > 10 11 12. So except for the fist few requests, all are late and result in a > missed_isoc. I tried to just ignore the missed_isoc but that did not work > for me. I only received the first frame at the other end. > Maybe I missing something here, i don't have access to the hardware > documentation, so I can only guess from the existing driver. How about changing the gadget driver instead? For frames where the UVC gadget knows no video frame data is available (numbers 4, 8, 12, and so on in the example above), queue a zero-length request. Then there won't be any gaps in the isochronous packet stream. Alan Stern