1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19  /**
20   * DOC: This file provides the common definitions for object manager
21   */
22 
23 #ifndef _WLAN_CMN_H_
24 #define _WLAN_CMN_H_
25 
26 #include <qdf_types.h>
27 
28 /* Max no of UMAC components */
29 #define WLAN_UMAC_MAX_COMPONENTS WLAN_UMAC_COMP_ID_MAX
30 
31 /* Max no. of radios, a pSoc/Device can support */
32 #ifdef WLAN_MAX_PDEVS
33 #define WLAN_UMAC_MAX_PDEVS WLAN_MAX_PDEVS
34 #else
35 #define WLAN_UMAC_MAX_PDEVS 3
36 #endif
37 
38 /* Max no. of VDEV per PSOC */
39 #ifdef WLAN_PSOC_MAX_VDEVS
40 #define WLAN_UMAC_PSOC_MAX_VDEVS WLAN_PSOC_MAX_VDEVS
41 #else
42 #define WLAN_UMAC_PSOC_MAX_VDEVS 51
43 #endif
44 
45 /* Max no. of VDEVs, a PDEV can support */
46 #ifdef WLAN_PDEV_MAX_VDEVS
47 #define WLAN_UMAC_PDEV_MAX_VDEVS WLAN_PDEV_MAX_VDEVS
48 #else
49 #define WLAN_UMAC_PDEV_MAX_VDEVS 17
50 #endif
51 
52 /* Max no. of Peers, a device can support */
53 #define WLAN_UMAC_PSOC_MAX_PEERS (1536 + WLAN_UMAC_PSOC_MAX_VDEVS)
54 
55 /* Max no. of Temporary Peers, a pdev can support */
56 #define WLAN_MAX_PDEV_TEMP_PEERS 128
57 
58 /* Max no. of Temporary Peers, a psoc can support */
59 #define WLAN_MAX_PSOC_TEMP_PEERS \
60 		(WLAN_MAX_PDEV_TEMP_PEERS * WLAN_UMAC_MAX_PDEVS)
61 
62 /* Max length of a SSID */
63 #define WLAN_SSID_MAX_LEN 32
64 
65 #define WLAN_CACHE_ID_LEN 2
66 
67 /* Max sequence number */
68 #define WLAN_MAX_SEQ_NUM 4096
69 
70 /* Max no. of peers for STA vap */
71 #define WLAN_UMAC_MAX_STA_PEERS 2
72 
73 /* Max vdev_id */
74 #define WLAN_UMAC_VDEV_ID_MAX 0xFF
75 
76 /* Number of AID values to be reserved for 11az TBR RSTA ranging*/
77 #define WLAN_RTT_11AZ_NUM_RSID 16
78 
79 /* MAX AID */
80 /* Reserving AID value 1992-2007 from AID pool for 11az TBR RSTA ranging. */
81 #define WLAN_UMAC_MAX_AID (2008 - WLAN_RTT_11AZ_NUM_RSID - 1)
82 
83 /* Invalid pdev_id */
84 #define WLAN_INVALID_PDEV_ID 0xFFFFFFFF
85 
86 /* Invalid free descriptor count */
87 #define WLAN_INVALID_MGMT_DESC_COUNT 0xFFFFFFFF
88 
89 /* Max fw report pdev id */
90 #define WLAN_UMAC_MAX_RP_PID 2
91 
92 /* 802.11 cap info */
93 #define WLAN_CAPINFO_ESS               0x0001
94 #define WLAN_CAPINFO_IBSS              0x0002
95 #define WLAN_CAPINFO_CF_POLLABLE       0x0004
96 #define WLAN_CAPINFO_CF_POLLREQ        0x0008
97 #define WLAN_CAPINFO_PRIVACY           0x0010
98 #define WLAN_CAPINFO_SHORT_PREAMBLE    0x0020
99 #define WLAN_CAPINFO_PBCC              0x0040
100 #define WLAN_CAPINFO_CHNL_AGILITY      0x0080
101 #define WLAN_CAPINFO_SPECTRUM_MGMT     0x0100
102 #define WLAN_CAPINFO_QOS               0x0200
103 #define WLAN_CAPINFO_SHORT_SLOTTIME    0x0400
104 #define WLAN_CAPINFO_APSD              0x0800
105 #define WLAN_CAPINFO_RADIOMEAS         0x1000
106 #define WLAN_CAPINFO_DSSSOFDM          0x2000
107 
108 /* Allowed time to wait for Object creation  */
109 #define WLAN_VDEV_CREATE_TIMEOUT_CNT 300
110 /* 25 msec */
111 #define WLAN_VDEV_CREATE_TIMEOUT 25
112 
113 #define WLAN_PDEV_CREATE_TIMEOUT_CNT 300
114 /* 25 msec */
115 #define WLAN_PDEV_CREATE_TIMEOUT 25
116 
117 #define WLAN_PSOC_CREATE_TIMEOUT_CNT 300
118 /* 25 msec */
119 #define WLAN_PSOC_CREATE_TIMEOUT 25
120 #define WLAN_24_GHZ_BASE_FREQ   (2407)
121 #define WLAN_5_GHZ_BASE_FREQ    (5000)
122 #define WLAN_24_GHZ_CHANNEL_6   (6)
123 #define WLAN_24_GHZ_CHANNEL_14  (14)
124 #define WLAN_24_GHZ_CHANNEL_15  (15)
125 #define WLAN_24_GHZ_CHANNEL_27  (27)
126 #define WLAN_5_GHZ_CHANNEL_170  (170)
127 #define WLAN_CHAN_SPACING_5MHZ  (5)
128 #define WLAN_CHAN_SPACING_20MHZ (20)
129 #define WLAN_CHAN_14_FREQ       (2484)
130 #define WLAN_CHAN_15_FREQ       (2512)
131 #define WLAN_CHAN_170_FREQ      (5852)
132 
133 #define WLAN_MAC_EID_VENDOR     221
134 #define WLAN_MAC_EID_EXT        255
135 
136 /* VHT capability flags */
137 /* B0-B1 Maximum MPDU Length */
138 /* A-MSDU Length 3839 octets */
139 #define WLAN_VHTCAP_MAX_MPDU_LEN_3839     0x00000000
140  /* A-MSDU Length 7991 octets */
141 #define WLAN_VHTCAP_MAX_MPDU_LEN_7935     0x00000001
142 /* A-MSDU Length 11454 octets */
143 #define WLAN_VHTCAP_MAX_MPDU_LEN_11454    0x00000002
144 
145 /* B2-B3 Supported Channel Width */
146 /* Does not support 160 or 80+80 */
147 #define WLAN_VHTCAP_SUP_CHAN_WIDTH_80     0x00000000
148 /* Supports 160 */
149 #define WLAN_VHTCAP_SUP_CHAN_WIDTH_160    0x00000004
150 /* Support both 160 or 80+80 */
151 #define WLAN_VHTCAP_SUP_CHAN_WIDTH_80_160 0x00000008
152 /* B2-B3 */
153 #define WLAN_VHTCAP_SUP_CHAN_WIDTH_S      2
154 #define WLAN_VHTCAP_SUP_CHAN_WIDTH_MASK   0x0000000C
155 /* B4 RX LDPC */
156 #define WLAN_VHTCAP_RX_LDPC             0x00000010
157 /* B5 Short GI for 80MHz */
158 #define WLAN_VHTCAP_SHORTGI_80          0x00000020
159 /* B6 Short GI for 160 and 80+80 MHz */
160 #define WLAN_VHTCAP_SHORTGI_160         0x00000040
161 /* B7 Tx STBC */
162 #define WLAN_VHTCAP_TX_STBC             0x00000080
163 #define WLAN_VHTCAP_TX_STBC_S           7
164 /* B8-B10 Rx STBC */
165 #define WLAN_VHTCAP_RX_STBC             0x00000700
166 #define WLAN_VHTCAP_RX_STBC_S           8
167 /* B11 SU Beam former capable */
168 #define WLAN_VHTCAP_SU_BFORMER          0x00000800
169 #define WLAN_VHTCAP_SU_BFORMER_S        11
170 /* B12 SU Beam formee capable */
171 #define WLAN_VHTCAP_SU_BFORMEE          0x00001000
172 #define WLAN_VHTCAP_SU_BFORMEE_S        12
173 
174 /* B13-B15 Compressed steering number of beacomformer Antennas supported */
175 #define WLAN_VHTCAP_BF_MAX_ANT          0x0000E000
176 #define WLAN_VHTCAP_BF_MAX_ANT_S        13
177 /* B13-B15 Beamformee STS Capability */
178 #define WLAN_VHTCAP_STS_CAP_S           13
179 #define WLAN_VHTCAP_STS_CAP_M           0x7
180 
181 /* B16-B18 Sounding Dimensions */
182 #define WLAN_VHTCAP_SOUND_DIM           0x00070000
183 #define WLAN_VHTCAP_SOUND_DIM_S         16
184 /* B19 MU Beam Former */
185 #define WLAN_VHTCAP_MU_BFORMER          0x00080000
186 #define WLAN_VHTCAP_MU_BFORMER_S        19
187 /* B20 MU Beam Formee */
188 #define WLAN_VHTCAP_MU_BFORMEE          0x00100000
189 #define WLAN_VHTCAP_MU_BFORMEE_S        20
190 /* B21 VHT TXOP PS */
191 #define WLAN_VHTCAP_TXOP_PS             0x00200000
192 /* B22 +HTC-VHT capable */
193 #define WLAN_VHTCAP_PLUS_HTC_VHT        0x00400000
194 
195 #define WLAN_VHTCAP_MAX_AMPDU_LEN_FACTOR  13
196 /* B23-B25 maximum AMPDU Length Exponent */
197 #define WLAN_VHTCAP_MAX_AMPDU_LEN_EXP   0x03800000
198 #define WLAN_VHTCAP_MAX_AMPDU_LEN_EXP_S 23
199 /* B26-B27 VHT Link Adaptation capable */
200 #define WLAN_VHTCAP_LINK_ADAPT          0x0C000000
201 /* Rx Antenna Pattern Consistency Supported */
202 #define WLAN_VHTCAP_RX_ANTENNA_PATTERN  0x10000000
203 /* Tx Antenna Pattern Consistency Supported */
204 #define WLAN_VHTCAP_TX_ANTENNA_PATTERN  0x20000000
205 /* B30-B31 Extended NSS Bandwidth Support */
206 #define WLAN_VHTCAP_NO_EXT_NSS_BW_SUPPORT  0x00000000
207 /* B30-B31 Extended NSS Bandwidth Support */
208 #define WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_1   0x40000000
209 /* B30-B31 Extended NSS Bandwidth Support */
210 #define WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_2   0x80000000
211 /* B30-B31 Extended NSS Bandwidth Support */
212 #define WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_3   0xC0000000
213 #define WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_S   30
214 #define WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_MASK   0xC0000000
215 
216 #define WLAN_VHTCAP_EXT_NSS_MASK   (WLAN_VHTCAP_SUP_CHAN_WIDTH_MASK |\
217 					 WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_MASK)
218 /* VHTCAP combinations of "supported channel width" and "ext nss support"
219  * which determine the NSS value supported by STA for <=80 MHz, 160 MHz
220  * and 80+80 MHz. The macros to be read as combination of
221  * "supported channel width" and "ext nss support" followed by NSS for 80MHz,
222  * 160MHz and 80+80MHz defined as a function of Max VHT NSS supported.
223  * Ex: WLAN_EXTNSS_MAP_01_80F1_160FDOT5_80P80NONE - To be reas as
224  * supported channel width = 0
225  * ext nss support = 1
226  * NSS value for <=80MHz = max_vht_nss * 1
227  * NSS value for 160MHz = max_vht_nss * (.5)
228  * NSS value for 80+80MHz = not supported
229  */
230 #define WLAN_EXTNSS_MAP_00_80F1_160NONE_80P80NONE \
231 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_80 | WLAN_VHTCAP_NO_EXT_NSS_BW_SUPPORT)
232 #define WLAN_EXTNSS_MAP_01_80F1_160FDOT5_80P80NONE \
233 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_80 | WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_1)
234 #define WLAN_EXTNSS_MAP_02_80F1_160FDOT5_80P80FDOT5 \
235 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_80 | WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_2)
236 #define WLAN_EXTNSS_MAP_03_80F1_160FDOT75_80P80FDOT75 \
237 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_80 | WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_3)
238 #define WLAN_EXTNSS_MAP_10_80F1_160F1_80P80NONE \
239 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_160 | WLAN_VHTCAP_NO_EXT_NSS_BW_SUPPORT)
240 #define WLAN_EXTNSS_MAP_11_80F1_160F1_80P80FDOT5 \
241 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_160 | WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_1)
242 #define WLAN_EXTNSS_MAP_12_80F1_160F1_80P80FDOT75 \
243 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_160 | WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_2)
244 #define WLAN_EXTNSS_MAP_13_80F2_160F2_80P80F1 \
245 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_160 | WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_3)
246 #define WLAN_EXTNSS_MAP_20_80F1_160F1_80P80F1 \
247 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_80_160 | WLAN_VHTCAP_NO_EXT_NSS_BW_SUPPORT)
248 #define WLAN_EXTNSS_MAP_23_80F2_160F1_80P80F1 \
249 	(WLAN_VHTCAP_SUP_CHAN_WIDTH_80_160 | WLAN_VHTCAP_EXT_NSS_BW_SUPPORT_3)
250 
251 
252 /**
253  * enum wlan_umac_comp_id - UMAC component id
254  * @WLAN_UMAC_COMP_MLME:          MLME
255  * @WLAN_UMAC_COMP_MGMT_TXRX:     MGMT Tx/Rx
256  * @WLAN_UMAC_COMP_SERIALIZATION: Serialization
257  * @WLAN_UMAC_COMP_SCAN: SCAN -   as scan module uses services provided by
258  *                                MLME, MGMT_TXRX and SERIALIZATION, SCAN module
259  *                                must be initializes after above modules.
260  * @WLAN_UMAC_COMP_PMO:           PMO component
261  * @WLAN_UMAC_COMP_P2P:           P2P
262  * @WLAN_UMAC_COMP_POLICY_MGR:    Policy Manager
263  * @WLAN_UMAC_COMP_CONFIG:        Configuration
264  * @WLAN_TARGET_IF_COMP_DIRECT_BUF_RX: Direct Buffer RX
265  * @WLAN_UMAC_COMP_WIFI_POS:      WIFI Positioning
266  * @WLAN_UMAC_COMP_TDLS:          TDLS
267  * @WLAN_UMAC_COMP_ATF:           Airtime Fairness
268  * @WLAN_UMAC_COMP_SA_API:        Smart Antenna API
269  * @WLAN_UMAC_COMP_REGULATORY:    REGULATORY
270  * @WLAN_UMAC_COMP_CRYPTO:        CRYPTO
271  * @WLAN_UMAC_COMP_NAN:           Neighbor Aware Networking
272  * @WLAN_UMAC_COMP_DFS:           DFS
273  * @WLAN_UMAC_COMP_SPECTRAL:      Spectral
274  * @WLAN_UMAC_COMP_OFFCHAN_TXRX:  Offchan TxRx
275  * @WLAN_UMAC_COMP_SON:           SON
276  * @WLAN_UMAC_COMP_SPECTRAL:      Spectral
277  * @WLAN_UMAC_COMP_SPLITMAC:      SplitMAC
278  * @WLAN_UMAC_COMP_DISA:          DISA encryption test
279  * @WLAN_UMAC_COMP_GREEN_AP:      Green AP
280  * @WLAN_UMAC_COMP_FTM:           FTM component
281  * @WLAN_UMAC_COMP_FD:            FILS Discovery
282  * @WLAN_UMAC_COMP_OCB:           OCB
283  * @WLAN_UMAC_COMP_IPA:           IPA
284  * @WLAN_UMAC_COMP_CP_STATS:      Control Plane Statistics
285  * @WLAN_UMAC_COMP_ACTION_OUI:    ACTION OUI
286  * @WLAN_UMAC_COMP_FWOL:          FW Offload
287  * @WLAN_UMAC_COMP_CFR:           CFR component
288  * @WLAN_UMAC_COMP_INTEROP_ISSUES_AP: interop issues ap component
289  * @WLAN_UMAC_COMP_DENYLIST_MGR:  Denylist mgr component
290  * @WLAN_UMAC_COMP_COEX:          Coex config component
291  * @WLAN_UMAC_COMP_FTM_TIME_SYNC: WLAN FTM TIMESYNC
292  * @WLAN_UMAC_COMP_PKT_CAPTURE:   Packet capture component
293  * @WLAN_UMAC_COMP_DCS:           DCS
294  * @WLAN_IOT_SIM_COMP:            IOT Simulation component
295  * @WLAN_UMAC_COMP_IF_MGR:        Interface manager component
296  * @WLAN_UMAC_COMP_GPIO:          GPIO Configuration
297  * @WLAN_UMAC_COMP_MLO_MGR:       MLO manager
298  * @WLAN_UMAC_COMP_REPEATER:      Repeater component
299  * @WLAN_UMAC_COMP_MBSS:          MBSS Framework
300  * @WLAN_UMAC_COMP_WIFI_RADAR:    WIFI RADAR component
301  * @WLAN_UMAC_COMP_TWT:           Target Wake Time (TWT) Component
302  * @WLAN_UMAC_COMP_PRE_CAC:       PRE CAC component
303  * @WLAN_COMP_DP:                 DP component
304  * @WLAN_COMP_TELEMETRY_AGENT:    Telemetry Agent component
305  * @WLAN_UMAC_COMP_COAP:          Constrained Application Protocol component
306  * @WLAN_UMAC_COMP_QMI:           QMI component
307  * @WLAN_UMAC_COMP_AFC:           AFC component
308  * @WLAN_UMAC_COMP_SAWF:          SAWF component
309  * @WLAN_UMAC_COMP_LL_SAP:        LL SAP component
310  * @WLAN_UMAC_COMP_ID_MAX:        Maximum components in UMAC
311  *
312  * This id is static.
313  * On Adding new component, new id has to be assigned
314  */
315 enum wlan_umac_comp_id {
316 	WLAN_UMAC_COMP_MLME               = 0,
317 	WLAN_UMAC_COMP_MGMT_TXRX          = 1,
318 	WLAN_UMAC_COMP_SERIALIZATION      = 2,
319 	WLAN_UMAC_COMP_SCAN               = 3,
320 	WLAN_UMAC_COMP_PMO                = 4,
321 	WLAN_UMAC_COMP_P2P                = 5,
322 	WLAN_UMAC_COMP_POLICY_MGR         = 6,
323 	WLAN_UMAC_COMP_CONFIG             = 7,
324 	WLAN_TARGET_IF_COMP_DIRECT_BUF_RX = 8,
325 	WLAN_UMAC_COMP_WIFI_POS           = 9,
326 	WLAN_UMAC_COMP_TDLS               = 10,
327 	WLAN_UMAC_COMP_ATF                = 11,
328 	WLAN_UMAC_COMP_SA_API             = 12,
329 	WLAN_UMAC_COMP_REGULATORY         = 13,
330 	WLAN_UMAC_COMP_CRYPTO             = 14,
331 	WLAN_UMAC_COMP_NAN                = 15,
332 	WLAN_UMAC_COMP_DFS                = 16,
333 	WLAN_UMAC_COMP_OFFCHAN_TXRX       = 17,
334 	WLAN_UMAC_COMP_SON                = 18,
335 	WLAN_UMAC_COMP_SPECTRAL           = 19,
336 	WLAN_UMAC_COMP_SPLITMAC           = 20,
337 	WLAN_UMAC_COMP_DISA               = 21,
338 	WLAN_UMAC_COMP_GREEN_AP           = 22,
339 	WLAN_UMAC_COMP_FTM                = 23,
340 	WLAN_UMAC_COMP_FD                 = 24,
341 	WLAN_UMAC_COMP_OCB                = 25,
342 	WLAN_UMAC_COMP_IPA                = 26,
343 	WLAN_UMAC_COMP_CP_STATS           = 27,
344 	WLAN_UMAC_COMP_ACTION_OUI         = 28,
345 	WLAN_UMAC_COMP_FWOL               = 29,
346 	WLAN_UMAC_COMP_CFR                = 30,
347 	WLAN_UMAC_COMP_INTEROP_ISSUES_AP  = 31,
348 	WLAN_UMAC_COMP_DENYLIST_MGR       = 32,
349 	WLAN_UMAC_COMP_COEX               = 33,
350 	WLAN_UMAC_COMP_FTM_TIME_SYNC      = 34,
351 	WLAN_UMAC_COMP_PKT_CAPTURE        = 35,
352 	WLAN_UMAC_COMP_DCS                = 36,
353 	WLAN_IOT_SIM_COMP                 = 37,
354 	WLAN_UMAC_COMP_IF_MGR             = 38,
355 	WLAN_UMAC_COMP_GPIO               = 39,
356 	WLAN_UMAC_COMP_MLO_MGR            = 40,
357 	WLAN_UMAC_COMP_REPEATER           = 41,
358 	WLAN_UMAC_COMP_MBSS               = 42,
359 	WLAN_UMAC_COMP_WIFI_RADAR         = 43,
360 	WLAN_UMAC_COMP_TWT                = 44,
361 	WLAN_UMAC_COMP_PRE_CAC            = 45,
362 	WLAN_COMP_DP                      = 46,
363 	WLAN_COMP_TELEMETRY_AGENT         = 47,
364 	WLAN_UMAC_COMP_COAP               = 48,
365 	WLAN_UMAC_COMP_QMI                = 49,
366 	WLAN_UMAC_COMP_AFC                = 50,
367 	WLAN_UMAC_COMP_SAWF               = 51,
368 	WLAN_UMAC_COMP_LL_SAP             = 52,
369 	WLAN_UMAC_COMP_ID_MAX,
370 };
371 
372 /**
373  *  enum WLAN_DEV_TYPE  - for DA or OL architecture types
374  *  @WLAN_DEV_DA:       Direct attach
375  *  @WLAN_DEV_OL:       Partial offload
376  *  @WLAN_DEV_INVALID:  Invalid dev type
377  */
378 typedef enum {
379 	WLAN_DEV_DA       = 0,
380 	WLAN_DEV_OL       = 1,
381 	WLAN_DEV_INVALID  = 3,
382 } WLAN_DEV_TYPE;
383 
384 /**
385  * enum wlan_phymode - phy mode
386  * @WLAN_PHYMODE_AUTO:           autoselect
387  * @WLAN_PHYMODE_11A:            5GHz, OFDM
388  * @WLAN_PHYMODE_11B:            2GHz, CCK
389  * @WLAN_PHYMODE_11G:            2GHz, OFDM
390  * @WLAN_PHYMODE_11G_ONLY:       2GHz only
391  * @WLAN_PHYMODE_11NA_HT20:      5Ghz, HT20
392  * @WLAN_PHYMODE_11NG_HT20:      2Ghz, HT20
393  * @WLAN_PHYMODE_11NA_HT40:      5Ghz, Auto HT40
394  * @WLAN_PHYMODE_11NG_HT40PLUS:  2Ghz, HT40 (ext ch +1)
395  * @WLAN_PHYMODE_11NG_HT40MINUS: 2Ghz, HT40 (ext ch -1)
396  * @WLAN_PHYMODE_11NG_HT40:      2Ghz, Auto HT40
397  * @WLAN_PHYMODE_11AC_VHT20:     5Ghz, VHT20
398  * @WLAN_PHYMODE_11AC_VHT20_2G:  2Ghz, VHT20
399  * @WLAN_PHYMODE_11AC_VHT40:     5Ghz, VHT40
400  * @WLAN_PHYMODE_11AC_VHT40PLUS_2G:  2Ghz, VHT40 (ext ch +1)
401  * @WLAN_PHYMODE_11AC_VHT40MINUS_2G:  2Ghz, VHT40 (ext ch -1)
402  * @WLAN_PHYMODE_11AC_VHT40_2G:  2Ghz, VHT40
403  * @WLAN_PHYMODE_11AC_VHT80:     5Ghz, VHT80
404  * @WLAN_PHYMODE_11AC_VHT80_2G:  2Ghz, VHT80
405  * @WLAN_PHYMODE_11AC_VHT160:    5Ghz, VHT160
406  * @WLAN_PHYMODE_11AC_VHT80_80:  5Ghz, VHT80_80
407  * @WLAN_PHYMODE_11AXA_HE20:     5GHz, HE20
408  * @WLAN_PHYMODE_11AXG_HE20:     2GHz, HE20
409  * @WLAN_PHYMODE_11AXA_HE40:     5GHz, HE40
410  * @WLAN_PHYMODE_11AXG_HE40PLUS: 2GHz, HE40 (ext ch +1)
411  * @WLAN_PHYMODE_11AXG_HE40MINUS:2GHz, HE40 (ext ch -1)
412  * @WLAN_PHYMODE_11AXG_HE40:     2GHz, HE40
413  * @WLAN_PHYMODE_11AXA_HE80:     5GHz, HE80
414  * @WLAN_PHYMODE_11AXG_HE80:     2GHz, HE80
415  * @WLAN_PHYMODE_11AXA_HE160:    5GHz, HE160
416  * @WLAN_PHYMODE_11AXA_HE80_80:  5GHz, HE80_80
417  * @WLAN_PHYMODE_11BEA_EHT20:     5GHz, EHT20
418  * @WLAN_PHYMODE_11BEG_EHT20:     2GHz, EHT20
419  * @WLAN_PHYMODE_11BEA_EHT40:     5GHz, EHT40
420  * @WLAN_PHYMODE_11BEG_EHT40PLUS: 2GHz, EHT40 (ext ch +1)
421  * @WLAN_PHYMODE_11BEG_EHT40MINUS:2GHz, EHT40 (ext ch -1)
422  * @WLAN_PHYMODE_11BEG_EHT40:     2GHz, EHT40
423  * @WLAN_PHYMODE_11BEA_EHT80:     5GHz, EHT80
424  * @WLAN_PHYMODE_11BEG_EHT80:     2GHz, EHT80
425  * @WLAN_PHYMODE_11BEA_EHT160:    5GHz, EHT160
426  * @WLAN_PHYMODE_11BEA_EHT320:    5GHz, EHT320
427  * @WLAN_PHYMODE_MAX: Max phymode
428  */
429 enum wlan_phymode {
430 	WLAN_PHYMODE_AUTO               = 0,
431 	WLAN_PHYMODE_11A                = 1,
432 	WLAN_PHYMODE_11B                = 2,
433 	WLAN_PHYMODE_11G                = 3,
434 	WLAN_PHYMODE_11G_ONLY           = 4,
435 	WLAN_PHYMODE_11NA_HT20          = 5,
436 	WLAN_PHYMODE_11NG_HT20          = 6,
437 	WLAN_PHYMODE_11NA_HT40          = 7,
438 	WLAN_PHYMODE_11NG_HT40PLUS      = 8,
439 	WLAN_PHYMODE_11NG_HT40MINUS     = 9,
440 	WLAN_PHYMODE_11NG_HT40          = 10,
441 	WLAN_PHYMODE_11AC_VHT20         = 11,
442 	WLAN_PHYMODE_11AC_VHT20_2G      = 12,
443 	WLAN_PHYMODE_11AC_VHT40         = 13,
444 	WLAN_PHYMODE_11AC_VHT40PLUS_2G  = 14,
445 	WLAN_PHYMODE_11AC_VHT40MINUS_2G = 15,
446 	WLAN_PHYMODE_11AC_VHT40_2G      = 16,
447 	WLAN_PHYMODE_11AC_VHT80         = 17,
448 	WLAN_PHYMODE_11AC_VHT80_2G      = 18,
449 	WLAN_PHYMODE_11AC_VHT160        = 19,
450 	WLAN_PHYMODE_11AC_VHT80_80      = 20,
451 	WLAN_PHYMODE_11AXA_HE20         = 21,
452 	WLAN_PHYMODE_11AXG_HE20         = 22,
453 	WLAN_PHYMODE_11AXA_HE40         = 23,
454 	WLAN_PHYMODE_11AXG_HE40PLUS     = 24,
455 	WLAN_PHYMODE_11AXG_HE40MINUS    = 25,
456 	WLAN_PHYMODE_11AXG_HE40         = 26,
457 	WLAN_PHYMODE_11AXA_HE80         = 27,
458 	WLAN_PHYMODE_11AXG_HE80         = 28,
459 	WLAN_PHYMODE_11AXA_HE160        = 29,
460 	WLAN_PHYMODE_11AXA_HE80_80      = 30,
461 #ifdef WLAN_FEATURE_11BE
462 	WLAN_PHYMODE_11BEA_EHT20        = 31,
463 	WLAN_PHYMODE_11BEG_EHT20        = 32,
464 	WLAN_PHYMODE_11BEA_EHT40        = 33,
465 	WLAN_PHYMODE_11BEG_EHT40PLUS    = 34,
466 	WLAN_PHYMODE_11BEG_EHT40MINUS   = 35,
467 	WLAN_PHYMODE_11BEG_EHT40        = 36,
468 	WLAN_PHYMODE_11BEA_EHT80        = 37,
469 	WLAN_PHYMODE_11BEG_EHT80        = 38,
470 	WLAN_PHYMODE_11BEA_EHT160       = 39,
471 	WLAN_PHYMODE_11BEA_EHT320       = 40,
472 #endif
473 	WLAN_PHYMODE_MAX
474 };
475 
476 #ifdef WLAN_FEATURE_11BE
477 #define IS_WLAN_PHYMODE_320MHZ(_mode) ({typeof(_mode) mode = (_mode); \
478 	((mode) == WLAN_PHYMODE_11BEA_EHT320); })
479 
480 #define IS_WLAN_PHYMODE_160MHZ(_mode) ({typeof(_mode) mode = (_mode); \
481 	((mode) == WLAN_PHYMODE_11BEA_EHT160) || \
482 	((mode) == WLAN_PHYMODE_11AC_VHT80_80) || \
483 	((mode) == WLAN_PHYMODE_11AC_VHT160)     || \
484 	((mode) == WLAN_PHYMODE_11AXA_HE80_80)  || \
485 	((mode) == WLAN_PHYMODE_11AXA_HE160); })
486 
487 #define IS_WLAN_PHYMODE_80MHZ(_mode) ({typeof(_mode) mode = (_mode); \
488 	((mode) == WLAN_PHYMODE_11BEA_EHT80) || \
489 	((mode) == WLAN_PHYMODE_11AC_VHT80) || \
490 	((mode) == WLAN_PHYMODE_11AC_VHT80_2G)     || \
491 	((mode) == WLAN_PHYMODE_11AXA_HE80)  || \
492 	((mode) == WLAN_PHYMODE_11AXG_HE80); })
493 
494 #define IS_WLAN_PHYMODE_40MHZ(_mode) ({typeof(_mode) mode = (_mode); \
495 	((mode) == WLAN_PHYMODE_11NG_HT40) || \
496 	((mode) == WLAN_PHYMODE_11NG_HT40PLUS)     || \
497 	((mode) == WLAN_PHYMODE_11NG_HT40MINUS)  || \
498 	((mode) == WLAN_PHYMODE_11NA_HT40)  || \
499 	((mode) == WLAN_PHYMODE_11AC_VHT40)  || \
500 	((mode) == WLAN_PHYMODE_11AC_VHT40_2G)  || \
501 	((mode) == WLAN_PHYMODE_11AC_VHT40PLUS_2G)  || \
502 	((mode) == WLAN_PHYMODE_11AC_VHT40MINUS_2G)  || \
503 	((mode) == WLAN_PHYMODE_11BEA_EHT40)  || \
504 	((mode) == WLAN_PHYMODE_11BEG_EHT40)  || \
505 	((mode) == WLAN_PHYMODE_11BEG_EHT40PLUS)  || \
506 	((mode) == WLAN_PHYMODE_11BEG_EHT40MINUS)  || \
507 	((mode) == WLAN_PHYMODE_11AXA_HE40)  || \
508 	((mode) == WLAN_PHYMODE_11AXG_HE40)  || \
509 	((mode) == WLAN_PHYMODE_11AXG_HE40PLUS)  || \
510 	((mode) == WLAN_PHYMODE_11AXG_HE40MINUS); })
511 
512 #define IS_WLAN_PHYMODE_EHT(_mode) ({typeof(_mode) mode = (_mode); \
513 	((mode) == WLAN_PHYMODE_11BEA_EHT20) || \
514 	((mode) == WLAN_PHYMODE_11BEG_EHT20)     || \
515 	((mode) == WLAN_PHYMODE_11BEA_EHT40)  || \
516 	((mode) == WLAN_PHYMODE_11BEG_EHT40)  || \
517 	((mode) == WLAN_PHYMODE_11BEG_EHT40PLUS)  || \
518 	((mode) == WLAN_PHYMODE_11BEG_EHT40MINUS)  || \
519 	((mode) == WLAN_PHYMODE_11BEA_EHT80)  || \
520 	((mode) == WLAN_PHYMODE_11BEG_EHT80)  || \
521 	((mode) == WLAN_PHYMODE_11BEA_EHT160)  || \
522 	((mode) == WLAN_PHYMODE_11BEA_EHT320); })
523 
524 #else
525 #define IS_WLAN_PHYMODE_320MHZ(_mode) 0
526 
527 #define IS_WLAN_PHYMODE_160MHZ(_mode) ({typeof(_mode) mode = (_mode); \
528 	((mode) == WLAN_PHYMODE_11AC_VHT80_80) || \
529 	((mode) == WLAN_PHYMODE_11AC_VHT160)     || \
530 	((mode) == WLAN_PHYMODE_11AXA_HE80_80)  || \
531 	((mode) == WLAN_PHYMODE_11AXA_HE160); })
532 
533 #define IS_WLAN_PHYMODE_80MHZ(_mode) ({typeof(_mode) mode = (_mode); \
534 	((mode) == WLAN_PHYMODE_11AC_VHT80) || \
535 	((mode) == WLAN_PHYMODE_11AC_VHT80_2G)     || \
536 	((mode) == WLAN_PHYMODE_11AXA_HE80)  || \
537 	((mode) == WLAN_PHYMODE_11AXG_HE80); })
538 
539 #define IS_WLAN_PHYMODE_40MHZ(_mode) ({typeof(_mode) mode = (_mode); \
540 	((mode) == WLAN_PHYMODE_11NG_HT40) || \
541 	((mode) == WLAN_PHYMODE_11NG_HT40PLUS)     || \
542 	((mode) == WLAN_PHYMODE_11NG_HT40MINUS)  || \
543 	((mode) == WLAN_PHYMODE_11NA_HT40)  || \
544 	((mode) == WLAN_PHYMODE_11AC_VHT40)  || \
545 	((mode) == WLAN_PHYMODE_11AC_VHT40_2G)  || \
546 	((mode) == WLAN_PHYMODE_11AC_VHT40PLUS_2G)  || \
547 	((mode) == WLAN_PHYMODE_11AC_VHT40MINUS_2G)  || \
548 	((mode) == WLAN_PHYMODE_11AXA_HE40)  || \
549 	((mode) == WLAN_PHYMODE_11AXG_HE40)  || \
550 	((mode) == WLAN_PHYMODE_11AXG_HE40PLUS)  || \
551 	((mode) == WLAN_PHYMODE_11AXG_HE40MINUS); })
552 
553 #define IS_WLAN_PHYMODE_EHT(_mode) 0
554 #endif
555 
556 #define IS_WLAN_PHYMODE_HT(_mode) ({typeof(_mode) mode = (_mode); \
557 	((mode) == WLAN_PHYMODE_11NA_HT20) || \
558 	((mode) == WLAN_PHYMODE_11NG_HT20)     || \
559 	((mode) == WLAN_PHYMODE_11NA_HT40)  || \
560 	((mode) == WLAN_PHYMODE_11NG_HT40PLUS)  || \
561 	((mode) == WLAN_PHYMODE_11NG_HT40MINUS)  || \
562 	((mode) == WLAN_PHYMODE_11NG_HT40); })
563 
564 #define IS_WLAN_PHYMODE_VHT(_mode) ({typeof(_mode) mode = (_mode); \
565 	((mode) == WLAN_PHYMODE_11AC_VHT20) || \
566 	((mode) == WLAN_PHYMODE_11AC_VHT20_2G)     || \
567 	((mode) == WLAN_PHYMODE_11AC_VHT40)  || \
568 	((mode) == WLAN_PHYMODE_11AC_VHT40PLUS_2G)  || \
569 	((mode) == WLAN_PHYMODE_11AC_VHT40MINUS_2G)  || \
570 	((mode) == WLAN_PHYMODE_11AC_VHT40_2G)  || \
571 	((mode) == WLAN_PHYMODE_11AC_VHT80)  || \
572 	((mode) == WLAN_PHYMODE_11AC_VHT80_2G)  || \
573 	((mode) == WLAN_PHYMODE_11AC_VHT160)  || \
574 	((mode) == WLAN_PHYMODE_11AC_VHT80_80); })
575 
576 #define IS_WLAN_PHYMODE_HE(_mode) ({typeof(_mode) mode = (_mode); \
577 	((mode) == WLAN_PHYMODE_11AXA_HE20) || \
578 	((mode) == WLAN_PHYMODE_11AXG_HE20)     || \
579 	((mode) == WLAN_PHYMODE_11AXA_HE40)  || \
580 	((mode) == WLAN_PHYMODE_11AXG_HE40)  || \
581 	((mode) == WLAN_PHYMODE_11AXG_HE40PLUS)  || \
582 	((mode) == WLAN_PHYMODE_11AXG_HE40MINUS)  || \
583 	((mode) == WLAN_PHYMODE_11AXA_HE80)  || \
584 	((mode) == WLAN_PHYMODE_11AXG_HE80)  || \
585 	((mode) == WLAN_PHYMODE_11AXA_HE160)  || \
586 	((mode) == WLAN_PHYMODE_11AXA_HE80_80); })
587 
588 /**
589  * enum phy_ch_width - channel width
590  * @CH_WIDTH_20MHZ: 20 MHz width
591  * @CH_WIDTH_40MHZ: 40 MHz width
592  * @CH_WIDTH_80MHZ: 80 MHz width
593  * @CH_WIDTH_160MHZ: 160 MHz width
594  * @CH_WIDTH_80P80MHZ: 80+80 MHz width
595  * @CH_WIDTH_5MHZ: 5 MHz width
596  * @CH_WIDTH_10MHZ: 10 MHz width
597  * @CH_WIDTH_320MHZ: 320 MHz width
598  * @CH_WIDTH_INVALID: invalid width
599  * @CH_WIDTH_MAX: max possible width
600  */
601 enum phy_ch_width {
602 	CH_WIDTH_20MHZ = 0,
603 	CH_WIDTH_40MHZ,
604 	CH_WIDTH_80MHZ,
605 	CH_WIDTH_160MHZ,
606 	CH_WIDTH_80P80MHZ,
607 	CH_WIDTH_5MHZ,
608 	CH_WIDTH_10MHZ,
609 	CH_WIDTH_320MHZ,
610 	CH_WIDTH_INVALID,
611 	CH_WIDTH_MAX
612 };
613 
614 /**
615  * enum wifi_traffic_ac - access category type
616  * @WIFI_AC_VO: Voice AC
617  * @WIFI_AC_VI: Video AC
618  * @WIFI_AC_BE: Best effort AC
619  * @WIFI_AC_BK: Background AC
620  * @WIFI_AC_MAX: MAX access category
621  */
622 enum wifi_traffic_ac {
623 	WIFI_AC_VO = 0,
624 	WIFI_AC_VI = 1,
625 	WIFI_AC_BE = 2,
626 	WIFI_AC_BK = 3,
627 	WIFI_AC_MAX = 4,
628 };
629 
630 /**
631  * enum wlan_peer_type  - peer type
632  * @WLAN_PEER_SELF:     for AP mode, SELF PEER or AP PEER are same
633  * @WLAN_PEER_AP:       BSS peer for STA mode, Self peer for AP mode
634  * @WLAN_PEER_P2P_GO:   BSS peer for P2P CLI mode, Self peer for P2P GO mode
635  * @WLAN_PEER_STA:      Self Peer for STA mode, STA peer for AP mode
636  * @WLAN_PEER_P2P_CLI:  Self peer for P2P CLI mode, P2P CLI peer for P2P GO mode
637  * @WLAN_PEER_TDLS:     TDLS Peer
638  * @WLAN_PEER_NAWDS:    NAWDS Peer
639  * @WLAN_PEER_STA_TEMP: STA Peer Temp (its host only node)
640  * @WLAN_PEER_IBSS:     IBSS Peer
641  * @WLAN_PEER_NDP:      NDP Peer
642  * @WLAN_PEER_MLO_TEMP: MLO Peer Temp (host only node)
643  * @WLAN_PEER_RTT_PASN: Ranging PASN peer
644  * @WLAN_PEER_MLO_BRIDGE: MLO Bridge peer
645  */
646 enum wlan_peer_type {
647 	WLAN_PEER_SELF     = 1,
648 	WLAN_PEER_AP       = 2,
649 	WLAN_PEER_P2P_GO   = 3,
650 	WLAN_PEER_STA      = 4,
651 	WLAN_PEER_P2P_CLI  = 5,
652 	WLAN_PEER_TDLS     = 6,
653 	WLAN_PEER_NAWDS    = 7,
654 	WLAN_PEER_STA_TEMP = 8,
655 	WLAN_PEER_IBSS     = 9,
656 	WLAN_PEER_NDP      = 10,
657 	WLAN_PEER_MLO_TEMP = 11,
658 	WLAN_PEER_RTT_PASN = 12,
659 	WLAN_PEER_MLO_BRIDGE = 13,
660 };
661 
662 /**
663  * enum wlan_band - specifies operating channel band
664  * @WLAN_BAND_ALL: Any band
665  * @WLAN_BAND_2_4_GHZ: 2.4 GHz band
666  * @WLAN_BAND_5_GHZ: 5 GHz band
667  * @WLAN_BAND_4_9_GHZ: 4.9 GHz band
668  * @WLAN_BAND_NUM_MAX: Max num band
669  */
670 enum wlan_band {
671 	WLAN_BAND_ALL,
672 	WLAN_BAND_2_4_GHZ,
673 	WLAN_BAND_5_GHZ,
674 	WLAN_BAND_4_9_GHZ,
675 	WLAN_BAND_NUM_MAX,
676 };
677 
678 /**
679  * enum wlan_bss_type - type of network
680  * @WLAN_TYPE_ANY: Default value
681  * @WLAN_TYPE_BSS: Type BSS
682  * @WLAN_TYPE_IBSS: Type IBSS
683  */
684 enum wlan_bss_type {
685 	WLAN_TYPE_ANY,
686 	WLAN_TYPE_BSS,
687 	WLAN_TYPE_IBSS,
688 };
689 
690 /**
691  * enum wlan_pmf_cap - pmf capability
692  * @WLAN_PMF_DISABLED: PMF is disabled
693  * @WLAN_PMF_CAPABLE: PMF is supported
694  * @WLAN_PMF_REQUIRED: PMF is mandatory
695  */
696 enum wlan_pmf_cap {
697 	WLAN_PMF_DISABLED,
698 	WLAN_PMF_CAPABLE,
699 	WLAN_PMF_REQUIRED,
700 };
701 
702 /**
703  * struct wlan_ssid - SSID info
704  * @length: ssid length of bss excluding null
705  * @ssid: ssid character array potentially non null terminated
706  */
707 struct wlan_ssid {
708 	uint8_t length;
709 	uint8_t ssid[WLAN_SSID_MAX_LEN];
710 };
711 
712 /* Util API to copy the MAC address */
713 #define WLAN_ADDR_COPY(dst, src)    qdf_mem_copy(dst, src, QDF_MAC_ADDR_SIZE)
714 /* Util API to compare the MAC address */
715 #define WLAN_ADDR_EQ(a1, a2)   qdf_mem_cmp(a1, a2, QDF_MAC_ADDR_SIZE)
716 
717 #define PSOC_SERVICE_BM_SIZE ((128 + sizeof(uint32_t) - 1) / sizeof(uint32_t))
718 #define PSOC_HOST_MAX_NUM_SS (8)
719 #define PSOC_HOST_MAX_PHY_SIZE (3)
720 #define PSOC_HOST_MAX_MAC_SIZE (2)
721 #define PSOC_MAX_HW_MODE (4)
722 #define PSOC_MAX_MAC_PHY_CAP (8)
723 #define PSOC_MAX_PHY_REG_CAP (3)
724 #define PSOC_MAX_CHAINMASK_TABLES (5)
725 
726 #ifdef WLAN_RCC_ENHANCED_AOA_SUPPORT
727 #define PSOC_MAX_NUM_AGC_GAIN_TBLS 8
728 #endif
729 
730 #ifdef WLAN_FEATURE_11BE
731 #define PSOC_HOST_MAX_EHT_MAC_SIZE 1
732 #define PSOC_HOST_MAX_EHT_PHY_SIZE 3
733 #define PSOC_HOST_EHT_MCS_NSS_MAP_2G_SIZE 2
734 #define PSOC_HOST_EHT_MCS_NSS_MAP_5G_SIZE 4
735 #endif
736 
737 /**
738  * enum host_edca_param_type - Host edca param type
739  * @HOST_EDCA_PARAM_TYPE_AGGRESSIVE: Aggressive type
740  * @HOST_EDCA_PARAM_TYPE_PIFS: Pifs type
741  */
742 enum host_edca_param_type {
743 	HOST_EDCA_PARAM_TYPE_AGGRESSIVE = 0,
744 	HOST_EDCA_PARAM_TYPE_PIFS = 1,
745 };
746 
747 #endif /* _WLAN_OBJMGR_CMN_H_*/
748