Part of the split. Please, take a look at the cover letter for more details Reviewed-by: Viktor Barna <viktor.barna.rj@xxxxxxxxxxxxxx> Reviewed-by: Gal Gur <gal.gur.jx@xxxxxxxxxxx> Signed-off-by: Alexander Savchenko <oleksandr.savchenko.dn@xxxxxxxxxxxxxx> --- drivers/net/wireless/renesas/ra6w/stats.h | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 drivers/net/wireless/renesas/ra6w/stats.h diff --git a/drivers/net/wireless/renesas/ra6w/stats.h b/drivers/net/wireless/renesas/ra6w/stats.h new file mode 100644 index 000000000000..06e870f6ae0f --- /dev/null +++ b/drivers/net/wireless/renesas/ra6w/stats.h @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) [2022-2025] Renesas Electronics Corporation and/or its affiliates. + */ + +#ifndef RA6W_STATS_H +#define RA6W_STATS_H + +#define RA6W_MCS_MAX_HT 8 +#define RA6W_MCS_MAX_VHT 9 +#define RA6W_MCS_MAX_HE 12 +#define RA6W_GI_MAX_HT 2 +#define RA6W_GI_MAX_VHT 2 +#define RA6W_GI_MAX_HE 3 + +enum ra6w_stats_bits { + RA6W_STATS_RX_CCK_BIT = BIT(0), + RA6W_STATS_RX_OFDM_BIT = BIT(1), + RA6W_STATS_RX_HT_BIT = BIT(2), + RA6W_STATS_RX_VHT_BIT = BIT(3), + RA6W_STATS_RX_HE_SU_BIT = BIT(4), + RA6W_STATS_RX_HE_MU_BIT = BIT(5), + RA6W_STATS_RX_HE_EXT_BIT = BIT(6), + RA6W_STATS_RX_HE_TRIGFLAG_LONG_BIT = BIT(7) +}; + +enum ra6w_stats_status { + RA6W_STATS_STATUS_DISABLED, + RA6W_STATS_STATUS_ENABLED, + + RA6W_STATS_STATUS_MAX +}; + +struct ra6w_stats_non_ht { + u8 bw; + u64 ofdm; + u64 cck; +}; + +struct ra6w_stats_rx { + u8 format_mode; + u8 flags; + struct ra6w_stats_non_ht non_ht; + struct { + u8 bw; + u8 mcs; + u8 gi; + u8 nss; + u64 ht[RA6W_GI_MAX_HT][RA6W_MCS_MAX_HT]; + } ht; + struct { + u8 bw; + u8 mcs; + u8 gi; + u8 nss; + u64 vht[RA6W_GI_MAX_VHT][RA6W_MCS_MAX_VHT]; + } vht; + struct { + u8 bw; + u8 mcs; + u8 gi; + u8 nss; + u64 he[RA6W_GI_MAX_HE][RA6W_MCS_MAX_HE]; + } he_su; +}; + +struct ra6w_stats { + struct ra6w_stats_rx *rx_stats; + bool stats_enabled; +}; + +struct ra6w_cfg80211_sta_stats; + +#ifdef CONFIG_NL80211_TESTMODE + +int ra6w_stats_init(struct ra6w_stats *stats); +void ra6w_stats_deinit(struct ra6w_stats *stats); +void ra6w_stats_rx_update(struct ra6w_stats *stats, + const struct ra6w_cfg80211_sta_stats *sta_stats); + +#else + +static inline int ra6w_stats_init(struct ra6w_stats *stats) +{ + return 0; +} + +static inline void ra6w_stats_deinit(struct ra6w_stats *stats) +{ +} + +static inline +void ra6w_stats_rx_update(struct ra6w_stats *stats, + const struct ra6w_cfg80211_sta_stats *sta_stats) +{ +} + +#endif /* CONFIG_NL80211_TESTMODE */ + +#endif /* RA6W_STATS_H */ -- 2.17.1