diff --git a/hal/wifi3.0/hal_api.h b/hal/wifi3.0/hal_api.h index f247afe04e..75d7caa9b6 100644 --- a/hal/wifi3.0/hal_api.h +++ b/hal/wifi3.0/hal_api.h @@ -94,6 +94,16 @@ hal_set_verbose_debug(bool flag) } #endif +#ifdef ENABLE_HAL_SOC_STATS +#define HAL_STATS_INC(_handle, _field, _delta) \ +{ \ + if (likely(_handle)) \ + _handle->stats._field += _delta; \ +} +#else +#define HAL_STATS_INC(_handle, _field, _delta) +#endif + /** * hal_reg_write_result_check() - check register writing result * @hal_soc: HAL soc handle @@ -117,6 +127,8 @@ static inline void hal_reg_write_result_check(struct hal_soc *hal_soc, "the expectation 0x%x, actual value 0x%x\n", exp_val, value); + HAL_STATS_INC(hal_soc, reg_write_fail, 1); + QDF_BUG(0); } } diff --git a/hal/wifi3.0/hal_internal.h b/hal/wifi3.0/hal_internal.h index 8e7a36f7dc..8230d86b6a 100644 --- a/hal/wifi3.0/hal_internal.h +++ b/hal/wifi3.0/hal_internal.h @@ -474,6 +474,16 @@ struct hal_hw_txrx_ops { uint8_t (*hal_rx_mpdu_start_tlv_tag_valid)(void *rx_tlv_hdr); }; +/** + * struct hal_soc_stats - Hal layer stats + * @reg_write_fail: number of failed register writes + * + * This structure holds all the statistics at HAL layer. + */ +struct hal_soc_stats { + uint32_t reg_write_fail; +}; + /** * HAL context to be used to access SRNG APIs (currently used by data path * and transport (CE) modules) @@ -523,6 +533,8 @@ struct hal_soc { /* Indicate srngs initialization */ bool init_phase; + /* Hal level stats */ + struct hal_soc_stats stats; }; void hal_qca6750_attach(struct hal_soc *hal_soc);