From 2511069a3f78bfa126b2a32eaf6c2589bb57aa61 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Tue, 8 Dec 2020 17:25:59 +0000 Subject: [PATCH] [ath] replace the hard-coded magic values in if_athioctl.h with constant defines Replace some hard-coded magic values in the ioctl stats struct with #defines. I'm going to follow up with some more sanity checking in the receive path that also use these values so we don't do bad things if the hardware is (more) confused. --- sys/dev/ath/if_athioctl.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/dev/ath/if_athioctl.h b/sys/dev/ath/if_athioctl.h index 8367a3ebac1..fec48bb4c89 100644 --- a/sys/dev/ath/if_athioctl.h +++ b/sys/dev/ath/if_athioctl.h @@ -48,10 +48,14 @@ struct ath_tx_aggr_stats { u_int32_t aggr_rts_aggr_limited; }; +#define ATH_IOCTL_INTR_NUM_SYNC_INTR 32 struct ath_intr_stats { - u_int32_t sync_intr[32]; + u_int32_t sync_intr[ATH_IOCTL_INTR_NUM_SYNC_INTR]; }; +#define ATH_IOCTL_STATS_NUM_RX_PHYERR 64 +#define ATH_IOCTL_STATS_NUM_TX_ANTENNA 8 +#define ATH_IOCTL_STATS_NUM_RX_ANTENNA 8 struct ath_stats { u_int32_t ast_watchdog; /* device reset by watchdog */ u_int32_t ast_hardware; /* fatal hardware error interrupts */ @@ -96,7 +100,8 @@ struct ath_stats { u_int32_t ast_rx_badcrypt;/* rx failed 'cuz decryption */ u_int32_t ast_rx_badmic; /* rx failed 'cuz MIC failure */ u_int32_t ast_rx_phyerr; /* rx failed 'cuz of PHY err */ - u_int32_t ast_rx_phy[64]; /* rx PHY error per-code counts */ + u_int32_t ast_rx_phy[ATH_IOCTL_STATS_NUM_RX_PHYERR]; + /* rx PHY error per-code counts */ u_int32_t ast_rx_tooshort;/* rx discarded 'cuz frame too short */ u_int32_t ast_rx_toobig; /* rx discarded 'cuz frame too large */ u_int32_t ast_rx_packets; /* packet recv on the interface */ @@ -115,8 +120,10 @@ struct ath_stats { u_int32_t ast_rate_drop; /* rate control dropped xmit rate */ u_int32_t ast_ant_defswitch;/* rx/default antenna switches */ u_int32_t ast_ant_txswitch;/* tx antenna switches */ - u_int32_t ast_ant_rx[8]; /* rx frames with antenna */ - u_int32_t ast_ant_tx[8]; /* tx frames with antenna */ + u_int32_t ast_ant_rx[ATH_IOCTL_STATS_NUM_RX_ANTENNA]; + /* rx frames with antenna */ + u_int32_t ast_ant_tx[ATH_IOCTL_STATS_NUM_TX_ANTENNA]; + /* tx frames with antenna */ u_int32_t ast_cabq_xmit; /* cabq frames transmitted */ u_int32_t ast_cabq_busy; /* cabq found busy */ u_int32_t ast_tx_raw; /* tx frames through raw api */ -- 2.45.0