From owner-svn-src-head@FreeBSD.ORG Mon Oct 15 00:07:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0BE9D874; Mon, 15 Oct 2012 00:07:19 +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 DF0AB8FC18; Mon, 15 Oct 2012 00:07:18 +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 q9F07IQv071308; Mon, 15 Oct 2012 00:07:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9F07IS5071306; Mon, 15 Oct 2012 00:07:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201210150007.q9F07IS5071306@svn.freebsd.org> From: Adrian Chadd Date: Mon, 15 Oct 2012 00:07:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241567 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2012 00:07:19 -0000 Author: adrian Date: Mon Oct 15 00:07:18 2012 New Revision: 241567 URL: http://svn.freebsd.org/changeset/base/241567 Log: Track the total number of software queued frames in an atomic variable stashed away in ath_node. As much as I tried to stuff that behind the ATH_NODE lock, unfortunately the locking is just too plain hairy (for me! And I wrote it!) to do cleanly. Hence using atomics here instead of a lock. The ATH_NODE lock just isn't currently used anywhere besides the rate control updates. If in the future everything gets migrated back to using a single ATH_NODE lock or a single global ATH_TX lock (ie, a single TX lock for all TX and TX completion) then fine, I'll remove the atomics. Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sun Oct 14 23:52:30 2012 (r241566) +++ head/sys/dev/ath/if_athvar.h Mon Oct 15 00:07:18 2012 (r241567) @@ -35,6 +35,8 @@ #ifndef _DEV_ATH_ATHVAR_H #define _DEV_ATH_ATHVAR_H +#include + #include #include #include @@ -175,6 +177,8 @@ struct ath_node { struct ath_tid an_tid[IEEE80211_TID_SIZE]; /* per-TID state */ char an_name[32]; /* eg "wlan0_a1" */ struct mtx an_mtx; /* protecting the ath_node state */ + uint32_t an_swq_depth; /* how many SWQ packets for this + node */ /* variable-length rate control state follows */ }; #define ATH_NODE(ni) ((struct ath_node *)(ni)) @@ -379,14 +383,17 @@ struct ath_txq { #define ATH_TID_INSERT_HEAD(_tq, _elm, _field) do { \ TAILQ_INSERT_HEAD(&(_tq)->tid_q, (_elm), _field); \ (_tq)->axq_depth++; \ + atomic_add_rel_32( &((_tq)->an)->an_swq_depth, 1); \ } while (0) #define ATH_TID_INSERT_TAIL(_tq, _elm, _field) do { \ TAILQ_INSERT_TAIL(&(_tq)->tid_q, (_elm), _field); \ (_tq)->axq_depth++; \ + atomic_add_rel_32( &((_tq)->an)->an_swq_depth, 1); \ } while (0) #define ATH_TID_REMOVE(_tq, _elm, _field) do { \ TAILQ_REMOVE(&(_tq)->tid_q, _elm, _field); \ (_tq)->axq_depth--; \ + atomic_subtract_rel_32( &((_tq)->an)->an_swq_depth, 1); \ } while (0) #define ATH_TID_FIRST(_tq) TAILQ_FIRST(&(_tq)->tid_q) #define ATH_TID_LAST(_tq, _field) TAILQ_LAST(&(_tq)->tid_q, _field) @@ -397,14 +404,17 @@ struct ath_txq { #define ATH_TID_FILT_INSERT_HEAD(_tq, _elm, _field) do { \ TAILQ_INSERT_HEAD(&(_tq)->filtq.tid_q, (_elm), _field); \ (_tq)->axq_depth++; \ + atomic_add_rel_32( &((_tq)->an)->an_swq_depth, 1); \ } while (0) #define ATH_TID_FILT_INSERT_TAIL(_tq, _elm, _field) do { \ TAILQ_INSERT_TAIL(&(_tq)->filtq.tid_q, (_elm), _field); \ (_tq)->axq_depth++; \ + atomic_add_rel_32( &((_tq)->an)->an_swq_depth, 1); \ } while (0) #define ATH_TID_FILT_REMOVE(_tq, _elm, _field) do { \ TAILQ_REMOVE(&(_tq)->filtq.tid_q, _elm, _field); \ (_tq)->axq_depth--; \ + atomic_subtract_rel_32( &((_tq)->an)->an_swq_depth, 1); \ } while (0) #define ATH_TID_FILT_FIRST(_tq) TAILQ_FIRST(&(_tq)->filtq.tid_q) #define ATH_TID_FILT_LAST(_tq, _field) TAILQ_LAST(&(_tq)->filtq.tid_q,_field)