Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp64675imm; Fri, 7 Sep 2018 16:29:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYm6WAa9xm9FHZQAZrJRhDp/yq5vMyt9TF0WDRrlBdgTdrT5GZ/4KiqeYgs3yeAsD0xbRaJ X-Received: by 2002:a62:9e08:: with SMTP id s8-v6mr11166567pfd.23.1536362983503; Fri, 07 Sep 2018 16:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536362983; cv=none; d=google.com; s=arc-20160816; b=0jUINubJdoEmdDQs9VpYRYXxZXPJrnPsa7eq0Ab7/GDFDFq4AddcQYr84WkWObSI3P mkRTYXbziG9JxbNGFfRWmJfBVT6qHRY4Q1Y16rKAUf6onPoNNwtTllweyiXfS9zVP0ga kD7PCG2wJi5vDK7FemwwP7tMF6I0IxVYKDRRJabniwVpqKLBDqMmoJDajj06pCCGHj5I y3woJUODeXL6nmbL2sJSjgpJBAZWYSK1T8xGy2OVcRITL7GPqOnvbDmnzGn1xQS8XxTN VpGCFrwObRGxdkw4xr3kXClB+LNnG1p3tGH9t8C+fazK+9iLq4wXgPeHlqm2c5zHXAId Fnxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=7ZvuDm7BBzS2UFpuSS6IZ2uPqwfSFYY3CPOTSn+jzNw=; b=NgKHnCUJHXjeASeNw3F6E/DIS5WC0gmWC/vk4VRDPISK28OFE7JfI2wxMkTqgHwPlO 5VOKkjXGTqpCdt2x98MQCrlMkEjNCKygRjMNFwufS1TfDOEKUX96Lke2VtgJJywF78P4 Y0wf7tsRYWlF0/YIDiDjhobr8740Z0PhYN5begqYMWnk8HVlyleeUXPVnTKNfK/NxANx 5plHQlu/0tAN6e07jvwyoI3as2NqvB/lYbFLUqBeUl9QeeDzpvBcUmCvn7LHfKVMvqh5 b/bib7Dq1I0j0sWiQurSSJxLAJ3Bag7Rhx+3HMjYy9L5L0Gtei7uChZbOWPplKg6j28m tqMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=NFcocSOH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2-v6si9737332pfd.76.2018.09.07.16.29.27; Fri, 07 Sep 2018 16:29:43 -0700 (PDT) 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 header.i=@synopsys.com header.s=mail header.b=NFcocSOH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726404AbeIHEL1 (ORCPT + 99 others); Sat, 8 Sep 2018 00:11:27 -0400 Received: from smtprelay2.synopsys.com ([198.182.60.111]:40664 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725733AbeIHEL0 (ORCPT ); Sat, 8 Sep 2018 00:11:26 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id DCE4010C0CD3; Fri, 7 Sep 2018 16:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1536362888; bh=4+VEKpQljccWILomvYXjluZ2PibuDIrWtBREtVtGODM=; h=From:To:CC:Subject:Date:References:From; b=NFcocSOH0BxwopDM2nmBzA77cObJ9HFwBsWZuLS1VfWD8tfQc18mKHWhtS01rn4MH ekWxeDplMfAcWsZFqZvp+HFol2AzGBXsUnDPuyD+sBa/d+3V2soguZTNBvvcENFukX l4IpNWKEaIi24JKSMf/G6IjDjDuWKtRkrKzbNp35uHAOxEyhT1Hw49mBf9nEmLM8wZ 0qvO5WfQ96qOf+Lms3dAIvhdsd6CtYzL5GvFHPHQsB7G2O6ZpMqA3MpM6davbBnASy JWKYcoCEr8RXcQpCfdfwIcTP+OqZCLhFMBSXerhjVmay5okE632gAvUn+RcS7x+GNc QqenDoRMmruzw== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id BA10933D3; Fri, 7 Sep 2018 16:28:08 -0700 (PDT) Received: from us01wembx1.internal.synopsys.com ([169.254.1.253]) by US01WEHTC3.internal.synopsys.com ([::1]) with mapi id 14.03.0361.001; Fri, 7 Sep 2018 16:28:08 -0700 From: Thinh Nguyen To: Anurag Kumar Vulisha , "balbi@kernel.org" , "gregkh@linuxfoundation.org" CC: "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Thinh.Nguyen@synopsys.com" , "v.anuragkumar@gmail.com" Subject: Re: [PATCH v3 4/8] usb: dwc3: implement stream transfer timeout Thread-Topic: [PATCH v3 4/8] usb: dwc3: implement stream transfer timeout Thread-Index: AQHURqy4/mMoK+M5zEyImU/x5ug6Dg== Date: Fri, 7 Sep 2018 23:28:07 +0000 Message-ID: <30102591E157244384E984126FC3CB4F544AD89B@us01wembx1.internal.synopsys.com> References: <1536326029-16327-1-git-send-email-anurag.kumar.vulisha@xilinx.com> <1536326029-16327-5-git-send-email-anurag.kumar.vulisha@xilinx.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.184.20] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/7/2018 6:14 AM, Anurag Kumar Vulisha wrote:=0A= > According to dwc3 databook when streams are used, it may be possible=0A= > for the host and device become out of sync, where device may wait for=0A= > host to issue prime transcation and host may wait for device to issue=0A= > erdy. To avoid such deadlock, timeout needs to be implemented. After=0A= > timeout occurs, device will first stop transfer and restart the transfer= =0A= > again. This patch does the same.=0A= >=0A= > Signed-off-by: Anurag Kumar Vulisha =0A= > Reviewed-by: Thinh Nguyen =0A= > ---=0A= > Changes in v3:=0A= > 1. Added the changes suggested by "Thinh Nguyen"=0A= >=0A= > Changes in v2:=0A= > 1. Changed STREAM_TIMEOUT to STREAM_TIMEOUT_MS as suggested by=0A= > "Andy Shevchenko"=0A= > ---=0A= > drivers/usb/dwc3/core.h | 7 +++++++=0A= > drivers/usb/dwc3/gadget.c | 36 ++++++++++++++++++++++++++++++++++++=0A= > 2 files changed, 43 insertions(+)=0A= >=0A= > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h=0A= > index 5bfb625..0b255e97 100644=0A= > --- a/drivers/usb/dwc3/core.h=0A= > +++ b/drivers/usb/dwc3/core.h=0A= > @@ -633,6 +633,11 @@ struct dwc3_event_buffer {=0A= > =0A= > #define DWC3_TRB_NUM 256=0A= > =0A= > +/*=0A= > + * Timeout value in msecs used by stream_timeout_timer when streams are = enabled=0A= > + */=0A= > +#define STREAM_TIMEOUT_MS 50=0A= > +=0A= > /**=0A= > * struct dwc3_ep - device side endpoint representation=0A= > * @endpoint: usb endpoint=0A= > @@ -656,6 +661,7 @@ struct dwc3_event_buffer {=0A= > * @name: a human readable name e.g. ep1out-bulk=0A= > * @direction: true for TX, false for RX=0A= > * @stream_capable: true when streams are enabled=0A= > + * @stream_timeout_timer: timer used to aviod deadlock when streams are = used=0A= =0A= Change aviod -> avoid. Also, the timer is being used when there's a=0A= deadlock rather than to avoid it. You probably need to explain what=0A= deadlock it is if you mentioned it here, but I think it's ok to simply=0A= say timeout timer for streams (unless Felipe has any objection).=0A= =0A= Thinh=0A= =0A=