1 /*
2  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-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 /*
21 
22  *
23 
24  * Author:      Sandesh Goel
25 
26  * Date:        02/25/02
27 
28  * History:-
29 
30  * Date            Modified by    Modification Information
31 
32  * --------------------------------------------------------------------
33 
34  *
35 
36  */
37 
38 #ifndef __DPH_GLOBAL_H__
39 #define __DPH_GLOBAL_H__
40 
41 #include "lim_global.h"
42 #include "sir_mac_prot_def.h"
43 #include "sir_api.h"
44 
45 /* DPH Hash Index for BSS(STA's Peer) on station. */
46 #define DPH_STA_HASH_INDEX_PEER   1
47 
48 /* DPH PMF SA Query state for station */
49 #define DPH_SA_QUERY_NOT_IN_PROGRESS      1
50 #define DPH_SA_QUERY_IN_PROGRESS          2
51 #define DPH_SA_QUERY_TIMED_OUT            3
52 
53 typedef struct sDphQosParams {
54 	uint8_t addtsPresent;
55 	tSirAddtsReqInfo addts;
56 	tSirMacQosCapabilityStaIE capability;
57 	/*AP EDCA params, extracted from assoc resp*/
58 	tSirMacEdcaParamSetIE peer_edca_params;
59 } tDphQosParams;
60 
61 /**
62  * struct parsed_ies: Parsed IE's of BSS capability
63  * @ht_caps: HT caps IE
64  * @vht_caps: VHT caps IE
65  * @ht_operation: HT operation IE
66  * @vht_operation: VHT operation IE
67  * @hs20vendor_ie: HS2.0 vendor IE
68  * @he_operation: HE operation IE
69  * @srp_ie: Spatial Reuse Parameter IE
70  * @eht_operation: EHT IE
71  *
72  * This structure holds the parsed IE of connected BSS
73  * and this is not the intersection of BSS and STA
74  * capability. For example, if BSS supports 80 MHz
75  * and STA connects to BSS in 20 MHz, this structure
76  * holds 80 MHz as peer capability.
77  */
78 struct parsed_ies {
79 	tDot11fIEHTCaps ht_caps;
80 	tDot11fIEVHTCaps vht_caps;
81 	tDot11fIEHTInfo ht_operation;
82 	tDot11fIEVHTOperation vht_operation;
83 	tDot11fIEhs20vendor_ie hs20vendor_ie;
84 #ifdef WLAN_FEATURE_11AX
85 	tDot11fIEhe_op he_operation;
86 #endif
87 #ifdef WLAN_FEATURE_SR
88 	tDot11fIEspatial_reuse srp_ie;
89 #endif
90 #ifdef WLAN_FEATURE_11BE
91 	tDot11fIEeht_op eht_operation;
92 #endif
93 };
94 
95 /* STA state node */
96 typedef struct sDphHashNode {
97 	/*
98 	 * This STA valid or not
99 	 */
100 	uint8_t valid:1;
101 	uint8_t qosMode:1;
102 	uint8_t erpEnabled:1;
103 	/* This has been added to the dph hash table */
104 	uint8_t added:1;
105 	uint8_t shortPreambleEnabled:1;
106 	uint8_t shortSlotTimeEnabled:1;
107 	/* set if both ap and sta are wme capable */
108 	uint8_t wmeEnabled:1;
109 	/* set if both ap and sta are 11e capable */
110 	uint8_t lleEnabled:1;
111 	/* set if both ap and sta are wsm capable */
112 	uint8_t wsmEnabled:1;
113 	uint8_t fAniCount:1;
114 	uint8_t rmfEnabled:1;
115 	uint8_t ocv_enabled:1;
116 	/* LIM state */
117 	struct lim_sta_context mlmStaContext;
118 	/* qos parameter info */
119 	tDphQosParams qos;
120 	/*
121 	 * All the legacy and airgo supported rates.
122 	 */
123 	struct supported_rates supportedRates;
124 	/* MIMO Power Save */
125 	tSirMacHTMIMOPowerSaveState htMIMOPSState;
126 	uint8_t htGreenfield:1;
127 	uint8_t htShortGI40Mhz:1;
128 	uint8_t htShortGI20Mhz:1;
129 	/* DSSS/CCK at 40 MHz: Enabled 1 or Disabled */
130 	uint8_t htDsssCckRate40MHzSupport:1;
131 	/* L-SIG TXOP Protection used only if peer support available */
132 	uint8_t htLsigTXOPProtection:1;
133 	/*
134 	 * A-MPDU Density
135 	 * 000 - No restriction
136 	 * 001 - 1/8 usec
137 	 * 010 - 1/4 usec
138 	 * 011 - 1/2 usec
139 	 * 100 - 1 usec
140 	 * 101 - 2 usec
141 	 * 110 - 4 usec
142 	 * 111 - 8 usec
143 	 */
144 	uint8_t htAMpduDensity:3;
145 	/* Set to 0 for 3839 octets */
146 	/* Set to 1 for 7935 octets */
147 	uint8_t htMaxAmsduLength;
148 	/* */
149 	/* Maximum Rx A-MPDU factor */
150 	uint8_t htMaxRxAMpduFactor:3;
151 	/*
152 	 * Recommended Tx Width Set
153 	 * 0 - use 20 MHz channel (control channel)
154 	 * 1 - use 40 Mhz channel
155 	 */
156 	uint8_t htSupportedChannelWidthSet:1;
157 	uint8_t htSecondaryChannelOffset:2;
158 	uint16_t assocId;       /* Association ID */
159 	uint8_t staAddr[6];
160 	uint8_t staType;
161 
162 	uint8_t vhtSupportedChannelWidthSet;
163 	enum phy_ch_width ch_width;
164 	uint8_t vhtSupportedRxNss;
165 	uint8_t vhtBeamFormerCapable;
166 	uint8_t vht_su_bfee_capable;
167 	uint8_t vht_mcs_10_11_supp;
168 	uint8_t vht_160mhz_nss;
169 	uint8_t vht_80p80mhz_nss;
170 	uint8_t vht_extended_nss_bw_cap;
171 	TX_TIMER pmfSaQueryTimer;
172 	uint16_t pmfSaQueryCurrentTransId;
173 	uint16_t pmfSaQueryStartTransId;
174 	uint8_t pmfSaQueryState;
175 	uint8_t pmfSaQueryRetryCount;
176 	uint8_t htLdpcCapable;
177 	uint8_t vhtLdpcCapable;
178 #ifdef FEATURE_WLAN_TDLS
179 	uint16_t ht_caps;
180 	uint32_t vht_caps;
181 #endif
182 	uint8_t timingMeasCap;
183 	/* key installed for this STA or not in the firmware */
184 	uint8_t is_key_installed;
185 	uint8_t is_disassoc_deauth_in_progress;
186 
187 	uint8_t nss;
188 	int8_t del_sta_ctx_rssi;
189 	bool sta_deletion_in_progress;
190 	/* Flag indicating connected STA doesn't support ECSA */
191 	uint8_t non_ecsa_capable;
192 	struct parsed_ies parsed_ies;
193 	uint32_t last_ocv_done_freq;
194 
195 #ifdef WLAN_FEATURE_11AX
196 	tDot11fIEhe_cap he_config;
197 	uint16_t he_mcs_12_13_map;
198 	tDot11fIEhe_6ghz_band_cap he_6g_band_cap;
199 #endif
200 
201 #ifdef WLAN_FEATURE_11BE
202 	tDot11fIEeht_cap eht_config;
203 	tDot11fIEeht_op eht_op;
204 #endif
205 
206 	/* Peer operation class, extracted from ASSOC request frame*/
207 	tDot11fIESuppOperatingClasses supp_operating_classes;
208 	/*
209 	 * When a station with already an existing dph entry tries to
210 	 * associate again, the old dph entry will be zeroed out except
211 	 * for the next pointer. The next pointer must be defined at the
212 	 * end of the structure.
213 	 */
214 	struct sDphHashNode *next;
215 #ifdef WLAN_FEATURE_11BE_MLO
216 	bool recv_assoc_frm;
217 	uint8_t mld_addr[QDF_MAC_ADDR_SIZE];
218 	struct mlo_partner_info mlo_info;
219 #endif
220 } tDphHashNode, *tpDphHashNode;
221 
222 #include "dph_hash_table.h"
223 
224 /* ------------------------------------------------------------------- */
225 typedef struct sAniSirDph {
226 	/* The hash table object */
227 	struct dph_hash_table dphHashTable;
228 } tAniSirDph, *tpAniSirDph;
229 
230 #endif
231