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.
This commit is contained in:
adrian 2015-04-01 04:56:10 +00:00
parent 2fdd06cb68
commit d443e8e753
3 changed files with 29 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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)) {