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 <machine/atomic.h>
+
 #include <dev/ath/ath_hal/ah.h>
 #include <dev/ath/ath_hal/ah_desc.h>
 #include <net80211/ieee80211_radiotap.h>
@@ -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)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to