Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jun 2016 16:10:34 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301639 - head/sys/contrib/dev/ath/ath_hal/ar9300
Message-ID:  <201606081610.u58GAYjH097319@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Wed Jun  8 16:10:34 2016
New Revision: 301639
URL: https://svnweb.freebsd.org/changeset/base/301639

Log:
  [ath_hal] correctly initialise the CAB queue default value
  
  * Allow readyTime to just be programmed in directly
  * The beacon interval and all of the beacon timing sysctl's are in TU,
    not TSF.  So, we were doing the wrong math on the CAB programming
    in the first place.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c
==============================================================================
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c	Wed Jun  8 16:08:05 2016	(r301638)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c	Wed Jun  8 16:10:34 2016	(r301639)
@@ -422,11 +422,29 @@ ar9300_reset_tx_queue(struct ath_hal *ah
                         | AR_Q_MISC_CBR_INCR_DIS1
                         | AR_Q_MISC_CBR_INCR_DIS0);
 
-        value = TU_TO_USEC(qi->tqi_readyTime)
-                - (ah->ah_config.ah_sw_beacon_response_time
-                -  ah->ah_config.ah_dma_beacon_response_time)
-                - ah->ah_config.ah_additional_swba_backoff;
-        OS_REG_WRITE(ah, AR_QRDYTIMECFG(q), value | AR_Q_RDYTIMECFG_EN);
+        if (qi->tqi_readyTime) {
+            OS_REG_WRITE(ah, AR_QRDYTIMECFG(q),
+              SM(qi->tqi_readyTime, AR_Q_RDYTIMECFG_DURATION) |
+              AR_Q_RDYTIMECFG_EN);
+        } else {
+
+            value = (ahp->ah_beaconInterval * 50 / 100)
+              - ah->ah_config.ah_additional_swba_backoff
+              - ah->ah_config.ah_sw_beacon_response_time
+              + ah->ah_config.ah_dma_beacon_response_time;
+            /*
+             * XXX Ensure it isn't too low - nothing lower
+             * XXX than 10 TU
+             */
+            if (value < 10)
+                value = 10;
+            HALDEBUG(ah, HAL_DEBUG_TXQUEUE,
+              "%s: defaulting to rdytime = %d uS\n",
+              __func__, value);
+            OS_REG_WRITE(ah, AR_QRDYTIMECFG(q),
+              SM(TU_TO_USEC(value), AR_Q_RDYTIMECFG_DURATION) |
+              AR_Q_RDYTIMECFG_EN);
+        }
 
         OS_REG_WRITE(ah, AR_DMISC(q), OS_REG_READ(ah, AR_DMISC(q))
                     | (AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL <<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606081610.u58GAYjH097319>