From owner-p4-projects@FreeBSD.ORG Tue Nov 25 11:48:08 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 405E716A4D0; Tue, 25 Nov 2003 11:48:08 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F19EA16A4CE for ; Tue, 25 Nov 2003 11:48:07 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9C7543FAF for ; Tue, 25 Nov 2003 11:48:06 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hAPJm6XJ023279 for ; Tue, 25 Nov 2003 11:48:06 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hAPJm6rv023276 for perforce@freebsd.org; Tue, 25 Nov 2003 11:48:06 -0800 (PST) (envelope-from sam@freebsd.org) Date: Tue, 25 Nov 2003 11:48:06 -0800 (PST) Message-Id: <200311251948.hAPJm6rv023276@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 43038 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2003 19:48:08 -0000 http://perforce.freebsd.org/chv.cgi?CH=43038 Change 43038 by sam@sam_ebb on 2003/11/25 11:47:59 Change the rx process descriptor API to allow the HAL to properly check for a "done frame". Because of the self-linked descriptors we need to carefully verify the current descriptor is done as the hardware may be in middle of processing it even if the done bit is marked. Affected files ... .. //depot/projects/netperf/sys/dev/ath/if_ath.c#39 edit .. //depot/projects/netperf/sys/dev/ath/if_athvar.h#8 edit Differences ... ==== //depot/projects/netperf/sys/dev/ath/if_ath.c#39 (text+ko) ==== @@ -1615,6 +1615,9 @@ static void ath_rx_proc(void *arg, int npending) { +#define PA2DESC(_sc, _pa) \ + ((struct ath_desc *)((caddr_t)(_sc)->sc_desc + \ + ((_pa) - (_sc)->sc_desc_paddr))) struct ath_softc *sc = arg; struct ath_buf *bf; struct ieee80211com *ic = &sc->sc_ic; @@ -1647,7 +1650,20 @@ if_printf(ifp, "ath_rx_proc: no mbuf!\n"); continue; } - status = ath_hal_rxprocdesc(ah, ds); + /* XXX sync descriptor memory */ + /* + * Must provide the virtual address of the current + * descriptor, the physical address, and the virtual + * address of the next descriptor in the h/w chain. + * This allows the HAL to look ahead to see if the + * hardware is done with a descriptor by checking the + * done bit in the following descriptor and the address + * of the current descriptor the DMA engine is working + * on. All this is necessary because of our use of + * a self-linked list to avoid rx overruns. + */ + status = ath_hal_rxprocdesc(ah, ds, + bf->bf_daddr, PA2DESC(sc, ds->ds_link)); #ifdef AR_DEBUG if (ath_debug > 1) ath_printrxbuf(bf, status == HAL_OK); @@ -1782,6 +1798,7 @@ ath_hal_rxmonitor(ah); /* rx signal state monitoring */ ath_hal_rxena(ah); /* in case of RXEOL */ +#undef PA2DESC } /* @@ -2253,6 +2270,9 @@ static void ath_stoprecv(struct ath_softc *sc) { +#define PA2DESC(_sc, _pa) \ + ((struct ath_desc *)((caddr_t)(_sc)->sc_desc + \ + ((_pa) - (_sc)->sc_desc_paddr))) struct ath_hal *ah = sc->sc_ah; ath_hal_stoppcurecv(ah); /* disable PCU */ @@ -2266,12 +2286,15 @@ DPRINTF(("ath_stoprecv: rx queue %p, link %p\n", (caddr_t) ath_hal_getrxbuf(ah), sc->sc_rxlink)); TAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) { - if (ath_hal_rxprocdesc(ah, bf->bf_desc) == HAL_OK) + struct ath_desc *ds = bf->bf_desc; + if (ath_hal_rxprocdesc(ah, ds, bf->bf_daddr, + PA2DESC(sc, ds->ds_link)) == HAL_OK) ath_printrxbuf(bf, 1); } } #endif sc->sc_rxlink = NULL; /* just in case */ +#undef PA2DESC } /* ==== //depot/projects/netperf/sys/dev/ath/if_athvar.h#8 (text+ko) ==== @@ -295,8 +295,8 @@ (_flen), (_hlen), (_rate), (_antmode))) #define ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \ ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq))) -#define ath_hal_rxprocdesc(_ah, _ds) \ - ((*(_ah)->ah_procRxDesc)((_ah), (_ds))) +#define ath_hal_rxprocdesc(_ah, _ds, _dspa, _dsnext) \ + ((*(_ah)->ah_procRxDesc)((_ah), (_ds), (_dspa), (_dsnext))) #define ath_hal_setuptxdesc(_ah, _ds, _plen, _hlen, _atype, _txpow, \ _txr0, _txtr0, _keyix, _ant, _flags, \ _rtsrate, _rtsdura) \