From owner-freebsd-current Thu Feb 27 21:22:26 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F165637B401 for ; Thu, 27 Feb 2003 21:22:23 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id D105A43FCB for ; Thu, 27 Feb 2003 21:22:20 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from athlon.pn.xcllnt.net (athlon.pn.xcllnt.net [192.168.4.3]) by ns1.xcllnt.net (8.12.6/8.12.6) with ESMTP id h1S5Lt1o069142; Thu, 27 Feb 2003 21:22:00 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from athlon.pn.xcllnt.net (localhost [127.0.0.1]) by athlon.pn.xcllnt.net (8.12.7/8.12.7) with ESMTP id h1S5Ltse001142; Thu, 27 Feb 2003 21:21:55 -0800 (PST) (envelope-from marcel@athlon.pn.xcllnt.net) Received: (from marcel@localhost) by athlon.pn.xcllnt.net (8.12.7/8.12.7/Submit) id h1S5Lt6t001141; Thu, 27 Feb 2003 21:21:55 -0800 (PST) (envelope-from marcel) Date: Thu, 27 Feb 2003 21:21:55 -0800 From: Marcel Moolenaar To: "M. Warner Losh" Cc: kuku@www.kukulies.org, freebsd-current@FreeBSD.ORG Subject: [patch] wi: device timeout [was: Re: wi0: tx failed, retry limit exceeded] Message-ID: <20030228052155.GB1062@athlon.pn.xcllnt.net> References: <200302261011.h1QABjmT000629@www.kukulies.org> <20030227.215348.84365408.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <20030227.215348.84365408.imp@bsdimp.com> User-Agent: Mutt/1.5.3i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Feb 27, 2003 at 09:53:48PM -0700, M. Warner Losh wrote: > : > : Now I'm getting kernel messages > : > : wi0: tx failed, retry limit exceeded. > > These are bogus and can be ignored. The old driver didn't report > them. > > However, there are, ah, other issues with the latest wi driver. :-( The attached patch fixes the device timeout problem. I don't claim it is correct, but may serve as the basis for experimentation (is it the limit of 10 iterations, is it the fiddling with status bits or something else). -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="wi.diff" Index: if_wi.c =================================================================== RCS file: /home/ncvs/src/sys/dev/wi/if_wi.c,v retrieving revision 1.130 diff -u -r1.130 if_wi.c --- if_wi.c 26 Feb 2003 17:18:35 -0000 1.130 +++ if_wi.c 28 Feb 2003 04:46:46 -0000 @@ -555,10 +555,9 @@ void wi_intr(void *arg) { - int i; struct wi_softc *sc = arg; struct ifnet *ifp = &sc->sc_ic.ic_if; - u_int16_t status, raw_status, last_status; + u_int16_t status; WI_LOCK_DECL(); WI_LOCK(sc); @@ -570,21 +569,10 @@ return; } - /* maximum 10 loops per interrupt */ - last_status = 0; - for (i = 0; i < 10; i++) { - /* - * Only believe a status bit when we enter wi_intr, or when - * the bit was "off" the last time through the loop. This is - * my strategy to avoid racing the hardware/firmware if I - * can re-read the event status register more quickly than - * it is updated. - */ - raw_status = CSR_READ_2(sc, WI_EVENT_STAT); - status = raw_status & ~last_status; + do { + status = CSR_READ_2(sc, WI_EVENT_STAT); if ((status & WI_INTRS) == 0) break; - last_status = raw_status; if (status & WI_EV_RX) wi_rx_intr(sc); @@ -602,7 +590,7 @@ (sc->sc_flags & WI_FLAGS_OUTRANGE) == 0 && _IF_QLEN(&ifp->if_snd) != 0) wi_start(ifp); - } + } while (1); WI_UNLOCK(sc); --PEIAKu/WMn1b1Hv9-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message