From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756562AbbEVLMr (ORCPT ); Fri, 22 May 2015 07:12:47 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:47802 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754712AbbEVLMo (ORCPT ); Fri, 22 May 2015 07:12:44 -0400 Message-ID: <555F0F29.1070108@mentor.com> Date: Fri, 22 May 2015 12:12:41 +0100 From: "Baxter, Jim" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Peter Chen CC: Robert Baldyga , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "Zapolskiy, Vladimir" , "balbi@ti.com" Subject: Re: usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT References: <551AED33.2040206@mentor.com> <551BA70B.1090706@samsung.com> <551C2AE1.9000608@mentor.com> <20150402002348.GA10964@shlinux2> In-Reply-To: <20150402002348.GA10964@shlinux2> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.76] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Wed, Apr 01, 2015 at 06:29:05PM +0100, Baxter, Jim wrote: >>> >>> FunctionFS is very specific, because read/write operations are directly >>> translated into USB requests, which are asynchronous, so you cannot use >>> O_NONBLOCK. >>> >>> If you need non-blocking API you can use Asynchronous I/O (AIO). You can >>> find some examples in kernel sources (tools/usb/ffs-aio-example/). >>> >>> Br, >>> Robert Baldyga >>> >> >> Thank you, that sounds like the best approach. >> In this case I think perhaps the long wait without any data is an >> problem with the imx6 Chipidea USB controller. > > What's the possible problem? Sorry for the delay in replying, I have been getting some more details with a USB Analyser. The scenario is that the NCM device is enumerating so we see the messages to: SetAddress (1) GetDescriptor (Device) GetDescriptor (StringN) GetDescriptor (Configuration) SetConfiguration (1) GetDescriptor (String iInterface) GetDescriptor (String iInterface) At this point the NCM host sends Writes to the F_FS EP0 but for some reason the host device does not respond and only issues SOF packets for hours. This happens occasionally and is fixed by turning the device off and on again. Unless I am mistaken from a NCM gadget point of view the attached device is working correctly and there is no way to know it has failed, is that correct? > >> >> I guess it should suspend and drop the connections if there is no >> traffic for more than 10ms? >> > > If the Device side NAK host's IN/OUT token continually, the pipe will > not be stopped, the host will send token continually until the application > cancel this request. >