From owner-freebsd-mobile Wed Mar 13 20: 1:51 2002 Delivered-To: freebsd-mobile@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 72B2937B405 for ; Wed, 13 Mar 2002 20:01:47 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id g2E41ki33441; Wed, 13 Mar 2002 21:01:46 -0700 (MST) (envelope-from imp@village.org) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id g2E41jL46046; Wed, 13 Mar 2002 21:01:45 -0700 (MST) (envelope-from imp@village.org) Date: Wed, 13 Mar 2002 21:01:39 -0700 (MST) Message-Id: <20020313.210139.85419419.imp@village.org> To: brooks@one-eyed-alien.net Cc: mobile@FreeBSD.ORG Subject: Re: patch for Lucent command timeouts From: "M. Warner Losh" In-Reply-To: <20020313143226.A18204@Odin.AC.HMC.Edu> References: <20020313113313.B11290@Odin.AC.HMC.Edu> <20020313143226.A18204@Odin.AC.HMC.Edu> X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org In message: <20020313143226.A18204@Odin.AC.HMC.Edu> Brooks Davis writes: : On Wed, Mar 13, 2002 at 11:33:13AM -0800, Brooks Davis wrote: : > The following patch attempts to address the timeouts people have been : > seeing in after my recent MFC of Linksys support. : : Here's a slightly improved patch which avoids some timeouts on INI : commands thanks to Thomas Skibo. : : -- Brooks : : Index: if_wi.c : =================================================================== : RCS file: /usr/cvs/src/sys/dev/wi/if_wi.c,v : retrieving revision 1.80 : diff -u -r1.80 if_wi.c : --- if_wi.c 11 Mar 2002 23:29:59 -0000 1.80 : +++ if_wi.c 13 Mar 2002 22:25:38 -0000 : @@ -1003,7 +1003,8 @@ : CSR_WRITE_2(sc, WI_PARAM2, 0); : CSR_WRITE_2(sc, WI_COMMAND, cmd); : : - for (i = 0; i < WI_TIMEOUT; i++) { : + for (i = ((cmd == WI_CMD_INI) ? WI_TIMEOUT_INI : WI_TIMEOUT); : + i >= 0; i--) { if (cmd == WI_CMD_INI) end = WI_TIMEOUT_INI; else end = WI_TIMEOUT; for (i = 0; i < end; i++) { is a little clearer. : /* : * Wait for 'command complete' bit to be : * set in the event status register. : @@ -1024,9 +1025,9 @@ : DELAY(WI_DELAY); : } : : - if (i == WI_TIMEOUT) { : + if (i == WI_TIMEOUT && (sc->wi_prism2 || (cmd != WI_CMD_INQUIRE))) { : device_printf(sc->dev, : - "timeout in wi_cmd %x; event status %x\n", cmd, s); : + "timeout in wi_cmd 0x%04x; event status 0x%04x\n", cmd, s); : return(ETIMEDOUT); I think the test should be something like (i == end) since i == WI_TIMEOUT will only happen in rare cases (in the original code), where it takes exactly 500-10ms to do the command. I have more changes to the wi driver from the airtools folks, but haven't committed them yet. I'll do it after DP1. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message