2022-05-24 13:15:08

by Viktor Barna

[permalink] [raw]
Subject: [RFC v2 75/96] cl8k: add sta.h

From: Viktor Barna <[email protected]>

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

Signed-off-by: Viktor Barna <[email protected]>
---
drivers/net/wireless/celeno/cl8k/sta.h | 99 ++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
create mode 100644 drivers/net/wireless/celeno/cl8k/sta.h

diff --git a/drivers/net/wireless/celeno/cl8k/sta.h b/drivers/net/wireless/celeno/cl8k/sta.h
new file mode 100644
index 000000000000..f3c6bc743b96
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/sta.h
@@ -0,0 +1,99 @@
+/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
+/* Copyright(c) 2019-2022, Celeno Communications Ltd. */
+
+#ifndef CL_STA_H
+#define CL_STA_H
+
+#include "sta_info.h"
+#include "mac80211.h"
+#include "rates.h"
+#include "motion_sense.h"
+#include "tx.h"
+#include "traffic.h"
+#include "bf.h"
+#include "vns.h"
+
+#define IEEE80211_STA_TO_CL_STA(sta) ((struct cl_sta *)(sta)->drv_priv)
+#define IEEE80211_STA_TO_STAINFO(ieee80211_sta) (container_of(ieee80211_sta, struct sta_info, sta))
+
+#define CL_MAX_NUM_MESH_POINT 8
+
+/*
+ * Structure used to save information relative to the managed stations.
+ * Will be used as the 'drv_priv' field of the "struct ieee80211_sta" structure.
+ */
+struct cl_sta {
+ struct list_head list;
+ struct list_head list_hash;
+ u8 sta_idx;
+ u8 su_sid;
+ bool key_disable;
+ u8 addr[ETH_ALEN];
+ struct cl_baw baws[IEEE80211_NUM_TIDS];
+ struct cl_amsdu_ctrl amsdu_anchor[IEEE80211_NUM_TIDS];
+ struct cl_tx_queue *agg_tx_queues[IEEE80211_NUM_TIDS];
+ u8 rx_pn[IEEE80211_NUM_TIDS][IEEE80211_CCMP_PN_LEN];
+ struct cl_vif *cl_vif;
+ struct ieee80211_sta *sta;
+ struct ieee80211_key_conf *key_conf;
+ struct cl_bf_sta_db bf_db;
+ struct cl_stats *stats;
+ s32 alpha_rssi;
+ bool manual_alpha_rssi;
+ s8 last_rssi[MAX_ANTENNAS];
+ u8 ampdu_min_spacing;
+ struct cl_traffic_sta traffic_db[TRAFFIC_DIRECTION_MAX];
+ struct cl_traffic_mon traffic_mon[CL_TRFC_MON_PROT_MAX][CL_TRFC_MON_DIR_MAX];
+ struct cl_vns_sta_db vns_db;
+ u32 retry_count;
+ u32 data_pending[AC_MAX];
+ struct cl_wrs_info wrs_info_tx_su;
+ struct cl_wrs_info wrs_info_tx_mu_mimo;
+ struct cl_wrs_info wrs_info_rx;
+ struct cl_wrs_rssi wrs_rssi;
+ bool add_complete;
+ bool remove_start;
+ struct cl_wrs_sta wrs_sta;
+ struct cl_motion_sense motion_sense;
+ union cl_rate_ctrl_info_he rate_ctrl_he;
+ bool tf_support_dis;
+ struct cl_tid_ampdu_rx *tid_agg_rx[IEEE80211_NUM_TIDS];
+ u64 tx_bytes;
+ u64 rx_bytes;
+ bool stop_tx;
+ bool pause_tx;
+
+};
+
+#define CL_STA_HASH_SIZE (CL_MAX_NUM_STA / 2)
+#define CL_STA_HASH_MASK (CL_STA_HASH_SIZE - 1)
+#define CL_STA_HASH_IDX(x) ((x) & CL_STA_HASH_MASK)
+
+struct cl_sta_db {
+ struct list_head head;
+ struct cl_sta *lut[CL_MAX_NUM_STA];
+ struct list_head hash[CL_STA_HASH_SIZE];
+ rwlock_t lock;
+ u32 num;
+};
+
+typedef void (*sta_callback)(struct cl_hw *, struct cl_sta *);
+
+/* These functions take the lock inside */
+u32 cl_sta_num(struct cl_hw *cl_hw);
+u32 cl_sta_num_bh(struct cl_hw *cl_hw);
+
+/* Must take lock before calling these functions */
+struct cl_sta *cl_sta_get(struct cl_hw *cl_hw, u8 sta_idx);
+struct cl_sta *cl_sta_get_by_addr(struct cl_hw *cl_hw, u8 *addr);
+
+void cl_sta_init(struct cl_hw *cl_hw);
+void cl_sta_loop(struct cl_hw *cl_hw, sta_callback callback);
+void cl_sta_loop_bh(struct cl_hw *cl_hw, sta_callback callback);
+void cl_sta_init_sta(struct cl_hw *cl_hw, struct ieee80211_sta *sta);
+int cl_sta_add(struct cl_hw *cl_hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta);
+void cl_sta_mgd_add(struct cl_hw *cl_hw, struct cl_vif *cl_vif, struct ieee80211_sta *sta);
+void cl_sta_remove(struct cl_hw *cl_hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta);
+void cl_sta_ps_notify(struct cl_hw *cl_hw, struct cl_sta *cl_sta, bool is_ps);
+
+#endif /* CL_STA_H */
--
2.36.1