svn commit: r223048 - user/adrian/if_ath_tx/sys/dev/ath

Adrian Chadd adrian at FreeBSD.org
Mon Jun 13 13:40:12 UTC 2011


Author: adrian
Date: Mon Jun 13 13:40:12 2011
New Revision: 223048
URL: http://svn.freebsd.org/changeset/base/223048

Log:
  Break out some more of the common TX completion handling code.
  
  Introduce a ath_buf completion handler. This will be set by the
  aggregation code to signal that it wants the buffer for further
  processing rather than simply free'ing it. It'll use this
  opportunity to check the BA if applicable, handle retries, etc.

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/if_ath.c
  user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h
  user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Mon Jun 13 13:28:31 2011	(r223047)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Mon Jun 13 13:40:12 2011	(r223048)
@@ -4025,6 +4025,21 @@ ath_tx_update_stats(struct ath_softc *sc
 
 }
 
+void
+ath_tx_default_comp(struct ath_softc *sc, struct ath_buf *bf)
+{
+	struct ath_tx_status *ts = &bf->bf_status.ds_txstat;
+	/*
+	 * Do any tx complete callback.  Note this must
+	 * be done before releasing the node reference.
+	 * This will free the mbuf, release the net80211
+	 * node and recycle the ath_buf.
+	 */
+	ath_tx_freebuf(sc, bf,
+	    ((bf->bf_txflags & HAL_TXDESC_NOACK) == 0) ?
+	        ts->ts_status : HAL_TXERR_XRETRY);
+}
+
 /*
  * Process completed xmit descriptors from the specified queue.
  */
@@ -4083,6 +4098,20 @@ ath_tx_processq(struct ath_softc *sc, st
 		ATH_TXQ_UNLOCK(txq);
 
 		ni = bf->bf_node;
+		/*
+		 * If unicast frame was ack'd update RSSI,
+		 * including the last rx time used to
+		 * workaround phantom bmiss interrupts.
+		 */
+		if (ni != NULL && ts->ts_status == 0 &&
+		    ((bf->bf_txflags & HAL_TXDESC_NOACK) == 0)) {
+			nacked++;
+			sc->sc_stats.ast_tx_rssi = ts->ts_rssi;
+			ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi,
+				ts->ts_rssi);
+		}
+
+		/* If unicast frame, update general statistics */
 		if (ni != NULL) {
 			an = ATH_NODE(ni);
 			/* update statistics */
@@ -4092,29 +4121,14 @@ ath_tx_processq(struct ath_softc *sc, st
 			 * Hand the descriptor to the rate control algorithm.
 			 */
 			if ((ts->ts_status & HAL_TXERR_FILT) == 0 &&
-			    (bf->bf_txflags & HAL_TXDESC_NOACK) == 0) {
-				/*
-				 * If frame was ack'd update statistics,
-				 * including the last rx time used to
-				 * workaround phantom bmiss interrupts.
-				 */
-				if (ts->ts_status == 0) {
-					nacked++;
-					sc->sc_stats.ast_tx_rssi = ts->ts_rssi;
-					ATH_RSSI_LPF(sc->sc_halstats.ns_avgtxrssi,
-						ts->ts_rssi);
-				}
+			    (bf->bf_txflags & HAL_TXDESC_NOACK) == 0)
 				ath_rate_tx_complete(sc, an, bf);
-			}
 		}
-		/*
-		 * Do any tx complete callback.  Note this must
-		 * be done before releasing the node reference.
-		 * This will free the node as well.
-		 */
-		ath_tx_freebuf(sc, bf,
-		    ((bf->bf_txflags & HAL_TXDESC_NOACK) == 0) ?
-		        ts->ts_status : HAL_TXERR_XRETRY);
+
+		if (bf->bf_comp == NULL)
+			ath_tx_default_comp(sc, bf);
+		else
+			bf->bf_comp(sc, bf);
 	}
 #ifdef IEEE80211_SUPPORT_SUPERG
 	/*

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h	Mon Jun 13 13:28:31 2011	(r223047)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h	Mon Jun 13 13:40:12 2011	(r223048)
@@ -55,6 +55,7 @@ extern struct ath_buf * _ath_getbuf_lock
 
 extern int ath_reset(struct ifnet *);
 extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq);
+extern void ath_tx_default_comp(struct ath_softc *sc, struct ath_buf *bf);
 extern void ath_tx_freebuf(struct ath_softc *sc, struct ath_buf *bf,
     int status);
 

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Mon Jun 13 13:28:31 2011	(r223047)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Mon Jun 13 13:40:12 2011	(r223048)
@@ -147,6 +147,9 @@ struct ath_buf {
 #define	ATH_MAX_SCATTER		ATH_TXDESC	/* max(tx,rx,beacon) desc's */
 	bus_dma_segment_t	bf_segs[ATH_MAX_SCATTER];
 
+	/* Completion function to call on TX complete (fail or not) */
+	void(* bf_comp) (struct ath_softc *sc, struct ath_buf *bf);
+
 	/* This state is kept to support software retries and aggregation */
 	struct {
 		int bfs_pktlen;		/* length of this packet */


More information about the svn-src-user mailing list