Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp434103imu; Fri, 11 Jan 2019 03:04:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN79ow3P/Mn92je4NW15MGnfxdEz19QXiCfxpCQrpzYuoijp367TavwTvg7C0eC02TpTyw+A X-Received: by 2002:a17:902:6a8c:: with SMTP id n12mr14261154plk.85.1547204693728; Fri, 11 Jan 2019 03:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547204693; cv=none; d=google.com; s=arc-20160816; b=pKg16O36/Regpkv7c4CIu46l3/ICZpYhkuNoTwC0ZL0viZ5CiV/jeBVlrnpjdtrFuu clsjNYmMJwCJyp0oHzEPLhNorc0fW+krq73qjvIpabGIXLgt5z1fihXYkIJfYSwQkkQW D+neX7QAvPL4d3KRKvfWibZBow9/6A3TopymxUOGXxysyQeTywSwKM28ri5HslMFu61A 4Xd9RkF5Y53JkbFWVLHrUhSqXcU8OPK90JqpIfZnjG1fbT4UaswdNzJBY5GuDixjCt2/ oHE8PUd1UXX7ZgTNawUzXCcgVsYjj8BYbdb5u2/fuEaTkmadTbaOC949dgLoeEKU0ru2 SdQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EEeR5Nd4x98rhFOgNSeE/jcv2aYHwu1lAnwZkhWW9U0=; b=ojYv0oQ4eUKu9rYXPE8b5xz6b7sTPJq2MZfkt2pGr6zFRObmJ8FQsPhQEme6FNOEsY 2wRZF6bdH10fj20wmwwMCfaH8s4erba7OPbKWDW9ePYaaT0oZePEgyIaf6FyW+NBgFem TQi2JFXYA+rBCeKqJJDho7cA7/xQkNE6Y5gFqPzCfmEx2nVmOX6HE/oIcSLjXCnNmnWT 5oH6CJ/lNw3PG9igcP2+tAaIinotCWEQUaYNh7RSErpYVsPstPJeFy50Huu5rN3GRmlo LM5p4ZFKTq6cI92USTK5JZvoCbe5IJOuV0LgCEI3L+90LmT4gQ1tRMfUodsonlzmR9+h /yLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=TPDmlZ4b; 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 i129si81809202pfb.32.2019.01.11.03.04.37; Fri, 11 Jan 2019 03:04:53 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=TPDmlZ4b; 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 S1731218AbfAKIn5 (ORCPT + 99 others); Fri, 11 Jan 2019 03:43:57 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:51540 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727753AbfAKIn5 (ORCPT ); Fri, 11 Jan 2019 03:43:57 -0500 Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C2959547; Fri, 11 Jan 2019 09:43:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547196234; bh=xnsY6Qa5b4FsbIRZrB5tyRpiIjdtn3sW2YqJ4YCbtXs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TPDmlZ4blXNj5eSpH3ktUW6hH+ZphFYUXAds+x1taQYCgjJPbUtc6zJBkp7CUbuf5 FyBQRSWwFg7F7KqwvnVTElFTbK9SU8J5Rfip6qIesX/B0Ybe7bkCmb1ifp0ZFlR0ia BaqAxbTTdTsYZrH0lZIGkKZ36+4JtHEdktcA0Wmo= Date: Fri, 11 Jan 2019 03:43:46 -0500 From: Paul Elder To: Alan Stern Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, b-liu@ti.com, rogerq@ti.com, balbi@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request Message-ID: <20190111084346.GC32268@localhost.localdomain> References: <20190109070856.27460-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 03:39:25PM -0500, Alan Stern wrote: > On Wed, 9 Jan 2019, Paul Elder wrote: > > > This patch series adds a mechanism to allow asynchronously validating > > the data stage of a control OUT request, and for stalling or suceeding > > the request accordingly. > > One thing we haven't mentioned explicitly: What should happen when the > time for the status stage rolls around if the gadget driver queues a > non-zero length request? Ah, yeah, I missed that. > This can happen in a few different ways. One obvious possibility is > that the gadget driver sets the explicit_status flag and then submits a > non-zero length request. Another is that the gadget driver submits > _two_ requests during the data stage (the second would be interpreted > as the status-stage request). A third is that the gadget driver > submits a data-stage request that is too long and the excess portion is > used for the status stage. > > My feeling is that the behavior in these cases should officially be > undefined. Almost anything could happen: the status stage could STALL, > it could succeed, it could NAK, or it could send a non-zero packet to > the host. The request could return with 0 status or an error status, > and req->actual could take on any reasonable value. > > Alternatively, the UDC driver could detect these errors and report them > somehow. Maybe STALL the status stage and complete the request with > -EPIPE status or some such thing. > > Any preferences or other ideas? I think error detection and reporting would be useful. The question is what action to take after that; either leave it undefined or STALL. I think STALL would be fine, since if a non-zero length request is submitted for a status stage, intentionally or not, it isn't part of proper behavior and should count as an error. > One other thing: Some UDC drivers may assume that the data stage of a > control transfer never spans more than a single usb_request. Should > this become an official requirement? Would the data stage of a control transfer ever need more space than a single usb_request can contain? I know UVC doesn't; that's why we pack it together with the setup stage data in 3/6. If so, I would think we can make it a requirement. Paul