PERFORCE change 66152 for review

Sam Leffler sam at FreeBSD.org
Tue Nov 30 16:08:50 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=66152

Change 66152 by sam at sam_ebb on 2004/12/01 00:08:19

	when operating as an ap set default antenna based on recent
	xmit stats in each beacon interval

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#35 edit
.. //depot/projects/wifi/sys/dev/ath/if_athvar.h#14 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#35 (text+ko) ====

@@ -1802,7 +1802,7 @@
 	struct ath_buf *bf = sc->sc_bcbuf;
 	struct ath_hal *ah = sc->sc_ah;
 	struct mbuf *m;
-	int ncabq, error;
+	int ncabq, error, otherant;
 
 	DPRINTF(sc, ATH_DEBUG_BEACON_PROC, "%s: pending %u\n",
 		__func__, pending);
@@ -1873,6 +1873,17 @@
 		ath_setslottime(sc);		/* commit change to h/w */
 
 	/*
+	 * Check recent per-antenna transmit statistics and flip
+	 * the default antenna if noticeably more frames went out
+	 * on the non-default antenna.
+	 * XXX assumes 2 anntenae
+	 */
+	otherant = sc->sc_defant & 1 ? 2 : 1;
+	if (sc->sc_ant_tx[otherant] > sc->sc_ant_tx[sc->sc_defant] + 2)
+		ath_setdefantenna(sc, otherant);
+	sc->sc_ant_tx[1] = sc->sc_ant_tx[2] = 0;
+
+	/*
 	 * Construct tx descriptor.
 	 */
 	ath_beacon_setup(sc, bf);
@@ -3330,7 +3341,9 @@
 		if (ni != NULL) {
 			an = ATH_NODE(ni);
 			if (ds->ds_txstat.ts_status == 0) {
-				sc->sc_stats.ast_ant_tx[ds->ds_txstat.ts_antenna]++;
+				u_int8_t txant = ds->ds_txstat.ts_antenna;
+				sc->sc_stats.ast_ant_tx[txant]++;
+				sc->sc_ant_tx[txant]++;
 				if (ds->ds_txstat.ts_rate & HAL_TXSTAT_ALTRATE)
 					sc->sc_stats.ast_tx_altrate++;
 				sc->sc_stats.ast_tx_rssi =

==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#14 (text+ko) ====

@@ -217,6 +217,7 @@
 
 	u_int			sc_bhalq;	/* HAL q for outgoing beacons */
 	u_int			sc_bmisscount;	/* missed beacon transmits */
+	u_int32_t		sc_ant_tx[8];	/* recent tx frames/antenna */
 	struct ath_txq		*sc_cabq;	/* tx q for cab frames */
 	struct ath_buf		*sc_bcbuf;	/* beacon buffer */
 	struct ath_buf		*sc_bufptr;	/* allocated buffer ptr */


More information about the p4-projects mailing list