Date: Wed, 13 Mar 2002 21:01:39 -0700 (MST) From: "M. Warner Losh" <imp@village.org> To: brooks@one-eyed-alien.net Cc: mobile@FreeBSD.ORG Subject: Re: patch for Lucent command timeouts Message-ID: <20020313.210139.85419419.imp@village.org> In-Reply-To: <20020313143226.A18204@Odin.AC.HMC.Edu> References: <20020313113313.B11290@Odin.AC.HMC.Edu> <20020313143226.A18204@Odin.AC.HMC.Edu>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20020313143226.A18204@Odin.AC.HMC.Edu> Brooks Davis <brooks@one-eyed-alien.net> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020313.210139.85419419.imp>