diff mbox series

[RFC,v2,77/96] cl8k: add stats.h

Message ID 20220524113502.1094459-78-viktor.barna@celeno.com
State New
Headers show
Series wireless: cl8k driver for Celeno IEEE 802.11ax devices | expand

Commit Message

Viktor Barna May 24, 2022, 11:34 a.m. UTC
From: Viktor Barna <viktor.barna@celeno.com>

(Part of the split. Please, take a look at the cover letter for more
details).

Signed-off-by: Viktor Barna <viktor.barna@celeno.com>
---
 drivers/net/wireless/celeno/cl8k/stats.h | 108 +++++++++++++++++++++++
 1 file changed, 108 insertions(+)
 create mode 100644 drivers/net/wireless/celeno/cl8k/stats.h
diff mbox series

Patch

diff --git a/drivers/net/wireless/celeno/cl8k/stats.h b/drivers/net/wireless/celeno/cl8k/stats.h
new file mode 100644
index 000000000000..480c00b395f1
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/stats.h
@@ -0,0 +1,108 @@ 
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
+/* Copyright(c) 2019-2022, Celeno Communications Ltd. */
+
+#ifndef CL_STATS_H
+#define CL_STATS_H
+
+#include "wrs.h"
+
+enum cl_rx_stats_flag {
+	RX_STATS_CCK = 0x01,
+	RX_STATS_OFDM = 0x02,
+	RX_STATS_HT = 0x04,
+	RX_STATS_VHT = 0x08,
+	RX_STATS_HE_SU = 0x10,
+	RX_STATS_HE_MU = 0x20,
+	RX_STATS_HE_EXT = 0x40,
+	RX_STATS_HE_TRIG = 0x80,
+};
+
+struct cl_rx_stats {
+	u32 he_trig[CHNL_BW_MAX_HE][WRS_SS_MAX][WRS_MCS_MAX_HE][WRS_GI_MAX_HE];
+	u32 he_ext[CHNL_BW_MAX_HE][WRS_SS_MAX][WRS_MCS_MAX_HE][WRS_GI_MAX_HE];
+	u32 he_mu[CHNL_BW_MAX_HE][WRS_SS_MAX][WRS_MCS_MAX_HE][WRS_GI_MAX_HE];
+	u32 he_su[CHNL_BW_MAX_HE][WRS_SS_MAX][WRS_MCS_MAX_HE][WRS_GI_MAX_HE];
+	u32 vht[CHNL_BW_MAX_VHT][WRS_SS_MAX][WRS_MCS_MAX_VHT][WRS_GI_MAX_VHT];
+	u32 ht[CHNL_BW_MAX_HT][WRS_SS_MAX][WRS_MCS_MAX_HT][WRS_GI_MAX_HT];
+	u32 ofdm[WRS_MCS_MAX_OFDM];
+	u32 cck[WRS_MCS_MAX_CCK];
+	u8 flag;
+	u64 packet_success;
+};
+
+#define RSSI_ARR_SIZE 128
+#define BF_IDX_MAX 2
+
+struct cl_tx_cntrs {
+	u32 success;
+	u32 fail;
+};
+
+struct cl_tx_stats {
+	struct cl_tx_cntrs he[CHNL_BW_MAX][WRS_SS_MAX][WRS_MCS_MAX][WRS_GI_MAX][BF_IDX_MAX];
+	struct cl_tx_cntrs
+		vht[CHNL_BW_MAX_VHT][WRS_SS_MAX][WRS_MCS_MAX_VHT][WRS_GI_MAX_VHT][BF_IDX_MAX];
+	struct cl_tx_cntrs ht[CHNL_BW_MAX_HT][WRS_SS_MAX][WRS_MCS_MAX_HT][WRS_GI_MAX_HT];
+	struct cl_tx_cntrs ofdm[WRS_MCS_MAX_OFDM];
+	struct cl_tx_cntrs cck[WRS_MCS_MAX_CCK];
+	u32 agg_cntr;
+	u32 fail_cntr;
+	u64 packet_success;
+	u64 packet_fail;
+};
+
+enum cl_ps_period {
+	PS_PERIOD_50MS,
+	PS_PERIOD_100MS,
+	PS_PERIOD_250MS,
+	PS_PERIOD_500MS,
+	PS_PERIOD_750MS,
+	PS_PERIOD_1000MS,
+	PS_PERIOD_2000MS,
+	PS_PERIOD_5000MS,
+	PS_PERIOD_10000MS,
+	PS_PERIOD_ABOVE,
+
+	PS_PERIOD_MAX
+};
+
+struct cl_ps_stats {
+	bool is_ps;
+	unsigned long timestamp_sleep;
+	u32 period[PS_PERIOD_MAX];
+};
+
+enum cl_fec_coding {
+	CL_FEC_CODING_BCC,
+	CL_FEC_CODING_LDPC,
+	CL_FEC_CODING_MAX
+};
+
+struct cl_stats {
+	struct cl_tx_stats tx;
+	struct cl_rx_stats rx;
+	u32 rssi[RSSI_ARR_SIZE][MAX_ANTENNAS];
+	u32 fec_coding[CL_FEC_CODING_MAX];
+	struct cl_ps_stats ps;
+};
+
+struct cl_vif;
+
+void cl_stats_init(struct cl_hw *cl_hw);
+void cl_stats_deinit(struct cl_hw *cl_hw);
+void cl_stats_sta_add(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+void cl_stats_sta_remove(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+void cl_stats_update_tx_agg(struct cl_hw *cl_hw, struct cl_sta *cl_sta,
+			    struct cl_agg_tx_report *agg_report);
+void cl_stats_update_tx_single(struct cl_hw *cl_hw, struct cl_sta *cl_sta,
+			       struct cl_agg_tx_report *agg_report);
+void cl_stats_update_rx_rssi(struct cl_hw *cl_hw, struct cl_sta *cl_sta, s8 rssi[MAX_ANTENNAS]);
+void cl_stats_update_rx_rate(struct cl_hw *cl_hw, struct cl_sta *cl_sta, struct hw_rxhdr *rxhdr);
+void cl_stats_update_rx_rate_production(struct cl_hw *cl_hw, struct hw_rxhdr *rxhdr);
+void cl_stats_update_ps(struct cl_hw *cl_hw, struct cl_sta *cl_sta, bool is_ps);
+void cl_stats_get_tx(struct cl_hw *cl_hw, struct cl_sta *cl_sta,
+		     u64 *total_success, u64 *total_fail);
+u64 cl_stats_get_rx(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+int cl_stats_get_rssi(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+
+#endif /* CL_STATS_H */