diff mbox series

[RFC,v2,83/96] cl8k: add traffic.h

Message ID 20220524113502.1094459-84-viktor.barna@celeno.com (mailing list archive)
State RFC
Delegated to: Kalle Valo
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/traffic.h | 77 ++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 drivers/net/wireless/celeno/cl8k/traffic.h
diff mbox series

Patch

diff --git a/drivers/net/wireless/celeno/cl8k/traffic.h b/drivers/net/wireless/celeno/cl8k/traffic.h
new file mode 100644
index 000000000000..1b820602c94a
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/traffic.h
@@ -0,0 +1,77 @@ 
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
+/* Copyright(c) 2019-2022, Celeno Communications Ltd. */
+
+#ifndef CL_TRAFFIC_H
+#define CL_TRAFFIC_H
+
+#include <linux/dcache.h>
+#include <linux/skbuff.h>
+
+enum cl_traffic_mon_protocol {
+	CL_TRFC_MON_PROT_TCP,
+	CL_TRFC_MON_PROT_UDP,
+	CL_TRFC_MON_PROT_MAX,
+};
+
+enum cl_traffic_mon_direction {
+	CL_TRFC_MON_DIR_DL,
+	CL_TRFC_MON_DIR_UL,
+	CL_TRFC_MON_DIR_MAX,
+};
+
+struct cl_traffic_mon {
+	u32 bytes_per_sec;
+	u32 bytes;
+};
+
+enum cl_traffic_direction {
+	TRAFFIC_DIRECTION_TX,
+	TRAFFIC_DIRECTION_RX,
+
+	TRAFFIC_DIRECTION_MAX
+};
+
+enum cl_traffic_level {
+	TRAFFIC_LEVEL_DRV,
+	TRAFFIC_LEVEL_BF,
+	TRAFFIC_LEVEL_MU,
+	TRAFFIC_LEVEL_EDCA,
+	TRAFFIC_LEVEL_DFS,
+
+	TRAFFIC_LEVEL_MAX
+};
+
+struct cl_traffic_activity {
+	u8 cntr_active;
+	u8 cntr_idle;
+	bool is_active;
+};
+
+struct cl_traffic_sta {
+	struct cl_traffic_activity activity_db[TRAFFIC_LEVEL_MAX];
+	u32 num_bytes;
+	u32 num_bytes_prev;
+};
+
+struct cl_traffic_main {
+	u32 num_active_sta[TRAFFIC_LEVEL_MAX];
+	u32 num_active_sta_dir[TRAFFIC_DIRECTION_MAX][TRAFFIC_LEVEL_MAX];
+	u32 active_bytes_thr[TRAFFIC_LEVEL_MAX];
+	bool dynamic_cts;
+};
+
+struct cl_sta;
+struct cl_hw;
+
+void cl_traffic_mon_tx(struct cl_sta *cl_sta, struct sk_buff *skb);
+void cl_traffic_mon_rx(struct cl_sta *cl_sta, struct sk_buff *skb);
+void cl_traffic_mon_sta_maintenance(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+void cl_traffic_init(struct cl_hw *cl_hw);
+void cl_traffic_tx_handler(struct cl_hw *cl_hw, struct cl_sta *cl_sta, u32 num_bytes);
+void cl_traffic_rx_handler(struct cl_hw *cl_hw, struct cl_sta *cl_sta, u32 num_bytes);
+void cl_traffic_maintenance(struct cl_hw *cl_hw);
+void cl_traffic_sta_remove(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+bool cl_traffic_is_sta_active(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+bool cl_traffic_is_sta_tx_exist(struct cl_hw *cl_hw, struct cl_sta *cl_sta);
+
+#endif /* CL_TRAFFIC_H */