From owner-svn-src-all@freebsd.org Wed Jun 8 16:10:35 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9ACAB6F670; Wed, 8 Jun 2016 16:10:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2DBE18E9; Wed, 8 Jun 2016 16:10:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u58GAYiD097320; Wed, 8 Jun 2016 16:10:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u58GAYjH097319; Wed, 8 Jun 2016 16:10:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201606081610.u58GAYjH097319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 8 Jun 2016 16:10:34 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 16:10:36 -0000 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 <<