Author: adrian
Date: Mon Apr 18 12:15:43 2011
New Revision: 220772
URL: http://svn.freebsd.org/changeset/base/220772

Log:
  Add global TX timeout handling.
  
  The global TX timeout counter increments whenever a frame is ready
  to be transmitted and the medium is busy.

Modified:
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_athioctl.h
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h       Mon Apr 18 11:25:13 2011        
(r220771)
+++ head/sys/dev/ath/ath_hal/ah.h       Mon Apr 18 12:15:43 2011        
(r220772)
@@ -123,6 +123,7 @@ typedef enum {
        HAL_CAP_SPLIT_4KB_TRANS = 40,   /* hardware supports descriptors 
straddling a 4k page boundary */
        HAL_CAP_HAS_PSPOLL      = 41,   /* hardware has ps-poll support */
        HAL_CAP_RXDESC_SELFLINK = 42,   /* support a self-linked tail RX 
descriptor */
+       HAL_CAP_GTXTO           = 43,   /* hardware supports global tx timeout 
*/
 } HAL_CAPABILITY_TYPE;
 
 /* 

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c       Mon Apr 18 11:25:13 
2011        (r220771)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c       Mon Apr 18 12:15:43 
2011        (r220772)
@@ -275,6 +275,8 @@ ar5416GetCapability(struct ath_hal *ah, 
         uint32_t capability, uint32_t *result)
 {
        switch (type) {
+       case HAL_CAP_GTXTO:
+               return HAL_OK;          /* All AR5416+ supports Global TX 
Timeout */
        case HAL_CAP_BB_HANG:
                switch (capability) {
                case HAL_BB_HANG_RIFS:

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c      Mon Apr 18 11:25:13 
2011        (r220771)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c      Mon Apr 18 12:15:43 
2011        (r220772)
@@ -605,10 +605,8 @@ ar5416InitUserSettings(struct ath_hal *a
                ar5212SetCTSTimeout(ah, ahp->ah_ctstimeout);
        if (AH_PRIVATE(ah)->ah_diagreg != 0)
                OS_REG_WRITE(ah, AR_DIAG_SW, AH_PRIVATE(ah)->ah_diagreg);
-#if 0 /* XXX Todo */
-       if (ahp->ah_globaltxtimeout != (u_int) -1)
-               ar5416SetGlobalTxTimeout(ah, ahp->ah_globaltxtimeout);
-#endif
+       if (AH5416(ah)->ah_globaltxtimeout != (u_int) -1)
+               ar5416SetGlobalTxTimeout(ah, AH5416(ah)->ah_globaltxtimeout);
 }
 
 static void

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c   Mon Apr 18 11:25:13 2011        (r220771)
+++ head/sys/dev/ath/if_ath.c   Mon Apr 18 12:15:43 2011        (r220772)
@@ -1355,6 +1355,8 @@ ath_intr(void *arg)
                        sc->sc_stats.ast_bmiss++;
                        taskqueue_enqueue(sc->sc_tq, &sc->sc_bmisstask);
                }
+               if (status & HAL_INT_GTT)
+                       sc->sc_stats.ast_tx_timeout++;
                if (status & HAL_INT_MIB) {
                        sc->sc_stats.ast_mib++;
                        /*
@@ -1559,6 +1561,10 @@ ath_init(void *arg)
        if (sc->sc_needmib && ic->ic_opmode == IEEE80211_M_STA)
                sc->sc_imask |= HAL_INT_MIB;
 
+       /* Enable global TX timeout statistics if available */
+       if (ath_hal_gtxto_supported(ah))
+               sc->sc_imask |= (HAL_INT_GTT & HAL_INT_BMISC);
+
        ifp->if_drv_flags |= IFF_DRV_RUNNING;
        callout_reset(&sc->sc_wd_ch, hz, ath_watchdog, sc);
        ath_hal_intrset(ah, sc->sc_imask);

Modified: head/sys/dev/ath/if_ath_sysctl.c
==============================================================================
--- head/sys/dev/ath/if_ath_sysctl.c    Mon Apr 18 11:25:13 2011        
(r220771)
+++ head/sys/dev/ath/if_ath_sysctl.c    Mon Apr 18 12:15:43 2011        
(r220772)
@@ -705,6 +705,8 @@ ath_sysctl_stats_attach(struct ath_softc
            &sc->sc_stats.ast_tx_htprotect, 0, "HT tx frames with protection");
        SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_rx_hitqueueend", CTLFLAG_RD,
            &sc->sc_stats.ast_rx_hitqueueend, 0, "RX hit queue end");
+       SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "ast_tx_timeout", CTLFLAG_RD,
+           &sc->sc_stats.ast_tx_timeout, 0, "TX Global Timeout");
 
        /* Attach the RX phy error array */
        ath_sysctl_stats_attach_rxphyerr(sc, child);

Modified: head/sys/dev/ath/if_athioctl.h
==============================================================================
--- head/sys/dev/ath/if_athioctl.h      Mon Apr 18 11:25:13 2011        
(r220771)
+++ head/sys/dev/ath/if_athioctl.h      Mon Apr 18 12:15:43 2011        
(r220772)
@@ -129,7 +129,8 @@ struct ath_stats {
        u_int32_t       ast_rx_hi_rx_chain;
        u_int32_t       ast_tx_htprotect;       /* HT tx frames with protection 
*/
        u_int32_t       ast_rx_hitqueueend;
-       u_int32_t       ast_pad[2];
+       u_int32_t       ast_tx_timeout;         /* Global TX timeout */
+       u_int32_t       ast_pad[1];
 };
 
 #define        SIOCGATHSTATS   _IOWR('i', 137, struct ifreq)

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h        Mon Apr 18 11:25:13 2011        
(r220771)
+++ head/sys/dev/ath/if_athvar.h        Mon Apr 18 12:15:43 2011        
(r220772)
@@ -649,6 +649,8 @@ void        ath_intr(void *);
        (ath_hal_getcapability(_ah, HAP_CAP_SPLIT_4KB_TRANS, 0, NULL) == HAL_OK)
 #define        ath_hal_self_linked_final_rxdesc(_ah) \
        (ath_hal_getcapability(_ah, HAL_CAP_RXDESC_SELFLINK, 0, NULL) == HAL_OK)
+#define        ath_hal_gtxto_supported(_ah) \
+       (ath_hal_getcapability(_ah, HAL_CAP_GTXTO, 0, NULL) == HAL_OK)
 
 #define        ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \
        ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq)))
_______________________________________________
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