From owner-freebsd-usb@FreeBSD.ORG Thu May 26 12:20:09 2005 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4FDC116A422 for ; Thu, 26 May 2005 12:20:09 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from md1.swissinfo.org (md1.swissinfo.org [146.159.4.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7758D43D53 for ; Thu, 26 May 2005 12:20:01 +0000 (GMT) (envelope-from sebastien.b@swissinfo.org) Received: from mail.swissinfo.org ([194.6.181.33]) by md1.swissinfo.org (phad1.swissinfo.org [146.159.6.9]) (MDaemon.PRO.v7.2.1.R) with ESMTP id 06-md50000486561.msg for ; Thu, 26 May 2005 14:19:57 +0200 Received: from [192.168.0.10] (82.231.254.101) by mail.swissinfo.org (7.0.020) (authenticated as sebastien.b) id 4153942003C425FC; Thu, 26 May 2005 14:19:55 +0200 From: Seb To: hselasky@c2i.net, freebsd-usb@freebsd.org Date: Thu, 26 May 2005 14:21:52 +0200 User-Agent: KMail/1.8 References: <200505252120.22408.sebastien.b@swissinfo.org> <200505261346.54260.hselasky@c2i.net> In-Reply-To: <200505261346.54260.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200505261421.53060.sebastien.b@swissinfo.org> X-Spam-Processed: phad1.swissinfo.org, Thu, 26 May 2005 14:19:57 +0200 (not processed: message from valid local sender) X-MDRemoteIP: 194.6.181.33 X-Return-Path: sebastien.b@swissinfo.org X-MDaemon-Deliver-To: freebsd-usb@freebsd.org X-MDAV-Processed: phad1.swissinfo.org, Thu, 26 May 2005 14:19:58 +0200 Cc: Subject: Re: usbd_bulk_transfer returns 1 (USBD_IN_PROGRESS) ?! X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2005 12:20:09 -0000 Hello, On Thursday 26 May 2005 13:46, Hans Petter Selasky wrote: > Have you got a link to the tarball of your driver? Sure. http://lekernel.host.lya-network.biz/download/prism54u-bsd-0.1.tar.bz2 > I downloaded one of the files I found and had a look. > > When you detach, you have to stop the pipes/transfers you are using. Then > usbd_bulk_transfer will return USBD_CANCELLED and must not be called again! Ok, I'll add this, thanks for the info. But this won't solve the USBD_IN_PROGRESS problem... > Also you must make sure that transfers (xfer) are not started two times in > success, before the first call has returned transfer status. > > I'm not too familiar with swi_sched, but it might be that it runs the > interrupt handler in parallell. According to the ithread and swi_add manual pages, since I don't specify the INTR_MPSAFE flag the Giant mutex is acquired before the interrupt thread runs my code and is released right after my function returns. So there is no possibility for parallel USB transfers AFAIK. > Where are you tearing down your software interrupt handler? In p54u_netdev_free (netdev.c) : if(sc->update_state != NULL) ithread_remove_handler(sc->update_state); and in p54u_shutdown (usb_init.c) : if(sc->send_pending != NULL) ithread_remove_handler(sc->send_pending); if(sc->swi != NULL) ithread_destroy(sc->swi); The update_state handler is responsible for reconfiguring the device (LED status, frequency, RX filter) ; and send_pending handler sends the 802.11 frames. USB transfers also occur in the sc_stats_ch callout to update the network statistics, but since the mpsafe argument in callout_init is set to zero, the Giant mutex is held while the callout function executes ; therefore the USB transfers shouldn't race. > Does the same problem happen with my USB driver? I'll try. Regards, Sebastien