From owner-svn-src-user@FreeBSD.ORG  Sat Jun 11 12:47:05 2011
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04634106564A;
	Sat, 11 Jun 2011 12:47:05 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E9B668FC08;
	Sat, 11 Jun 2011 12:47:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5BCl4RM075756;
	Sat, 11 Jun 2011 12:47:04 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5BCl4Ku075754;
	Sat, 11 Jun 2011 12:47:04 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201106111247.p5BCl4Ku075754@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Sat, 11 Jun 2011 12:47:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r222985 - user/adrian/if_ath_tx/sys/dev/ath
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 11 Jun 2011 12:47:05 -0000

Author: adrian
Date: Sat Jun 11 12:47:04 2011
New Revision: 222985
URL: http://svn.freebsd.org/changeset/base/222985

Log:
  Make the qdepth add/sub atomic, but the qdepth check isn't yet atomic.
  I'll leave it like that for now until I better understand what, if any,
  locking is done with ath_node / ieee80211_node.
  
  Flip on the software TX queue dispatch.

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

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 12:41:03 2011	(r222984)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Sat Jun 11 12:47:04 2011	(r222985)
@@ -937,7 +937,7 @@ ath_tx_start(struct ath_softc *sc, struc
 	/* Fill in the details in the descriptor list */
 	ath_tx_chaindesclist(sc, txq, bf);
 
-#if 0
+#if 1
 	/* add to software queue */
 	ath_tx_swq(sc, ni, bf, m0);
 #else
@@ -1294,8 +1294,7 @@ ath_tx_swq(struct ath_softc *sc, struct 
 	ATH_TXQ_UNLOCK(atid);
 
 	/* Bump queued packet counter */
-	/* XXX does this have to be atomic? */
-	an->an_qdepth++;
+	atomic_add_int(&an->an_qdepth, 1);
 
 	/* Mark the given node/tid as having packets to dequeue */
 	ATH_LOCK(sc);
@@ -1434,8 +1433,8 @@ ath_tx_tid_hw_queue(struct ath_softc *sc
 		ATH_TXQ_REMOVE_HEAD(atid, bf_list);
 		ATH_TXQ_UNLOCK(atid);
 
-		/* XXX does this have to be atomic? */
-		an->an_qdepth--;
+		/* Remove from queue */
+		atomic_subtract_int(&an->an_qdepth, 1);
 
 		txq = bf->bf_state.bfs_txq;
 		/* Sanity check! */
@@ -1470,6 +1469,9 @@ ath_tx_hw_queue(struct ath_softc *sc, st
 	}
 }
 
+/*
+ * XXX this needs to be atomic or ath_node locked
+ */
 static int
 ath_txq_node_qlen(struct ath_softc *sc, struct ath_node *an)
 {