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 <<
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to