Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2489448imu; Thu, 10 Jan 2019 15:17:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN63aqFrs9ImECAeKS9duqn410oxH+MBz7d7w/74HRO5f3HuIOz8IugVpU7ChyBpGrbYoLYU X-Received: by 2002:a17:902:6e0f:: with SMTP id u15mr12060775plk.175.1547162223537; Thu, 10 Jan 2019 15:17:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547162223; cv=none; d=google.com; s=arc-20160816; b=WjvPN7vF/0o5V4acuqowP42yChIyqj5XEM7b2AsuMpkbSRyOk6dVdaqZ/nvjXOJAbm /hpdX0uhFMorjtcXwCSaSSfsd7ydhR8t3rpbCNhA0cvq6wtaOWhk2gf6x8knyXNQ/rlQ wWgk0eCgLKIJWVrPfYAsHmFUnPl7IV+3rMKBTSmpCcTkebNbwXV4hJujNo+QIO/ImxUy gURD/GUbWdjNjZSrcWopbHjgkBiA6vKzJUMkxmnnem7sj4M/yHj90RikP9LKVj8ywbhX 5H3xPgD6Hku49drt9Qvr7GaVMGZFMT2GPCXCYtIV5OyzW1DCw7OGjW9MjupvossdwB7v x+UA== 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=nH6XTa0UW2JVNTdItZemmLkPyzY5rJFi2G0A3zFclAs=; b=nyiuYGHJU/eiUkZhvupVIR6ZDjg093RDVP0HOm+Tq/dk2NfKG/9fGq4CJWEyMdE6/7 a8pe+GmM/3eyJrbfWmjPekCWl9ktNRrbGT7Xq2Iy0Lkw6ZwpzRQUXy05iMBKCtfkuDvp YCY8c2AsvvMCXwHizoo/vMGlMFzc2D44grMqM+FZALXwOaxBwCV//7lJR5yO7BWobF/f RPdyrxxfThW0k1IvCLGPyu4SO70ljcZSKOWSV/FfQPolRpwL37a3N08ODujuPqaB6xMq on6I1b+A54Sqsh581lTpo+yM8OJ4euHzNDYaYbtniFICmeJDCPgxZ667jq4ijkRR72+Z 21fA== 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 f12si50418633pgd.68.2019.01.10.15.16.45; Thu, 10 Jan 2019 15:17:03 -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 S1730121AbfAJUj1 (ORCPT + 99 others); Thu, 10 Jan 2019 15:39:27 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:43862 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1729743AbfAJUj0 (ORCPT ); Thu, 10 Jan 2019 15:39:26 -0500 Received: (qmail 3142 invoked by uid 2102); 10 Jan 2019 15:39:25 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 10 Jan 2019 15:39:25 -0500 Date: Thu, 10 Jan 2019 15:39:25 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Paul Elder cc: laurent.pinchart@ideasonboard.com, , , , , , , Subject: Re: [PATCH v5 0/6] usb: gadget: add mechanism to asynchronously validate data stage of ctrl out request In-Reply-To: <20190109070856.27460-1-paul.elder@ideasonboard.com> 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, 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? 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? 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? Alan Stern