diff mbox series

[RFC,v1,255/256] cl8k: add wrs/wrs_tables.h

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

Commit Message

Viktor Barna June 17, 2021, 4:02 p.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>
---
 .../net/wireless/celeno/cl8k/wrs/wrs_tables.h | 76 +++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 drivers/net/wireless/celeno/cl8k/wrs/wrs_tables.h

--
2.30.0
diff mbox series

Patch

diff --git a/drivers/net/wireless/celeno/cl8k/wrs/wrs_tables.h b/drivers/net/wireless/celeno/cl8k/wrs/wrs_tables.h
new file mode 100644
index 000000000000..250755533f28
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/wrs/wrs_tables.h
@@ -0,0 +1,76 @@ 
+/* SPDX-License-Identifier: MIT */
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#ifndef CL_WRS_TABLES_H
+#define CL_WRS_TABLES_H
+
+#include <linux/types.h>
+
+/* Rate Table Size */
+#define WRS_HE_RATE_TABLE_SIZE     (WRS_MCS_MAX_HE * WRS_SS_MAX * CHNL_BW_MAX * WRS_GI_MAX_HE)
+#define WRS_HT_VHT_RATE_TABLE_SIZE (WRS_MCS_MAX_VHT * WRS_SS_MAX * CHNL_BW_MAX * WRS_GI_MAX_VHT)
+
+/* Initial Thresholds */
+#define WRS_INIT_MSEC_WEIGHT_DOWN  (WRS_MAINTENANCE_PERIOD_MS * 3) /* Msec */
+#define WRS_INIT_MSEC_WEIGHT_UP    (WRS_MAINTENANCE_PERIOD_MS * 3) /* Msec */
+
+#define WRS_MSEC_WEIGHT_MIN        (WRS_MAINTENANCE_PERIOD_MS * 2) /* Msec */
+#define WRS_MSEC_WEIGHT_MAX_UP     30000 /* Msec */
+#define WRS_MSEC_WEIGHT_MAX_DOWN   4000  /* Msec */
+#define WRS_MSEC_STEP_DOWN         5000  /* Msec */
+#define WRS_MSEC_STEP_UP_SAME      1000  /* Msec */
+#define WRS_INVALID_RATE           ((u16)(~0))
+
+enum cl_wrs_table_node_up {
+       WRS_TABLE_NODE_UP_MCS,
+       WRS_TABLE_NODE_UP_BW,
+       WRS_TABLE_NODE_UP_NSS,
+       WRS_TABLE_NODE_UP_BF,
+       WRS_TABLE_NODE_UP_GI,
+
+       WRS_TABLE_NODE_UP_MAX
+};
+
+struct cl_wrs_table_validity {
+       bool is_valid;
+       u16 new_rate_idx;
+};
+
+struct cl_wrs_table_node {
+       u16 rate_idx;
+       u16 time_th;
+       bool quick_up_check;
+};
+
+struct cl_wrs_rate {
+       u16 mcs : 4,
+           nss : 3,
+           bw  : 2,
+           gi  : 2,
+           rsv : 2;
+};
+
+struct cl_wrs_table {
+       struct cl_wrs_rate rate;
+       struct cl_wrs_table_node rate_down;
+       struct cl_wrs_table_node rate_up[WRS_TABLE_NODE_UP_MAX];
+       u32 frames_total;
+       u32 ba_not_rcv_total;
+       u64 epr_acc;
+};
+
+struct cl_hw;
+struct cl_wrs_db;
+struct cl_wrs_sta;
+struct cl_wrs_params;
+
+void cl_wrs_tables_global_build(void);
+void cl_wrs_tables_print(struct cl_hw *cl_hw, struct cl_wrs_params *wrs_params);
+void cl_wrs_tables_reset(struct cl_wrs_db *wrs_db, struct cl_wrs_sta *wrs_sta,
+                        struct cl_wrs_params *wrs_params);
+void cl_wrs_tables_build(struct cl_hw *cl_hw, struct cl_wrs_sta *wrs_sta,
+                        struct cl_wrs_params *wrs_params);
+u16 cl_wrs_tables_find_rate_idx(struct cl_wrs_params *wrs_params,
+                               u8 bw, u8 nss, u8 mcs, u8 gi);
+
+#endif /* CL_WRS_TABLES_H */