Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2003 11:48:06 -0800 (PST)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 43038 for review
Message-ID:  <200311251948.hAPJm6rv023276@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311251948.hAPJm6rv023276>