From owner-svn-src-head@freebsd.org Wed Mar 6 08:52:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11D8B1508D15; Wed, 6 Mar 2019 08:52:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC33C835B0; Wed, 6 Mar 2019 08:52:02 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2A951293; Wed, 6 Mar 2019 08:52:02 +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 x268q2e4001615; Wed, 6 Mar 2019 08:52:02 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x268q2Iq001613; Wed, 6 Mar 2019 08:52:02 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201903060852.x268q2Iq001613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 6 Mar 2019 08:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344843 - head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Commit-Revision: 344843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CC33C835B0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2019 08:52:03 -0000 Author: adrian Date: Wed Mar 6 08:52:02 2019 New Revision: 344843 URL: https://svnweb.freebsd.org/changeset/base/344843 Log: [ath_hal_ar9300] Add the missing bits from the previous HAL commit. Noticed by: 75+ emails telling me I messed up. Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c Wed Mar 6 07:58:19 2019 (r344842) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c Wed Mar 6 08:52:02 2019 (r344843) @@ -462,13 +462,55 @@ ar9300_ani_control(struct ath_hal *ah, HAL_ANI_CMD cmd u_int level = param; u_int is_on; + HALDEBUG(ah, HAL_DEBUG_ANI, "%s: cmd=%d, param=%d, chan=%p, funcmask=0x%08x\n", + __func__, + cmd, + param, + chan, + ahp->ah_ani_function); + + if (chan == NULL && cmd != HAL_ANI_MODE) { HALDEBUG(ah, HAL_DEBUG_UNMASKABLE, "%s: ignoring cmd 0x%02x - no channel\n", __func__, cmd); return AH_FALSE; } - switch (cmd & ahp->ah_ani_function) { + /* + * These two control the top-level cck/ofdm immunity levels and will + * program the rest of the values. + */ + if (cmd == HAL_ANI_NOISE_IMMUNITY_LEVEL) { + if (param > HAL_ANI_OFDM_NUM_LEVEL) + return AH_FALSE; + ar9300_ani_set_odfm_noise_immunity_level(ah, param); + return AH_TRUE; + } + + if (cmd == HAL_ANI_CCK_NOISE_IMMUNITY_LEVEL) { + if (param > HAL_ANI_CCK_NUM_LEVEL) + return AH_FALSE; + ar9300_ani_set_cck_noise_immunity_level(ah, param); + return AH_TRUE; + } + + /* + * Check to see if this command is available in the + * current operating mode. + */ + if (((1 << cmd) & ahp->ah_ani_function) == 0) { + HALDEBUG(ah, HAL_DEBUG_ANI, + "%s: early check: invalid cmd 0x%02x (allowed=0x%02x)\n", + __func__, cmd, ahp->ah_ani_function); + return AH_FALSE; + } + + /* + * The rest of these program in the requested parameter values + * into the PHY. + */ + switch (cmd) { + case HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION: { int m1_thresh_low, m2_thresh_low; @@ -887,13 +929,16 @@ ar9300_ani_reset(struct ath_hal *ah, HAL_BOOL is_scann /* only allow a subset of functions in AP mode */ if (AH_PRIVATE(ah)->ah_opmode == HAL_M_HOSTAP) { if (IS_CHAN_2GHZ(ichan)) { - ahp->ah_ani_function = (HAL_ANI_SPUR_IMMUNITY_LEVEL | - HAL_ANI_FIRSTEP_LEVEL | - HAL_ANI_MRC_CCK); + ahp->ah_ani_function = (1 << HAL_ANI_SPUR_IMMUNITY_LEVEL) | + (1 << HAL_ANI_FIRSTEP_LEVEL) | + (1 << HAL_ANI_MRC_CCK); } else { ahp->ah_ani_function = 0; } + } else { + ahp->ah_ani_function = HAL_ANI_ALL; } + /* always allow mode (on/off) to be controlled */ ahp->ah_ani_function |= HAL_ANI_MODE; Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Wed Mar 6 07:58:19 2019 (r344842) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Wed Mar 6 08:52:02 2019 (r344843) @@ -1268,7 +1268,7 @@ ar9300_get_diag_state(struct ath_hal *ah, int request, ahp->ext_ani_state.spurImmunityLevel = ani->spur_immunity_level; ahp->ext_ani_state.firstepLevel = ani->firstep_level; ahp->ext_ani_state.ofdmWeakSigDetectOff = ani->ofdm_weak_sig_detect_off; - ahp->ext_ani_state.mrcCckOff = ani->mrc_cck_off; + ahp->ext_ani_state.mrcCck = !! ani->mrc_cck_off; ahp->ext_ani_state.cckNoiseImmunityLevel = ani->cck_noise_immunity_level; ahp->ext_ani_state.listenTime = ani->listen_time; @@ -1287,12 +1287,18 @@ ar9300_get_diag_state(struct ath_hal *ah, int request, 0 : sizeof(HAL_ANI_STATS); return AH_TRUE; case HAL_DIAG_ANI_CMD: + { + HAL_ANI_CMD savefunc = ahp->ah_ani_function; if (argsize != 2*sizeof(u_int32_t)) { return AH_FALSE; } + /* temporarly allow all functions so we can override */ + ahp->ah_ani_function = HAL_ANI_ALL; ar9300_ani_control( ah, ((const u_int32_t *)args)[0], ((const u_int32_t *)args)[1]); + ahp->ah_ani_function = savefunc; return AH_TRUE; + } #if 0 case HAL_DIAG_TXCONT: /*AR9300_CONTTXMODE(ah, (struct ath_desc *)args, argsize );*/