From patchwork Mon Jan 20 20:45:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 23412 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C463203C6 for ; Mon, 20 Jan 2014 20:43:25 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kp14sf18808774pab.10 for ; Mon, 20 Jan 2014 12:43:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=vX4/0Kub9MTIISt86gaF8wv2NTJPTbJtQWhLixXivM0=; b=bREnkqXDorIBmOXfCX+wxJEkR+HDVXgWsG/Xnw4EvkW+ZcZiI3ivD432BuZPD0w5ql IyyIt7Pm40gI0gzIQzTblea+Jf4J9ZGQ8Nn0UhX+75ZdXK7+EC3spz9/yF6s4ACcZ2us FxHQZraxbFnjlDAuHJ8uWHPOjQcSZLvURFYoGJ0pb1o6UO+4381kM+eDn64eAo3rFLfn ihtQeNKNaaThi7nhq2mzLEnOpDd6TukI4Rser1+8CqvmlS6MoG+sh4P/Fjo+IfdgysZM QFXbzxh224WZKCg4SdU302vVAbYalZ3nKYGdEALJMSIO91b/+tdcKWgwk/1XR8OoofF6 Ix/w== X-Gm-Message-State: ALoCoQl76nnh7TbSWgzP6FW79LbkvF09QiuwiChYwUUnCClaxBwyQLQLAK2r+onKBYwErPLF34ur X-Received: by 10.66.137.43 with SMTP id qf11mr7273512pab.28.1390250604855; Mon, 20 Jan 2014 12:43:24 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.135 with SMTP id i7ls1948493qey.30.gmail; Mon, 20 Jan 2014 12:43:24 -0800 (PST) X-Received: by 10.52.231.130 with SMTP id tg2mr9797964vdc.16.1390250604738; Mon, 20 Jan 2014 12:43:24 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id xg12si751790vcb.102.2014.01.20.12.43.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 12:43:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ie18so3132167vcb.12 for ; Mon, 20 Jan 2014 12:43:24 -0800 (PST) X-Received: by 10.58.100.100 with SMTP id ex4mr3416798veb.2.1390250604408; Mon, 20 Jan 2014 12:43:24 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp75840vcz; Mon, 20 Jan 2014 12:43:23 -0800 (PST) X-Received: by 10.66.26.236 with SMTP id o12mr20931775pag.15.1390250603514; Mon, 20 Jan 2014 12:43:23 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pi8si2581281pac.30.2014.01.20.12.43.23; Mon, 20 Jan 2014 12:43:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752074AbaATUnV (ORCPT + 3 others); Mon, 20 Jan 2014 15:43:21 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:35881 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbaATUnU (ORCPT ); Mon, 20 Jan 2014 15:43:20 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s0KKhJ39013073; Mon, 20 Jan 2014 14:43:19 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s0KKhJNl027375; Mon, 20 Jan 2014 14:43:19 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Mon, 20 Jan 2014 14:43:19 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s0KKhJuL011639; Mon, 20 Jan 2014 14:43:19 -0600 From: Felipe Balbi To: Sarah Sharp CC: Linux USB Mailing List , Felipe Balbi , Subject: [PATCH] usb: host: xhci: fix HALTED endpoint handling Date: Mon, 20 Jan 2014 14:45:11 -0600 Message-ID: <1390250711-25840-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.8.4.GIT MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If the HW reports the endpoint as Halted, there's no need to start any URB for that endpoint, we can simply return -EPIPE and this will tell upper layers that the endpoint is, indeed, halted. This patch fixes usbtest's set/clear halt test #13 on xHCI-based hosts. Cc: Signed-off-by: Felipe Balbi --- Hi Sarah, seems like this has been broken for quite a long time. I tested the patch on an AM437x which has XHCI Host and the same IP configured as device as well (two dwc3 instances, basically). It has been running for the past hour or so without any failures when running testusb -t 13 -c 5000 -s 2048 -a in a loop, but if you think there's a better way to fix this, let me know. I just didn't understand why xhci-hcd still queues the URB even though HW already told us the endpoint is halted. Any comments ? cheers drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 53c2e29..e9df61a 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2959,7 +2959,8 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, /* XXX not sure if this should be -ENOENT or not */ return -EINVAL; case EP_STATE_HALTED: - xhci_dbg(xhci, "WARN halted endpoint, queueing URB anyway.\n"); + xhci_dbg(xhci, "WARN halted endpoint.\n"); + return -EPIPE; case EP_STATE_STOPPED: case EP_STATE_RUNNING: break;