From owner-svn-src-user@FreeBSD.ORG Wed Aug 3 07:36:10 2011 Return-Path: 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 8FD7A1065743; Wed, 3 Aug 2011 07:36:10 +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 658E98FC12; Wed, 3 Aug 2011 07:36:10 +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 p737aAub091730; Wed, 3 Aug 2011 07:36:10 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p737aAD1091728; Wed, 3 Aug 2011 07:36:10 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108030736.p737aAD1091728@svn.freebsd.org> From: Adrian Chadd Date: Wed, 3 Aug 2011 07:36:10 +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: r224626 - 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 " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2011 07:36:10 -0000 Author: adrian Date: Wed Aug 3 07:36:10 2011 New Revision: 224626 URL: http://svn.freebsd.org/changeset/base/224626 Log: Since the hardware TXQ lock now protects all the node TIDs that are behind it, the completion functions also need protecting by the same lock. So, shuffle the TXQ lock to protect the whole loop, including the TXQ dequeue, completion check/function, and txq schedule. 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 Wed Aug 3 07:00:55 2011 (r224625) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Wed Aug 3 07:36:10 2011 (r224626) @@ -4144,12 +4144,11 @@ ath_tx_processq(struct ath_softc *sc, st (caddr_t)(uintptr_t) ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum), txq->axq_link); nacked = 0; + ATH_TXQ_LOCK(txq); for (;;) { - ATH_TXQ_LOCK(txq); txq->axq_intrcnt = 0; /* reset periodic desc intr count */ bf = STAILQ_FIRST(&txq->axq_q); if (bf == NULL) { - ATH_TXQ_UNLOCK(txq); break; } ds0 = &bf->bf_desc[0]; @@ -4162,7 +4161,6 @@ ath_tx_processq(struct ath_softc *sc, st status == HAL_OK); #endif if (status == HAL_EINPROGRESS) { - ATH_TXQ_UNLOCK(txq); break; } ATH_TXQ_REMOVE_HEAD(txq, bf_list); @@ -4179,7 +4177,6 @@ ath_tx_processq(struct ath_softc *sc, st if (txq->axq_depth == 0) #endif txq->axq_link = NULL; - ATH_TXQ_UNLOCK(txq); ni = bf->bf_node; /* @@ -4223,16 +4220,6 @@ ath_tx_processq(struct ath_softc *sc, st #endif /* Kick the TXQ scheduler */ - /* - * XXX for now, (whilst the completion functions aren't doing anything), - * XXX re-lock the hardware txq here. - * - * Later on though, those completion functions may grovel around - * in the per-tid state. That's going to require locking. - * The reference code kept TXQ locked for the whole of this duration - * so the completion functions didn't race. - */ - ATH_TXQ_LOCK(txq); ath_txq_sched(sc, txq); ATH_TXQ_UNLOCK(txq);