summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2015-04-01 04:56:10 +0000
committeradrian <adrian@FreeBSD.org>2015-04-01 04:56:10 +0000
commitd443e8e753c7274bb056f559ff97e81fdeb345dc (patch)
tree86f3474bef8deab9ff0cfc31ada01b8e557359a3
parent2fdd06cb68b01a639d2846503e0e6cbe5357e66a (diff)
downloadFreeBSD-src-d443e8e753c7274bb056f559ff97e81fdeb345dc.zip
FreeBSD-src-d443e8e753c7274bb056f559ff97e81fdeb345dc.tar.gz
Expose the ANI state / statistics using the public ANI function, rather than
the ar9300_* definitions. .. which of course don't match, and athstats was reading garbage ANI data.
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h7
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c2
-rw-r--r--sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c24
3 files changed, 29 insertions, 4 deletions
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
index cb97a79..e63b517 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300.h
@@ -206,6 +206,7 @@ struct ar9300_ani_state {
#define DO_ANI(ah) \
((AH9300(ah)->ah_proc_phy_err & HAL_PROCESS_ANI))
+#if 0
struct ar9300_stats {
u_int32_t ast_ani_niup; /* ANI increased noise immunity */
u_int32_t ast_ani_nidown; /* ANI decreased noise immunity */
@@ -225,6 +226,7 @@ struct ar9300_stats {
HAL_MIB_STATS ast_mibstats; /* MIB counter stats */
HAL_NODE_STATS ast_nodestats; /* Latest rssi stats from driver */
};
+#endif
struct ar9300_rad_reader {
u_int16_t rd_index;
@@ -431,7 +433,7 @@ struct ath_hal_9300 {
u_int32_t ah_mask2Reg; /* copy of AR_IMR_S2 */
u_int32_t ah_msi_reg; /* copy of AR_PCIE_MSI */
os_atomic_t ah_ier_ref_count; /* reference count for enabling interrupts */
- struct ar9300_stats ah_stats; /* various statistics */
+ HAL_ANI_STATS ah_stats; /* various statistics */
RF_HAL_FUNCS ah_rf_hal;
u_int32_t ah_tx_desc_mask; /* mask for TXDESC */
u_int32_t ah_tx_ok_interrupt_mask;
@@ -887,6 +889,7 @@ struct ath_hal_9300 {
int ah_fccaifs;
int ah_reset_reason;
int ah_dcs_enable;
+ HAL_ANI_STATE ext_ani_state; /* FreeBSD; external facing ANI state */
struct ar9300NfLimits nf_2GHz;
struct ar9300NfLimits nf_5GHz;
@@ -1443,7 +1446,7 @@ extern void ar9300_disable_mib_counters(struct ath_hal *);
extern void ar9300_ani_attach(struct ath_hal *);
extern void ar9300_ani_detach(struct ath_hal *);
extern struct ar9300_ani_state *ar9300_ani_get_current_state(struct ath_hal *);
-extern struct ar9300_stats *ar9300_ani_get_current_stats(struct ath_hal *);
+extern HAL_ANI_STATS *ar9300_ani_get_current_stats(struct ath_hal *);
extern HAL_BOOL ar9300_ani_control(struct ath_hal *, HAL_ANI_CMD cmd, int param);
struct ath_rx_status;
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
index ff7b3f3..9c2c3ed 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c
@@ -210,7 +210,7 @@ ar9300_ani_get_current_state(struct ath_hal *ah)
/*
* Return the current statistics.
*/
-struct ar9300_stats *
+HAL_ANI_STATS *
ar9300_ani_get_current_stats(struct ath_hal *ah)
{
return &AH9300(ah)->ah_stats;
diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
index 21c98a1..e9caa43 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
@@ -1179,6 +1179,7 @@ ar9300_get_diag_state(struct ath_hal *ah, int request,
void **result, u_int32_t *resultsize)
{
struct ath_hal_9300 *ahp = AH9300(ah);
+ struct ar9300_ani_state *ani;
(void) ahp;
if (ath_hal_getdiagstate(ah, request, args, argsize, result, resultsize)) {
@@ -1219,14 +1220,35 @@ ar9300_get_diag_state(struct ath_hal *ah, int request,
return AH_TRUE;
#endif
case HAL_DIAG_ANI_CURRENT:
+
+ ani = ar9300_ani_get_current_state(ah);
+ if (ani == AH_NULL)
+ return AH_FALSE;
+ /* Convert ar9300 HAL to FreeBSD HAL ANI state */
+ /* XXX TODO: add all of these to the HAL ANI state structure */
+ bzero(&ahp->ext_ani_state, sizeof(ahp->ext_ani_state));
+ /* XXX should this be OFDM or CCK noise immunity level? */
+ ahp->ext_ani_state.noiseImmunityLevel = ani->ofdm_noise_immunity_level;
+ 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;
+ /* mrc_cck_off */
+ /* cck_noise_immunity_level */
+
+ ahp->ext_ani_state.listenTime = ani->listen_time;
+
+ *result = &ahp->ext_ani_state;
+ *resultsize = sizeof(ahp->ext_ani_state);
+#if 0
*result = ar9300_ani_get_current_state(ah);
*resultsize = (*result == AH_NULL) ?
0 : sizeof(struct ar9300_ani_state);
+#endif
return AH_TRUE;
case HAL_DIAG_ANI_STATS:
*result = ar9300_ani_get_current_stats(ah);
*resultsize = (*result == AH_NULL) ?
- 0 : sizeof(struct ar9300_stats);
+ 0 : sizeof(HAL_ANI_STATS);
return AH_TRUE;
case HAL_DIAG_ANI_CMD:
if (argsize != 2*sizeof(u_int32_t)) {
OpenPOWER on IntegriCloud