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

Adrian Chadd adrian at FreeBSD.org
Sun Jun 5 14:46:42 UTC 2011


Author: adrian
Date: Sun Jun  5 14:46:42 2011
New Revision: 222717
URL: http://svn.freebsd.org/changeset/base/222717

Log:
  More software TX queue preparation changes
  
  * move the TX queue out from the hardware txq and to the softc for now
  * begin fleshing out the very basic software tx queue functions

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/if_ath.c
  user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
  user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.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	Sun Jun  5 14:13:15 2011	(r222716)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Sun Jun  5 14:46:42 2011	(r222717)
@@ -739,6 +739,9 @@ ath_attach(u_int16_t devid, struct ath_s
 	ath_sysctlattach(sc);
 	ath_sysctl_stats_attach(sc);
 
+	/* Setup software TX queue related bits */
+	STAILQ_INIT(&sc->sc_txnodeq);
+
 	if (bootverbose)
 		ieee80211_announce(ic);
 	ath_announce(sc);
@@ -3736,7 +3739,6 @@ ath_txq_init(struct ath_softc *sc, struc
 	txq->axq_intrcnt = 0;
 	txq->axq_link = NULL;
 	STAILQ_INIT(&txq->axq_q);
-	STAILQ_INIT(&txq->axq_nodeq);
 	ATH_TXQ_LOCK_INIT(sc, txq);
 }
 

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	Sun Jun  5 14:13:15 2011	(r222716)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Sun Jun  5 14:46:42 2011	(r222717)
@@ -1122,3 +1122,64 @@ bad:
 	ieee80211_free_node(ni);
 	return error;
 }
+
+
+/* Per-node software queue operations */
+
+/*
+ * Mark the current node/TID as ready to TX.
+ *
+ * This is done to make it easy for the software scheduler to 
+ * find which nodes/TIDs have data to send.
+ */
+static void
+ath_tx_node_sched(struct ath_softc *sc, struct ath_node *an, int tid)
+{
+	/*
+	 * For now, the node is marked as ready;
+	 * later code will also maintain a per-TID list.
+	 */
+	if (an->sched)
+		return;		/* already scheduled */
+
+	STAILQ_INSERT_TAIL(&sc->sc_txnodeq, an, an_list);
+}
+
+/*
+ * Queue the given packet on the relevant software queue.
+ *
+ * This however doesn't queue the packet to the hardware!
+ */
+void
+ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
+    struct mbuf *m0)
+{
+	struct ath_node *an = ATH_NODE(ni);
+	struct ieee80211_frame *wh;
+	struct ath_tid *atid;
+	int tid;
+
+	/* Fetch the TID - non-QoS frames get assigned to TID 16 */
+	wh = mtod(m0, struct ieee80211_frame *);
+	tid = ieee80211_gettid(wh);
+	atid = &an->an_tid[tid];
+
+	/* Queue frame to the tail of the software queue */
+	ATH_TXQ_INSERT_TAIL(atid, bf, bf_list);
+
+	/* Mark the given node/tid as having packets to dequeue */
+	ath_tx_node_sched(sc, an, tid);
+}
+
+/*
+ * Do the basic frame setup stuff that's required before the frame
+ * is added to a software queue.
+ *
+ * All frames get mostly the same treatment and it's done once.
+ * Retransmits fiddle with things like the rate control setup,
+ * setting the retransmit bit in the packet; doing relevant DMA/bus
+ * syncing and relinking it (back) into the hardware TX queue.
+ *
+ * Note that this may cause the mbuf to be reallocated, so
+ * m0 may not be valid.
+ */

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.h	Sun Jun  5 14:13:15 2011	(r222716)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.h	Sun Jun  5 14:46:42 2011	(r222717)
@@ -41,4 +41,8 @@ extern int ath_tx_start(struct ath_softc
 extern int ath_raw_xmit(struct ieee80211_node *ni, struct mbuf *m,
     const struct ieee80211_bpf_params *params);
 
+/* software queue stuff */
+extern void ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni,
+    struct ath_buf *bf, struct mbuf *m0);
+
 #endif

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Sun Jun  5 14:13:15 2011	(r222716)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Sun Jun  5 14:46:42 2011	(r222717)
@@ -91,7 +91,8 @@ struct ath_buf;
  * Note that TID 16 (WME_NUM_TID+1) is for handling non-QoS frames.
  */
 struct ath_tid {
-	STAILQ_HEAD(ath_tid_bq,ath_buf) buf_q;		/* pending buffers        */
+	STAILQ_HEAD(,ath_buf) axq_q;		/* pending buffers        */
+	u_int			axq_depth;	/* queue depth (stat only) */
 	struct ath_buf *tx_buf[ATH_TID_MAX_BUFS];	/* active tx buffers, beginning at current BAW */
 };
 
@@ -194,7 +195,6 @@ struct ath_txq {
 	u_int			axq_intrcnt;	/* interrupt count */
 	u_int32_t		*axq_link;	/* link ptr in last TX desc */
 	STAILQ_HEAD(, ath_buf)	axq_q;		/* transmit queue */
-	STAILQ_HEAD(, ath_node)	axq_nodeq;	/* Nodes which have traffic to send */
 	struct mtx		axq_lock;	/* lock on q and link */
 	char			axq_name[12];	/* e.g. "ath0_txq4" */
 };
@@ -396,6 +396,9 @@ struct ath_softc {
 	/* DFS related state */
 	void			*sc_dfs;	/* Used by an optional DFS module */
 	struct task		sc_dfstask;	/* DFS processing task */
+
+	/* Software TX queue related state */
+	STAILQ_HEAD(, ath_node)	sc_txnodeq;	/* Nodes which have traffic to send */
 };
 
 #define	ATH_LOCK_INIT(_sc) \


More information about the svn-src-user mailing list