Date: Tue, 8 Dec 2020 17:26:00 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368449 - head/sys/dev/ath Message-ID: <202012081726.0B8HQ0sx055444@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Tue Dec 8 17:25:59 2020 New Revision: 368449 URL: https://svnweb.freebsd.org/changeset/base/368449 Log: [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. Modified: head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Tue Dec 8 16:46:00 2020 (r368448) +++ head/sys/dev/ath/if_athioctl.h Tue Dec 8 17:25:59 2020 (r368449) @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012081726.0B8HQ0sx055444>