1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: Define PSOC MLME structure
20  */
21 #ifndef _WLAN_PSOC_MLME_H_
22 #define _WLAN_PSOC_MLME_H_
23 
24 #include <wlan_ext_mlme_obj_types.h>
25 #include <wlan_vdev_mgr_tgt_if_rx_defs.h>
26 #include <qdf_timer.h>
27 #include <wlan_cm_bss_score_param.h>
28 #ifdef FEATURE_VDEV_OPS_WAKELOCK
29 #include <target_if_psoc_wake_lock.h>
30 #endif
31 
32 /* Max RNR size given max vaps are 16 */
33 #define MAX_RNR_SIZE (16 * 16 /* 11be compatible tbtt_info length */ \
34 			+ 4   /* Neighbor AP info field length */    \
35 			+ 2   /* RNR header bytes */)
36 
37 /**
38  * struct wlan_6ghz_rnr_global_cache - 6 GHz RNR cache buffer per soc
39  * @rnr_buf: RNR cache buffer
40  * @rnr_cnt: Count of APs in cache
41  * @rnr_size: Size of RNR cache (RNR IE)
42  */
43 struct wlan_6ghz_rnr_global_cache {
44 	char rnr_buf[MAX_RNR_SIZE];
45 	int rnr_cnt;
46 	uint16_t rnr_size;
47 };
48 
49 /**
50  * struct psoc_phy_config - psoc phy caps
51  * @vdev_nss_24g: Number of NSS the device support in 2.4Ghz
52  * @vdev_nss_5g: Number of NSS the device support in 5Ghz
53  * @ht_cap: If dev is configured as HT capable
54  * @vht_cap:If dev is configured as VHT capable
55  * @he_cap: If dev is configured as HE capable
56  * @eht_cap: If dev is configured as EHT capable
57  * @vht_24G_cap:If dev is configured as VHT capable for 2.4Ghz
58  * @beamformee_cap:If dev is configured as BF capable
59  * @bw_above_20_5ghz: BW greater than 20Mhz supported for 5Ghz
60  * @bw_above_20_24ghz: BW greater than 20Mhz supported for 2.4Ghz
61  * @max_chan_switch_ie: If max channel switch IE is supported
62  */
63 struct psoc_phy_config {
64 	uint8_t vdev_nss_24g;
65 	uint8_t vdev_nss_5g;
66 	uint32_t ht_cap:1,
67 		 vht_cap:1,
68 		 he_cap:1,
69 		 eht_cap:1,
70 		 vht_24G_cap:1,
71 		 beamformee_cap:1,
72 		 bw_above_20_5ghz:1,
73 		 bw_above_20_24ghz:1,
74 		 max_chan_switch_ie:1;
75 };
76 
77 /**
78  * struct psoc_mlo_config - psoc mlo config
79  * @reconfig_reassoc_en: If reassoc on ML reconfig AP addition is enabled
80  */
81 struct psoc_mlo_config {
82 	uint8_t reconfig_reassoc_en;
83 };
84 
85 /**
86  * struct psoc_config - psoc level configs
87  * @score_config:          BSS scoring related config
88  * @phy_config:            Psoc Phy config
89  * @mlo_config:            Psoc mlo config
90  */
91 struct psoc_config {
92 	struct scoring_cfg score_config;
93 	struct psoc_phy_config phy_config;
94 	struct psoc_mlo_config mlo_config;
95 };
96 
97 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
98 /**
99  * enum wlan_peer_tbl_trans_entry_flags - Peer table transition flags
100  * @WLAN_PEER_TBL_TRANS_CREATE: Peer table modify due to create
101  * @WLAN_PEER_TBL_TRANS_DESTROY: Peer table modify due to destroy
102  * @WLAN_PEER_TBL_TRANS_CONNECT: Peer table modify during connect
103  * @WLAN_PEER_TBL_TRANS_DISCONNECT: Peer table modify during disconnect
104  * @WLAN_PEER_TBL_TRANS_ROAM: Peer table modify during roaming
105  * @WLAN_PEER_TBL_TRANS_LINK_SWITCH: Peer table modify during link switch
106  */
107 enum wlan_peer_tbl_trans_entry_flags {
108 	WLAN_PEER_TBL_TRANS_CREATE = BIT(0),
109 	WLAN_PEER_TBL_TRANS_DESTROY = BIT(1),
110 	WLAN_PEER_TBL_TRANS_CONNECT = BIT(2),
111 	WLAN_PEER_TBL_TRANS_DISCONNECT = BIT(3),
112 	WLAN_PEER_TBL_TRANS_ROAM = BIT(4),
113 	WLAN_PEER_TBL_TRANS_LINK_SWITCH = BIT(5),
114 };
115 
116 /**
117  * struct wlan_peer_tbl_trans_entry - Peer transition history node
118  * @node: Node of the entry
119  * @ts: Timestamp of peer table modify
120  * @vdev_id: Peer's vdev's ID
121  * @opmode: Peer's VDEV opmode
122  * @is_mlo: %true if peer's VDEV MLO else %false
123  * @is_mlo_link: %true if peer's VDEV mlo link, else %false
124  * @is_primary: %true if this peer is primary
125  * @is_first_link: %true if this peer is the first link, else %false
126  * @auth_status: Status of auth from FW roam sync
127  * @num_roam_links: Count of roamed link from FW roam sync
128  * @peer_addr: MAC address of peer
129  * @peer_mld_addr: MLD address of peer
130  * @peer_flags: Peer flags from enum wlan_peer_tbl_trans_entry_flags
131  */
132 struct wlan_peer_tbl_trans_entry {
133 	qdf_list_node_t node;
134 	qdf_time_t ts;
135 	uint8_t vdev_id;
136 	enum QDF_OPMODE opmode;
137 	uint8_t is_mlo:1,
138 		is_mlo_link:1,
139 		is_primary:1,
140 		is_first_link:1,
141 		auth_status:2,
142 		num_roam_links:2;
143 	struct qdf_mac_addr peer_addr;
144 	struct qdf_mac_addr peer_mld_addr;
145 	unsigned long peer_flags;
146 };
147 #endif
148 
149 /**
150  * struct psoc_mlme_obj -  PSoC MLME component object
151  * @psoc:                  PSoC object
152  * @ext_psoc_ptr:          PSoC legacy pointer
153  * @psoc_vdev_rt:          PSoC Vdev response timer
154  * @psoc_mlme_wakelock:    Wakelock to prevent system going to suspend
155  * @rnr_6ghz_cache:        Cache of 6Ghz vap in RNR ie format
156  * @rnr_6ghz_cache_legacy: Legacy (13TBTT) cache of 6Ghz vap in RNR ie format
157  * @psoc_cfg:              Psoc level configs
158  * @peer_history_list:     Peer table transition history
159  */
160 struct psoc_mlme_obj {
161 	struct wlan_objmgr_psoc *psoc;
162 	mlme_psoc_ext_t *ext_psoc_ptr;
163 	struct vdev_response_timer psoc_vdev_rt[WLAN_UMAC_PSOC_MAX_VDEVS];
164 #ifdef FEATURE_VDEV_OPS_WAKELOCK
165 	struct psoc_mlme_wakelock psoc_mlme_wakelock;
166 #endif
167 	struct wlan_6ghz_rnr_global_cache rnr_6ghz_cache[WLAN_UMAC_MAX_PDEVS];
168 	struct wlan_6ghz_rnr_global_cache rnr_6ghz_cache_legacy[WLAN_UMAC_MAX_PDEVS];
169 	struct psoc_config psoc_cfg;
170 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
171 	qdf_list_t peer_history_list;
172 #endif
173 };
174 
175 #endif
176