Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jun 2011 08:03:44 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r222979 - user/adrian/if_ath_tx/sys/dev/ath
Message-ID:  <201106110803.p5B83ild064699@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Jun 11 08:03:44 2011
New Revision: 222979
URL: http://svn.freebsd.org/changeset/base/222979

Log:
  Some further digging shows that net80211 already takes care of refcounting
  the TX node references for me, so in theory (!) I shouldn't seen a node free
  until all pending TX packets have completed.
  
  For now, leave the functions in there which I was going to write to do this
  (primarily so I can have some checks before I do free the state!)
  
  Whilst I'm here, add a TID reference. Between this and the bf_node
  reference, enough information should (eventually) be available now for
  a completed packet (success, failure, filtered) to be matched back to
  its source node/TID queue.

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

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Sat Jun 11 07:42:18 2011	(r222978)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Sat Jun 11 08:03:44 2011	(r222979)
@@ -1319,11 +1319,9 @@ ath_tx_tid_init(struct ath_softc *sc, st
  * Mark packets currently in the hardware TXQ from this TID
  * as now having no parent software TXQ.
  *
- * This is done when an ath_node goes away so any pending
- * packets going out to the device are simply freed, rather
- * than referencing some now-nonexisting ath_node.
- *
- * XXX make sure that access to the hardware TXQ is correctly locked!
+ * XXX not yet needed; there shouldn't be any packets left
+ * XXX for this node in any of the hardware queues; the node
+ * XXX isn't freed until the last TX packet has been sent.
  */
 static void
 ath_tx_tid_txq_unmark(struct ath_softc *sc, struct ath_node *an,
@@ -1333,15 +1331,32 @@ ath_tx_tid_txq_unmark(struct ath_softc *
 }
 
 /*
+ * Free any packets currently pending in the software TX queue.
+ *
+ * Since net80211 shouldn't free the node until the last packets
+ * have been sent, this function should never have to free any
+ * packets.
+ */
+static void
+ath_tx_tid_free_pkts(struct ath_softc *sc, struct ath_node *an,
+    int tid)
+{
+	struct ath_tid *atid = &an->an_tid[tid];
+	struct ieee80211_node *ni = &an->an_node;
+
+	/* XXX TODO */
+	/* For now, just print a loud warning if it occurs */
+	if (! STAILQ_EMPTY(&atid->axq_q))
+		device_printf(sc->sc_dev, "%s: AID %d TID %d queue not "
+		    "empty on queue destroy!\n",
+		    __func__, ni->ni_associd, tid);
+}
+
+/*
  * Free the per-TID node state.
  *
  * This frees any packets currently in the software queue and frees
  * any other TID state.
- *
- * Since node destruction currenty doesn't wait for the last
- * packets to be xmited, there needs to be a good place to
- * mark packets currently in the hardware TX queue as
- * now having no parent node!
  */
 void
 ath_tx_tid_cleanup(struct ath_softc *sc, struct ath_node *an)
@@ -1353,6 +1368,7 @@ ath_tx_tid_cleanup(struct ath_softc *sc,
 		atid = &an->an_tid[i];
 
 		/* Free packets in sw queue */
+		ath_tx_tid_free_pkts(sc, an, i);
 
 		/* Mark hw-queued packets as having no parent now */
 		ath_tx_tid_txq_unmark(sc, an, i);

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Sat Jun 11 07:42:18 2011	(r222978)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Sat Jun 11 08:03:44 2011	(r222979)
@@ -150,6 +150,7 @@ struct ath_buf {
 		int bfs_hdrlen;		/* length of this packet header */
 		int bfs_seqno;		/* sequence number of this packet */
 		int bfs_retries;	/* retry count */
+		uint16_t bfs_tid;	/* packet TID (or TID_MAX for no QoS) */
 		uint16_t bfs_al;	/* length of aggregate */
 		uint16_t bfs_pktdur;	/* packet duration (at current rate?) */
 		uint16_t bfs_nframes;	/* number of frames in aggregate */



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