From owner-svn-src-user@FreeBSD.ORG  Tue Oct  4 17:32:01 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 D99F4106566B;
	Tue,  4 Oct 2011 17:32:01 +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 B03348FC0C;
	Tue,  4 Oct 2011 17:32:01 +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 p94HW1xT072127;
	Tue, 4 Oct 2011 17:32:01 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.4/8.14.4/Submit) id p94HW1hG072125;
	Tue, 4 Oct 2011 17:32:01 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <201110041732.p94HW1hG072125@svn.freebsd.org>
From: Adrian Chadd <adrian@FreeBSD.org>
Date: Tue, 4 Oct 2011 17:32:01 +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: r226017 - 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: Tue, 04 Oct 2011 17:32:01 -0000

Author: adrian
Date: Tue Oct  4 17:32:01 2011
New Revision: 226017
URL: http://svn.freebsd.org/changeset/base/226017

Log:
  Don't bother updating the txq active bitmap every call to ath_intr(),
  just do it when HAL_INT_TX is set. This should have the same behaviour.

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

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Tue Oct  4 17:27:10 2011	(r226016)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Tue Oct  4 17:32:01 2011	(r226017)
@@ -1382,29 +1382,6 @@ ath_intr(void *arg)
 	    ah->ah_intrstate[6]);
 	status &= sc->sc_imask;			/* discard unasked for bits */
 
-	/*
-	 * This has now updated the txqactive bits, so
-	 * we should fetch them from the HAL and merge them
-	 * into sc->sc_txq_active. That way we won't miss out
-	 * where one CPU clears the txq bit whilst the other CPU
-	 * sets it.
-	 *
-	 * The HAL updates it if the relevant TX status bits are set
-	 * in the status registers, regardless of whether the status
-	 * caused the interrupt and/or is set in sc_imask.
-	 * Hence we update the bits before we check for status == 0.
-	 */
-	ATH_LOCK(sc);
-	/*
-	 * This returns the txq bits in the given mask and blanks them.
-	 * Since it's only ever set and cleared by the HAL and we are now
-	 * doing it in ath_intr(), it's effectively non-racey.
-	 */
-	txqs = 0xffffffff;
-	ath_hal_gettxintrtxqs(sc->sc_ah, &txqs);
-	sc->sc_txq_active |= txqs;
-	ATH_UNLOCK(sc);
-
 	/* Short-circuit un-handled interrupts */
 	if (status == 0x0)
 		return;
@@ -1501,6 +1478,17 @@ ath_intr(void *arg)
 		if (status & HAL_INT_TX) {
 			sc->sc_stats.ast_tx_intr++;
 			taskqueue_enqueue_fast(sc->sc_tq, &sc->sc_txtask);
+
+			/*
+			 * Grab all the currently set bits in the HAL txq bitmap
+			 * and blank them. This is the only place we should be
+			 * doing this.
+			 */
+			ATH_LOCK(sc);
+			txqs = 0xffffffff;
+			ath_hal_gettxintrtxqs(sc->sc_ah, &txqs);
+			sc->sc_txq_active |= txqs;
+			ATH_UNLOCK(sc);
 		}
 		if (status & HAL_INT_BMISS) {
 			sc->sc_stats.ast_bmiss++;