Author: adrian
Date: Wed Apr  1 03:42:46 2015
New Revision: 280940
URL: https://svnweb.freebsd.org/changeset/base/280940

Log:
  Start the process of migrating the ANI statistics out of the HALs and into
  the top-level HAL.
  
  The athstats program is blindly using a copy of the ar5212 ANI stats structure
  to pull out ANI statistics/state and this is problematic for the AR9300
  HAL.
  
  So:
  
  * Define HAL_ANI_STATS and HAL_ANI_STATE
  * Use HAL_ANI_STATS inside the AR5212 HAL
  
  This commit doesn't (yet) convert the ar5212AniState -> HAL_ANI_STATE when
  exporting it to userland; that'll come in the next commit.

Modified:
  head/sys/dev/ath/ath_hal/ah.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212.h
  head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c

Modified: head/sys/dev/ath/ath_hal/ah.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.h       Wed Apr  1 02:05:26 2015        
(r280939)
+++ head/sys/dev/ath/ath_hal/ah.h       Wed Apr  1 03:42:46 2015        
(r280940)
@@ -850,6 +850,48 @@ typedef struct {
 
 #define        HAL_RSSI_EP_MULTIPLIER  (1<<7)  /* pow2 to optimize out * and / 
*/
 
+/*
+ * This is the ANI state and MIB stats.
+ *
+ * It's used by the HAL modules to keep state /and/ by the debug ioctl
+ * to fetch ANI information.
+ */
+typedef struct {
+       uint32_t        ast_ani_niup;   /* ANI increased noise immunity */
+       uint32_t        ast_ani_nidown; /* ANI decreased noise immunity */
+       uint32_t        ast_ani_spurup; /* ANI increased spur immunity */
+       uint32_t        ast_ani_spurdown;/* ANI descreased spur immunity */
+       uint32_t        ast_ani_ofdmon; /* ANI OFDM weak signal detect on */
+       uint32_t        ast_ani_ofdmoff;/* ANI OFDM weak signal detect off */
+       uint32_t        ast_ani_cckhigh;/* ANI CCK weak signal threshold high */
+       uint32_t        ast_ani_ccklow; /* ANI CCK weak signal threshold low */
+       uint32_t        ast_ani_stepup; /* ANI increased first step level */
+       uint32_t        ast_ani_stepdown;/* ANI decreased first step level */
+       uint32_t        ast_ani_ofdmerrs;/* ANI cumulative ofdm phy err count */
+       uint32_t        ast_ani_cckerrs;/* ANI cumulative cck phy err count */
+       uint32_t        ast_ani_reset;  /* ANI parameters zero'd for non-STA */
+       uint32_t        ast_ani_lzero;  /* ANI listen time forced to zero */
+       uint32_t        ast_ani_lneg;   /* ANI listen time calculated < 0 */
+       HAL_MIB_STATS   ast_mibstats;   /* MIB counter stats */
+       HAL_NODE_STATS  ast_nodestats;  /* Latest rssi stats from driver */
+} HAL_ANI_STATS;
+
+typedef struct {
+       uint8_t         noiseImmunityLevel;
+       uint8_t         spurImmunityLevel;
+       uint8_t         firstepLevel;
+       uint8_t         ofdmWeakSigDetectOff;
+       uint8_t         cckWeakSigThreshold;
+       uint32_t        listenTime;
+
+       /* NB: intentionally ordered so data exported to user space is first */
+       uint32_t        txFrameCount;   /* Last txFrameCount */
+       uint32_t        rxFrameCount;   /* Last rx Frame count */
+       uint32_t        cycleCount;     /* Last cycleCount
+                                          (to detect wrap-around) */
+       uint32_t        ofdmPhyErrCount;/* OFDM err count since last reset */
+       uint32_t        cckPhyErrCount; /* CCK err count since last reset */
+} HAL_ANI_STATE;
 
 struct ath_desc;
 struct ath_tx_status;

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212.h    Wed Apr  1 02:05:26 2015        
(r280939)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h    Wed Apr  1 03:42:46 2015        
(r280940)
@@ -200,6 +200,7 @@ struct ar5212AniState {
 #define        HAL_ANI_ENA             0x00000001      /* ANI operation 
enabled */
 #define        HAL_RSSI_ANI_ENA        0x00000002      /* rssi-based 
processing ena'd*/
 
+#if 0
 struct ar5212Stats {
        uint32_t        ast_ani_niup;   /* ANI increased noise immunity */
        uint32_t        ast_ani_nidown; /* ANI decreased noise immunity */
@@ -219,6 +220,7 @@ struct ar5212Stats {
        HAL_MIB_STATS   ast_mibstats;   /* MIB counter stats */
        HAL_NODE_STATS  ast_nodestats;  /* Latest rssi stats from driver */
 };
+#endif
 
 /*
  * NF Cal history buffer
@@ -258,7 +260,7 @@ struct ath_hal_5212 {
         * Runtime state.
         */
        uint32_t        ah_maskReg;             /* copy of AR_IMR */
-       struct ar5212Stats ah_stats;            /* various statistics */
+       HAL_ANI_STATS   ah_stats;               /* various statistics */
        RF_HAL_FUNCS    *ah_rfHal;
        uint32_t        ah_txDescMask;          /* mask for TXDESC */
        uint32_t        ah_txOkInterruptMask;
@@ -625,7 +627,7 @@ extern      void ar5212AniAttach(struct ath_h
                const struct ar5212AniParams *, HAL_BOOL ena);
 extern void ar5212AniDetach(struct ath_hal *);
 extern struct ar5212AniState *ar5212AniGetCurrentState(struct ath_hal *);
-extern struct ar5212Stats *ar5212AniGetCurrentStats(struct ath_hal *);
+extern HAL_ANI_STATS *ar5212AniGetCurrentStats(struct ath_hal *);
 extern HAL_BOOL ar5212AniControl(struct ath_hal *, HAL_ANI_CMD cmd, int param);
 extern HAL_BOOL ar5212AniSetParams(struct ath_hal *,
                const struct ar5212AniParams *, const struct ar5212AniParams *);

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c        Wed Apr  1 02:05:26 
2015        (r280939)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_ani.c        Wed Apr  1 03:42:46 
2015        (r280940)
@@ -110,7 +110,7 @@ ar5212AniGetCurrentState(struct ath_hal 
 /*
  * Return the current statistics.
  */
-struct ar5212Stats *
+HAL_ANI_STATS *
 ar5212AniGetCurrentStats(struct ath_hal *ah)
 {
        struct ath_hal_5212 *ahp = AH5212(ah);

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c       Wed Apr  1 02:05:26 
2015        (r280939)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c       Wed Apr  1 03:42:46 
2015        (r280940)
@@ -1085,7 +1085,7 @@ ar5212GetDiagState(struct ath_hal *ah, i
        case HAL_DIAG_ANI_STATS:
                *result = ar5212AniGetCurrentStats(ah);
                *resultsize = (*result == AH_NULL) ?
-                       0 : sizeof(struct ar5212Stats);
+                       0 : sizeof(HAL_ANI_STATS);
                return AH_TRUE;
        case HAL_DIAG_ANI_CMD:
                if (argsize != 2*sizeof(uint32_t))
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to