1 /*
2  * Copyright (c) 2020-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: This file contains definitions for MLME roaming offload.
20  */
21 
22 #ifndef CM_ROAM_PUBLIC_STRUCT_H__
23 #define CM_ROAM_PUBLIC_STRUCT_H__
24 
25 #include "wlan_objmgr_cmn.h"
26 #include "reg_services_public_struct.h"
27 #include "wlan_cm_bss_score_param.h"
28 #include "wlan_dlm_public_struct.h"
29 #include "wmi_unified_param.h"
30 #include "wmi_unified_sta_param.h"
31 #include "wlan_cm_public_struct.h"
32 #include "wmi_unified.h"
33 
34 #define WLAN_ROAM_MAX_CACHED_AUTH_FRAMES            8
35 
36 #define ROAM_SCAN_OFFLOAD_START                     1
37 #define ROAM_SCAN_OFFLOAD_STOP                      2
38 #define ROAM_SCAN_OFFLOAD_RESTART                   3
39 #define ROAM_SCAN_OFFLOAD_UPDATE_CFG                4
40 #define ROAM_SCAN_OFFLOAD_ABORT_SCAN                5
41 
42 #define REASON_CONNECT                              1
43 #define REASON_CHANNEL_LIST_CHANGED                 2
44 #define REASON_LOOKUP_THRESH_CHANGED                3
45 #define REASON_DISCONNECTED                         4
46 #define REASON_RSSI_DIFF_CHANGED                    5
47 #define REASON_ESE_INI_CFG_CHANGED                  6
48 #define REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED 7
49 #define REASON_VALID_CHANNEL_LIST_CHANGED           8
50 #define REASON_FLUSH_CHANNEL_LIST                   9
51 #define REASON_EMPTY_SCAN_REF_PERIOD_CHANGED        10
52 #define REASON_PREAUTH_FAILED_FOR_ALL               11
53 #define REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW     12
54 #define REASON_NPROBES_CHANGED                      13
55 #define REASON_HOME_AWAY_TIME_CHANGED               14
56 #define REASON_OS_REQUESTED_ROAMING_NOW             15
57 #define REASON_SCAN_CH_TIME_CHANGED                 16
58 #define REASON_SCAN_HOME_TIME_CHANGED               17
59 #define REASON_OPPORTUNISTIC_THRESH_DIFF_CHANGED    18
60 #define REASON_ROAM_RESCAN_RSSI_DIFF_CHANGED        19
61 #define REASON_ROAM_BMISS_FIRST_BCNT_CHANGED        20
62 #define REASON_ROAM_BMISS_FINAL_BCNT_CHANGED        21
63 #define REASON_ROAM_DFS_SCAN_MODE_CHANGED           23
64 #define REASON_ROAM_ABORT_ROAM_SCAN                 24
65 #define REASON_ROAM_EXT_SCAN_PARAMS_CHANGED         25
66 #define REASON_ROAM_SET_SSID_ALLOWED                26
67 #define REASON_ROAM_SET_FAVORED_BSSID               27
68 #define REASON_ROAM_GOOD_RSSI_CHANGED               28
69 #define REASON_ROAM_SET_DENYLIST_BSSID              29
70 #define REASON_ROAM_SCAN_HI_RSSI_MAXCOUNT_CHANGED   30
71 #define REASON_ROAM_SCAN_HI_RSSI_DELTA_CHANGED      31
72 #define REASON_ROAM_SCAN_HI_RSSI_DELAY_CHANGED      32
73 #define REASON_ROAM_SCAN_HI_RSSI_UB_CHANGED         33
74 #define REASON_CONNECT_IES_CHANGED                  34
75 #define REASON_ROAM_SCAN_STA_ROAM_POLICY_CHANGED    35
76 #define REASON_ROAM_SYNCH_FAILED                    36
77 #define REASON_ROAM_PSK_PMK_CHANGED                 37
78 #define REASON_ROAM_STOP_ALL                        38
79 #define REASON_SUPPLICANT_DISABLED_ROAMING          39
80 #define REASON_CTX_INIT                             40
81 #define REASON_FILS_PARAMS_CHANGED                  41
82 #define REASON_SME_ISSUED                           42
83 #define REASON_DRIVER_ENABLED                       43
84 #define REASON_ROAM_FULL_SCAN_PERIOD_CHANGED        44
85 #define REASON_SCORING_CRITERIA_CHANGED             45
86 #define REASON_SUPPLICANT_INIT_ROAMING              46
87 #define REASON_SUPPLICANT_DE_INIT_ROAMING           47
88 #define REASON_DRIVER_DISABLED                      48
89 #define REASON_ROAM_CONTROL_CONFIG_CHANGED          49
90 #define REASON_ROAM_CONTROL_CONFIG_ENABLED          50
91 #define REASON_ROAM_CANDIDATE_FOUND                 51
92 #define REASON_ROAM_HANDOFF_DONE                    52
93 #define REASON_ROAM_ABORT                           53
94 #define REASON_ROAM_SET_PRIMARY                     54
95 #define REASON_ROAM_LINK_SWITCH_ASSOC_VDEV_CHANGE   55
96 #define REASON_VDEV_RESTART_FROM_HOST               56
97 
98 #define FILS_MAX_KEYNAME_NAI_LENGTH WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH
99 #define WLAN_FILS_MAX_REALM_LEN WLAN_CM_FILS_MAX_REALM_LEN
100 #define WLAN_FILS_MAX_RRK_LENGTH WLAN_CM_FILS_MAX_RRK_LENGTH
101 
102 #define FILS_MAX_HLP_DATA_LEN 2048
103 
104 #define WLAN_FILS_MAX_RIK_LENGTH WLAN_FILS_MAX_RRK_LENGTH
105 #define WLAN_FILS_FT_MAX_LEN          48
106 
107 #define WLAN_MAX_PMK_DUMP_BYTES 2
108 #define DEFAULT_ROAM_SCAN_SCHEME_BITMAP 0
109 #define ROAM_MAX_CFG_VALUE 0xffffffff
110 
111 #define CFG_VALID_CHANNEL_LIST_LEN 100
112 #define MAX_SSID_ALLOWED_LIST    8
113 #define MAX_BSSID_AVOID_LIST     16
114 #define MAX_BSSID_FAVORED      16
115 #define WLAN_MAX_BTM_CANDIDATES      8
116 
117 /* Default value of WTC reason code */
118 #define DISABLE_VENDOR_BTM_CONFIG 2
119 
120 #ifdef WLAN_FEATURE_HOST_ROAM
121 #define MAX_FTIE_SIZE CM_MAX_FTIE_SIZE
122 #else
123 #define MAX_FTIE_SIZE 384
124 #endif
125 
126 #define ESE_MAX_TSPEC_IES 4
127 
128 /*
129  * To get 4 LSB of roam reason of roam_synch_data
130  * received from firmware
131  */
132 #define ROAM_REASON_MASK 0x0F
133 
134 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
135 #define ROAM_R0KH_ID_MAX_LEN  48
136 /* connected but not authenticated */
137 #define ROAM_AUTH_STATUS_CONNECTED      0x1
138 /* connected and authenticated */
139 #define ROAM_AUTH_STATUS_AUTHENTICATED  0x2
140 
141 #define IS_ROAM_REASON_STA_KICKOUT(reason) ((reason & 0xF) == \
142 	WMI_ROAM_TRIGGER_REASON_STA_KICKOUT)
143 #define IS_ROAM_REASON_DISCONNECTION(reason) ((reason & 0xF) == \
144 	WMI_ROAM_TRIGGER_REASON_DEAUTH)
145 #endif
146 
147 /*
148  * Neighbor Report Params Bitmask
149  */
150 #define NEIGHBOR_REPORT_PARAMS_TIME_OFFSET            0x01
151 #define NEIGHBOR_REPORT_PARAMS_LOW_RSSI_OFFSET        0x02
152 #define NEIGHBOR_REPORT_PARAMS_BMISS_COUNT_TRIGGER    0x04
153 #define NEIGHBOR_REPORT_PARAMS_PER_THRESHOLD_OFFSET   0x08
154 #define NEIGHBOR_REPORT_PARAMS_CACHE_TIMEOUT          0x10
155 #define NEIGHBOR_REPORT_PARAMS_MAX_REQ_CAP            0x20
156 #define NEIGHBOR_REPORT_PARAMS_ALL                    0x3F
157 
158 /*
159  * Neighbor report offload needs to send 0xFFFFFFFF if a particular
160  * parameter is disabled from the ini
161  */
162 #define NEIGHBOR_REPORT_PARAM_INVALID (0xFFFFFFFFU)
163 
164 /*
165  * Currently roam score delta value is sent for 2 triggers and min rssi
166  * values are sent for 3 triggers
167  */
168 #define NUM_OF_ROAM_TRIGGERS 2
169 #define IDLE_ROAM_TRIGGER 0
170 #define BTM_ROAM_TRIGGER  1
171 
172 #define NUM_OF_ROAM_MIN_RSSI 3
173 #define DEAUTH_MIN_RSSI 0
174 #define BMISS_MIN_RSSI  1
175 #define MIN_RSSI_2G_TO_5G_ROAM 2
176 #define CM_CFG_VALID_CHANNEL_LIST_LEN 100
177 
178 /**
179  * enum roam_trigger_sub_reason - Roam trigger sub reasons
180  * @ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER: Roam scan triggered due to
181  * periodic timer expiry
182  * @ROAM_TRIGGER_SUB_REASON_INACTIVITY_TIMER_LOW_RSSI: Roam scan triggered due
183  * to inactivity detection and connected AP RSSI falls below a certain threshold
184  * @ROAM_TRIGGER_SUB_REASON_BTM_DI_TIMER: Roam scan triggered due to BTM
185  * Disassoc Imminent timeout
186  * @ROAM_TRIGGER_SUB_REASON_FULL_SCAN: Roam scan triggered due to partial scan
187  * failure
188  * @ROAM_TRIGGER_SUB_REASON_LOW_RSSI_PERIODIC: Roam scan triggered due to Low
189  * rssi periodic timer
190  * @ROAM_TRIGGER_SUB_REASON_CU_PERIODIC: Roam scan triggered due to CU periodic
191  * timer
192  * @ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER_AFTER_INACTIVITY: Roam scan
193  * triggered due to periodic timer after device inactivity after low rssi
194  * trigger
195  * @ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER_AFTER_INACTIVITY_CU: Roam scan
196  * triggered due to first periodic timer exiry when full scan count is not 0
197  * and roam scan trigger is CU load
198  * @ROAM_TRIGGER_SUB_REASON_INACTIVITY_TIMER_CU: Roam scan triggered due to
199  * first periodic timer exiry when full scan count is 0 and roam scan trigger
200  * is CU load
201  */
202 enum roam_trigger_sub_reason {
203 	ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER = 1,
204 	ROAM_TRIGGER_SUB_REASON_INACTIVITY_TIMER_LOW_RSSI,
205 	ROAM_TRIGGER_SUB_REASON_BTM_DI_TIMER,
206 	ROAM_TRIGGER_SUB_REASON_FULL_SCAN,
207 	ROAM_TRIGGER_SUB_REASON_LOW_RSSI_PERIODIC,
208 	ROAM_TRIGGER_SUB_REASON_CU_PERIODIC,
209 	ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER_AFTER_INACTIVITY,
210 	ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER_AFTER_INACTIVITY_CU,
211 	ROAM_TRIGGER_SUB_REASON_INACTIVITY_TIMER_CU,
212 };
213 
214 /**
215  * enum roam_stats_scan_type  - Roam scan type defines
216  * @ROAM_STATS_SCAN_TYPE_PARTIAL: Partial scan
217  * @ROAM_STATS_SCAN_TYPE_FULL: Full scan
218  * @ROAM_STATS_SCAN_TYPE_NO_SCAN: No roam scan was triggered. This is generally
219  * used in BTM events to indicate BTM frame exchange logs.
220  * @ROAM_STATS_SCAN_TYPE_HIGHER_BAND_5GHZ_6GHZ: Higher band roam scan from 2 GHz
221  * to 5 GHz or 6 GHz
222  * @ROAM_STATS_SCAN_TYPE_HIGHER_BAND_6GHZ: Higher band roam scan from 5 GHz to
223  * 6 GHz
224  */
225 enum roam_stats_scan_type {
226 	ROAM_STATS_SCAN_TYPE_PARTIAL = 0,
227 	ROAM_STATS_SCAN_TYPE_FULL = 1,
228 	ROAM_STATS_SCAN_TYPE_NO_SCAN = 2,
229 	ROAM_STATS_SCAN_TYPE_HIGHER_BAND_5GHZ_6GHZ = 3,
230 	ROAM_STATS_SCAN_TYPE_HIGHER_BAND_6GHZ = 4,
231 };
232 
233 /**
234  * enum wlan_roam_frame_subtype - Roam frame subtypes
235  * @ROAM_FRAME_SUBTYPE_M1: EAPOL M1 Frame
236  * @ROAM_FRAME_SUBTYPE_M2: EAPOL M2 Frame
237  * @ROAM_FRAME_SUBTYPE_M3: EAPOL M3 Frame
238  * @ROAM_FRAME_SUBTYPE_M4: EAPOL M4 Frame
239  * @ROAM_FRAME_SUBTYPE_GTK_M1: GTK M1 Frame
240  * @ROAM_FRAME_SUBTYPE_GTK_M2: GTK M2 Frame
241  */
242 enum wlan_roam_frame_subtype {
243 	ROAM_FRAME_SUBTYPE_M1 = 1,
244 	ROAM_FRAME_SUBTYPE_M2,
245 	ROAM_FRAME_SUBTYPE_M3,
246 	ROAM_FRAME_SUBTYPE_M4,
247 	ROAM_FRAME_SUBTYPE_GTK_M1,
248 	ROAM_FRAME_SUBTYPE_GTK_M2,
249 };
250 
251 /**
252  * struct cm_roam_neighbor_report_offload_params - neighbor report offload
253  *                                                 parameters
254  * @offload_11k_enable_bitmask: neighbor report offload bitmask control
255  * @params_bitmask: bitmask to specify which of the below are enabled
256  * @time_offset: time offset after 11k offload command to trigger a neighbor
257  *              report request (in seconds)
258  * @low_rssi_offset: Offset from rssi threshold to trigger neighbor
259  *      report request (in dBm)
260  * @bmiss_count_trigger: Number of beacon miss events to trigger neighbor
261  *              report request
262  * @per_threshold_offset: offset from PER threshold to trigger neighbor
263  *              report request (in %)
264  * @neighbor_report_cache_timeout: timeout after which new trigger can enable
265  *              sending of a neighbor report request (in seconds)
266  * @max_neighbor_report_req_cap: max number of neighbor report requests that
267  *              can be sent to the peer in the current session
268  */
269 struct cm_roam_neighbor_report_offload_params {
270 	uint32_t offload_11k_enable_bitmask;
271 	uint8_t params_bitmask;
272 	uint32_t time_offset;
273 	uint32_t low_rssi_offset;
274 	uint32_t bmiss_count_trigger;
275 	uint32_t per_threshold_offset;
276 	uint32_t neighbor_report_cache_timeout;
277 	uint32_t max_neighbor_report_req_cap;
278 };
279 
280 /**
281  * struct rso_chan_info - chan info
282  * @num_chan: number of channels
283  * @freq_list: freq list
284  */
285 struct rso_chan_info {
286 	uint8_t num_chan;
287 	qdf_freq_t *freq_list;
288 };
289 
290 /**
291  * struct rso_cfg_params - per vdev rso cfg
292  * @neighbor_scan_period:
293  * @neighbor_scan_min_period:
294  * @specific_chan_info:
295  * @neighbor_lookup_threshold:
296  * @next_rssi_threshold: Next roam can trigger rssi threshold
297  * @rssi_thresh_offset_5g:
298  * @min_chan_scan_time:
299  * @max_chan_scan_time:
300  * @passive_max_chan_time:
301  * @neighbor_results_refresh_period:
302  * @empty_scan_refresh_period:
303  * @opportunistic_threshold_diff:
304  * @roam_rescan_rssi_diff:
305  * @roam_bmiss_first_bcn_cnt:
306  * @roam_bmiss_final_cnt:
307  * @hi_rssi_scan_max_count:
308  * @hi_rssi_scan_rssi_delta:
309  * @hi_rssi_scan_delay:
310  * @hi_rssi_scan_rssi_ub:
311  * @pref_chan_info:
312  * @full_roam_scan_period:
313  * @enable_scoring_for_roam:
314  * @roam_rssi_diff:
315  * @roam_rssi_diff_6ghz:
316  * @bg_rssi_threshold:
317  * @roam_scan_home_away_time:
318  * @roam_scan_n_probes:
319  * @roam_scan_inactivity_time:
320  * @roam_inactive_data_packet_count:
321  */
322 struct rso_cfg_params {
323 	uint32_t neighbor_scan_period;
324 	uint32_t neighbor_scan_min_period;
325 	struct rso_chan_info specific_chan_info;
326 	uint8_t neighbor_lookup_threshold;
327 	uint8_t next_rssi_threshold;
328 	int8_t rssi_thresh_offset_5g;
329 	uint32_t min_chan_scan_time;
330 	uint32_t max_chan_scan_time;
331 	uint32_t passive_max_chan_time;
332 	uint16_t neighbor_results_refresh_period;
333 	uint16_t empty_scan_refresh_period;
334 	uint8_t opportunistic_threshold_diff;
335 	uint8_t roam_rescan_rssi_diff;
336 	uint8_t roam_bmiss_first_bcn_cnt;
337 	uint8_t roam_bmiss_final_cnt;
338 	uint32_t hi_rssi_scan_max_count;
339 	uint32_t hi_rssi_scan_rssi_delta;
340 	uint32_t hi_rssi_scan_delay;
341 	int32_t hi_rssi_scan_rssi_ub;
342 	struct rso_chan_info pref_chan_info;
343 	uint32_t full_roam_scan_period;
344 	bool enable_scoring_for_roam;
345 	uint8_t roam_rssi_diff;
346 	uint8_t roam_rssi_diff_6ghz;
347 	uint8_t bg_rssi_threshold;
348 	uint16_t roam_scan_home_away_time;
349 	uint8_t roam_scan_n_probes;
350 	uint32_t roam_scan_inactivity_time;
351 	uint32_t roam_inactive_data_packet_count;
352 };
353 
354 /**
355  * struct wlan_chan_list - channel list
356  * @num_chan: number of channels
357  * @freq_list: freq list
358  */
359 struct wlan_chan_list {
360 	uint8_t num_chan;
361 	qdf_freq_t freq_list[CFG_VALID_CHANNEL_LIST_LEN];
362 };
363 
364 /**
365  * enum roam_fail_params: different types of params to set or get
366  * roam fail states for the vdev
367  * @ROAM_TRIGGER_REASON: Roam trigger reason(enum WMI_ROAM_TRIGGER_REASON_ID)
368  * @ROAM_INVOKE_FAIL_REASON: One of WMI_ROAM_FAIL_REASON_ID for roam failure
369  * in case of forced roam
370  * @ROAM_FAIL_REASON: One of WMI_ROAM_FAIL_REASON_ID for roam failure
371  */
372 enum roam_fail_params {
373 	ROAM_TRIGGER_REASON,
374 	ROAM_INVOKE_FAIL_REASON,
375 	ROAM_FAIL_REASON,
376 };
377 
378 /**
379  * enum wlan_roam_failure_reason_code - Roaming failure reason codes
380  * @ROAM_FAIL_REASON_NO_SCAN_START: Scan start failed
381  * @ROAM_FAIL_REASON_NO_AP_FOUND: No roamable AP found
382  * @ROAM_FAIL_REASON_NO_CAND_AP_FOUND: No candidate AP found
383  * @ROAM_FAIL_REASON_HOST: Host aborted roaming due to vdev stop from
384  * host
385  * @ROAM_FAIL_REASON_AUTH_SEND: Auth TX failure
386  * @ROAM_FAIL_REASON_NO_AUTH_RESP: No Authentication response received
387  * @ROAM_FAIL_REASON_AUTH_RECV: Authentication response received with
388  * error status code
389  * @ROAM_FAIL_REASON_REASSOC_SEND: Reassoc request TX failed
390  * @ROAM_FAIL_REASON_REASSOC_RECV: Reassoc response frame received with failure
391  * status
392  * @ROAM_FAIL_REASON_NO_REASSOC_RESP: No reassociation response received
393  * @ROAM_FAIL_REASON_EAPOL_TIMEOUT: EAPoL timedout
394  * @ROAM_FAIL_REASON_MLME: MLME internal error
395  * @ROAM_FAIL_REASON_INTERNAL_ABORT: Abort due to internal firmware error
396  * @ROAM_FAIL_REASON_SCAN_START: Not able to start roam scan
397  * @ROAM_FAIL_REASON_AUTH_NO_ACK: No ack received for Auth request frame
398  * @ROAM_FAIL_REASON_AUTH_INTERNAL_DROP: Auth request dropped internally
399  * @ROAM_FAIL_REASON_REASSOC_NO_ACK: No ack received for reassoc request frame
400  * @ROAM_FAIL_REASON_REASSOC_INTERNAL_DROP: Reassoc frame dropped internally
401  * at firmware
402  * @ROAM_FAIL_REASON_EAPOL_M2_SEND: EAPoL M2 send failed
403  * @ROAM_FAIL_REASON_EAPOL_M2_INTERNAL_DROP: EAPoL M2 frame dropped internally
404  * at firmware
405  * @ROAM_FAIL_REASON_EAPOL_M2_NO_ACK: No ack received for EAPoL M2 frame
406  * @ROAM_FAIL_REASON_EAPOL_M3_TIMEOUT: EAPoL M3 not received from AP
407  * @ROAM_FAIL_REASON_EAPOL_M4_SEND: EAPoL M4 frame TX failed
408  * @ROAM_FAIL_REASON_EAPOL_M4_INTERNAL_DROP: EAPoL M4 frame dropped internally
409  * @ROAM_FAIL_REASON_EAPOL_M4_NO_ACK: No ack received for EAPoL M4 frame
410  * @ROAM_FAIL_REASON_NO_SCAN_FOR_FINAL_BMISS: Roam scan start failed for final
411  * bmiss case
412  * @ROAM_FAIL_REASON_DISCONNECT: Deauth/Disassoc frame received from AP during
413  * roaming
414  * @ROAM_FAIL_REASON_SYNC: Roam failure due to host wake-up during roaming in
415  * progress
416  * @ROAM_FAIL_REASON_SAE_INVALID_PMKID: Invalid PMKID during SAE roaming
417  * @ROAM_FAIL_REASON_SAE_PREAUTH_TIMEOUT: SAE roaming preauthentication
418  * timedout
419  * @ROAM_FAIL_REASON_SAE_PREAUTH_FAIL: SAE preauthentication failure
420  * @ROAM_FAIL_REASON_UNABLE_TO_START_ROAM_HO: Start handoff failed
421  * @ROAM_FAIL_REASON_NO_AP_FOUND_AND_FINAL_BMISS_SENT: No AP found after
422  * final BMISS
423  * @ROAM_FAIL_REASON_NO_CAND_AP_FOUND_AND_FINAL_BMISS_SENT: No Candidate AP
424  * found after final BMISS.
425  * @ROAM_FAIL_REASON_CURR_AP_STILL_OK: Background scan was abort, but
426  * current network condition is fine.
427  * @ROAM_FAIL_REASON_SCAN_CANCEL: Roam fail reason, scan cancelled
428  * @ROAM_FAIL_REASON_SCREEN_ACTIVITY: Roam fail reason screen activity happened
429  * @ROAM_FAIL_REASON_OTHER_PRIORITY_ROAM_SCAN: Roam fail due to other priority
430  * roam scan started.
431  * @ROAM_FAIL_REASON_UNKNOWN: Default reason
432  */
433 enum wlan_roam_failure_reason_code {
434 	ROAM_FAIL_REASON_NO_SCAN_START = 1,
435 	ROAM_FAIL_REASON_NO_AP_FOUND,
436 	ROAM_FAIL_REASON_NO_CAND_AP_FOUND,
437 
438 	/* Failure reasons after roam scan is complete */
439 	ROAM_FAIL_REASON_HOST,
440 	ROAM_FAIL_REASON_AUTH_SEND,
441 	ROAM_FAIL_REASON_AUTH_RECV,
442 	ROAM_FAIL_REASON_NO_AUTH_RESP,
443 	ROAM_FAIL_REASON_REASSOC_SEND,
444 	ROAM_FAIL_REASON_REASSOC_RECV,
445 	ROAM_FAIL_REASON_NO_REASSOC_RESP,
446 	ROAM_FAIL_REASON_EAPOL_TIMEOUT,
447 	ROAM_FAIL_REASON_MLME,
448 	ROAM_FAIL_REASON_INTERNAL_ABORT,
449 	ROAM_FAIL_REASON_SCAN_START,
450 	ROAM_FAIL_REASON_AUTH_NO_ACK,
451 	ROAM_FAIL_REASON_AUTH_INTERNAL_DROP,
452 	ROAM_FAIL_REASON_REASSOC_NO_ACK,
453 	ROAM_FAIL_REASON_REASSOC_INTERNAL_DROP,
454 	ROAM_FAIL_REASON_EAPOL_M2_SEND,
455 	ROAM_FAIL_REASON_EAPOL_M2_INTERNAL_DROP,
456 	ROAM_FAIL_REASON_EAPOL_M2_NO_ACK,
457 	ROAM_FAIL_REASON_EAPOL_M3_TIMEOUT,
458 	ROAM_FAIL_REASON_EAPOL_M4_SEND,
459 	ROAM_FAIL_REASON_EAPOL_M4_INTERNAL_DROP,
460 	ROAM_FAIL_REASON_EAPOL_M4_NO_ACK,
461 	ROAM_FAIL_REASON_NO_SCAN_FOR_FINAL_BMISS,
462 	ROAM_FAIL_REASON_DISCONNECT,
463 	ROAM_FAIL_REASON_SYNC,
464 	ROAM_FAIL_REASON_SAE_INVALID_PMKID,
465 	ROAM_FAIL_REASON_SAE_PREAUTH_TIMEOUT,
466 	ROAM_FAIL_REASON_SAE_PREAUTH_FAIL,
467 	ROAM_FAIL_REASON_UNABLE_TO_START_ROAM_HO,
468 	ROAM_FAIL_REASON_NO_AP_FOUND_AND_FINAL_BMISS_SENT,
469 	ROAM_FAIL_REASON_NO_CAND_AP_FOUND_AND_FINAL_BMISS_SENT,
470 	ROAM_FAIL_REASON_CURR_AP_STILL_OK,
471 	ROAM_FAIL_REASON_SCAN_CANCEL,
472 	ROAM_FAIL_REASON_SCREEN_ACTIVITY,
473 	ROAM_FAIL_REASON_OTHER_PRIORITY_ROAM_SCAN,
474 	ROAM_FAIL_REASON_UNKNOWN = 255,
475 };
476 
477 #ifdef WLAN_FEATURE_HOST_ROAM
478 /**
479  * struct reassoc_timer_ctx - reassoc timer context
480  * @pdev: pdev object pointer
481  * @vdev_id: vdev id
482  * @cm_id: cm id to find cm_roam_req
483  */
484 struct reassoc_timer_ctx {
485 	struct wlan_objmgr_pdev *pdev;
486 	uint8_t vdev_id;
487 	wlan_cm_id cm_id;
488 };
489 #endif
490 
491 /**
492  * struct roam_synch_frame_ind  - Structure to hold the information on frames
493  * received during roam synch frame indication.
494  * @bcn_probe_rsp_len: Length of the beacon/probe response frame
495  * @bcn_probe_rsp: Beacon probe response frame pointer
496  * @is_beacon: Flag to indicate if received frame is beacon or probe response
497  * @link_bcn_probe_rsp_len: Length of the link beacon/probe response frame
498  * @link_bcn_probe_rsp: Link beacon probe response frame pointer
499  * @is_link_beacon: Flag to indicate if received frame is link beacon or probe
500  * response
501  * @reassoc_req_len: Reassoc request frame length
502  * @reassoc_req: Reassoc request frame pointer
503  * @reassoc_rsp_len: Reassoc response frame length
504  * @reassoc_rsp: Reassoc response frame pointer
505  * @vdev_id: Vdev id
506  * @rssi: RSSI of the frame
507  */
508 struct roam_synch_frame_ind {
509 	uint32_t bcn_probe_rsp_len;
510 	uint8_t *bcn_probe_rsp;
511 	uint8_t is_beacon;
512 	uint32_t link_bcn_probe_rsp_len;
513 	uint8_t *link_bcn_probe_rsp;
514 	uint8_t is_link_beacon;
515 	uint32_t reassoc_req_len;
516 	uint8_t *reassoc_req;
517 	uint32_t reassoc_rsp_len;
518 	uint8_t *reassoc_rsp;
519 	uint8_t vdev_id;
520 	int8_t rssi;
521 };
522 
523 /**
524  * struct owe_transition_mode_info - structure containing owe transition mode
525  * element info
526  * @is_owe_transition_conn: Current connection is in owe transition mode or not
527  * @ssid: ssid
528  */
529 struct owe_transition_mode_info {
530 	bool is_owe_transition_conn;
531 	struct wlan_ssid  ssid;
532 };
533 
534 /**
535  * struct sae_roam_auth_map - map the peer address for the sae raom
536  * @is_mlo_ap: to check ap (to which roam) is mlo capable.
537  * @peer_mldaddr: peer MLD address
538  * @peer_linkaddr: peer link address
539  */
540 struct sae_roam_auth_map {
541 	bool is_mlo_ap;
542 	struct qdf_mac_addr peer_mldaddr;
543 	struct qdf_mac_addr peer_linkaddr;
544 };
545 
546 /**
547  * struct rso_config - connect config to be used to send info in
548  * RSO. This is the info we dont have in VDEV or CM ctx
549  * @reassoc_timer: reassoc timer
550  * @ctx: reassoc timer context
551  * @cm_rso_lock: RSO lock
552  * @orig_sec_info: original security info coming from the connect req from
553  * supplicant, without intersection of the peer capability
554  * @country_code: country code from connected AP's beacon IE
555  * @disable_hi_rssi: disable high rssi
556  * @roam_control_enable: Flag used to cache the status of roam control
557  *			 configuration. This will be set only if the
558  *			 corresponding vendor command data is configured to
559  *			 driver/firmware successfully. The same shall be
560  *			 returned to userspace whenever queried for roam
561  *			 control config status.
562  * @rescan_rssi_delta: Roam scan rssi delta. Start new rssi triggered scan only
563  * if it changes by rescan_rssi_delta value.
564  * @beacon_rssi_weight: Number of beacons to be used to calculate the average
565  * rssi of the AP.
566  * @hi_rssi_scan_delay: Roam scan delay in ms for High RSSI roam trigger.
567  * @roam_scan_scheme_bitmap: Bitmap of roam triggers for which partial channel
568  * map scan scheme needs to be enabled. Each bit in the bitmap corresponds to
569  * the bit position in the order provided by the enum roam_trigger_reason
570  * Ex: roam_scan_scheme_bitmap - 0x00110 will enable partial scan for below
571  * triggers:
572  * ROAM_TRIGGER_REASON_PER, ROAM_TRIGGER_REASON_BMISS
573  * @cfg_param: per vdev config params
574  * @assoc_ie: assoc IE
575  * @prev_ap_bcn_ie: last connected AP ie
576  * @occupied_chan_lst: occupied channel list
577  * @roam_candidate_count: candidate count
578  * @uapsd_mask: UAPSD mask
579  * @is_ese_assoc: is ese assoc
580  * @krk: krk data
581  * @btk: btk data
582  * @psk_pmk: pmk
583  * @pmk_len: length of pmk
584  * @owe_info: owe ap profile info
585  * @mdid: mdid info
586  * @is_11r_assoc: is 11r assoc
587  * @is_adaptive_11r_connection: is adaptive 11r connection
588  * @hs_20_ap: Hotspot 2.0 AP
589  * @mbo_oce_enabled_ap: MBO/OCE enabled network
590  * @is_single_pmk: is single pmk
591  * @roam_scan_freq_lst: roam freq list
592  * @roam_fail_reason: One of WMI_ROAM_FAIL_REASON_ID
593  * @roam_trigger_reason: Roam trigger reason(enum WMI_ROAM_TRIGGER_REASON_ID)
594  * @roam_invoke_fail_reason: One of reason id from enum
595  * wmi_roam_invoke_status_error in case of forced roam
596  * @lost_link_rssi: lost link RSSI
597  * @roam_sync_frame_ind: roam sync frame ind
598  * @roam_band_bitmask: This allows the driver to roam within this band
599  * @sae_roam_auth: structure containing roam peer mld and link address.
600  * @roam_invoke_source: roam invoke source
601  * @roam_invoke_bssid: mac address used for roam invoke
602  * @is_forced_roaming: bool value indicating if its forced roaming
603  * @tried_candidate_freq_list: freq list on which connection tried
604  * @rso_rsn_caps: rsn caps with global user MFP which can be used for
605  *                cross-AKM roaming
606  * @is_disable_btm: btm roaming disabled or not from userspace
607  */
608 struct rso_config {
609 #ifdef WLAN_FEATURE_HOST_ROAM
610 	qdf_mc_timer_t reassoc_timer;
611 	struct reassoc_timer_ctx ctx;
612 #endif
613 	qdf_mutex_t cm_rso_lock;
614 	struct security_info orig_sec_info;
615 	uint8_t country_code[REG_ALPHA2_LEN + 1];
616 	bool disable_hi_rssi;
617 	bool roam_control_enable;
618 	uint8_t rescan_rssi_delta;
619 	uint8_t beacon_rssi_weight;
620 	uint32_t hi_rssi_scan_delay;
621 	uint32_t roam_scan_scheme_bitmap;
622 	struct rso_cfg_params cfg_param;
623 	struct element_info assoc_ie;
624 	struct element_info prev_ap_bcn_ie;
625 	struct wlan_chan_list occupied_chan_lst;
626 	int8_t roam_candidate_count;
627 	uint8_t uapsd_mask;
628 #ifdef FEATURE_WLAN_ESE
629 	bool is_ese_assoc;
630 	uint8_t krk[WMI_KRK_KEY_LEN];
631 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
632 	uint8_t btk[WMI_BTK_KEY_LEN];
633 #endif
634 #endif
635 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
636 	uint8_t psk_pmk[MAX_PMK_LEN];
637 	uint8_t pmk_len;
638 #endif
639 	struct owe_transition_mode_info owe_info;
640 	struct mobility_domain_info mdid;
641 	bool is_11r_assoc;
642 	bool is_adaptive_11r_connection;
643 	bool hs_20_ap;
644 	bool is_single_pmk;
645 	uint32_t mbo_oce_enabled_ap;
646 	struct rso_chan_info roam_scan_freq_lst;
647 	uint32_t roam_fail_reason;
648 	uint32_t roam_trigger_reason;
649 	uint32_t roam_invoke_fail_reason;
650 	int32_t lost_link_rssi;
651 	struct roam_synch_frame_ind roam_sync_frame_ind;
652 	uint32_t roam_band_bitmask;
653 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_FEATURE_ROAM_OFFLOAD)
654 	struct sae_roam_auth_map sae_roam_auth;
655 #endif
656 	enum wlan_cm_source roam_invoke_source;
657 	struct qdf_mac_addr roam_invoke_bssid;
658 	bool is_forced_roaming;
659 	struct wlan_chan_list tried_candidate_freq_list;
660 	uint16_t rso_rsn_caps;
661 	bool is_disable_btm;
662 };
663 
664 /**
665  * struct rso_user_config - userspace configured RSO related
666  * configs.
667  * @num_ssid_allowed_list: The number of SSID profiles that are
668  * in the allowlist. When roaming, we consider the BSSID's with
669  * this SSID also for roaming apart from the connected ones
670  * @ssid_allowed_list: Allowlist SSIDs
671  */
672 struct rso_user_config {
673 	uint8_t num_ssid_allowed_list;
674 	struct wlan_ssid ssid_allowed_list[MAX_SSID_ALLOWED_LIST];
675 };
676 
677 /**
678  * enum sta_roam_policy_dfs_mode - state of DFS mode for STA ROME policy
679  * @STA_ROAM_POLICY_NONE: DFS mode attribute is not valid
680  * @STA_ROAM_POLICY_DFS_ENABLED:  DFS mode is enabled
681  * @STA_ROAM_POLICY_DFS_DISABLED: DFS mode is disabled
682  * @STA_ROAM_POLICY_DFS_DEPRIORITIZE: Deprioritize DFS channels in scanning
683  */
684 enum sta_roam_policy_dfs_mode {
685 	STA_ROAM_POLICY_NONE,
686 	STA_ROAM_POLICY_DFS_ENABLED,
687 	STA_ROAM_POLICY_DFS_DISABLED,
688 	STA_ROAM_POLICY_DFS_DEPRIORITIZE
689 };
690 
691 /**
692  * struct rso_roam_policy_params - sta roam policy params for station
693  * @dfs_mode: tell is DFS channels needs to be skipped while scanning
694  * @skip_unsafe_channels: tells if unsafe channels needs to be skip in scanning
695  * @sap_operating_band: Operating band for SAP
696  */
697 struct rso_roam_policy_params {
698 	enum sta_roam_policy_dfs_mode dfs_mode;
699 	bool skip_unsafe_channels;
700 	uint8_t sap_operating_band;
701 };
702 
703 #define DEFAULT_RSSI_DB_GAP     30  /* every 30 dbm for one category */
704 #define ENABLE_FT_OVER_DS      1   /* enable ft_over_ds */
705 
706 /**
707  * struct rso_config_params - global RSO params
708  * @num_bssid_favored: Number of BSSID's which have a preference over others
709  * @bssid_favored: Favorable BSSID's
710  * @bssid_favored_factor: RSSI to be added to this BSSID to prefer it
711  * @good_rssi_roam: Lazy Roam
712  * @alert_rssi_threshold: Alert RSSI
713  * @rssi_diff: rssi diff
714  * @raise_rssi_thresh_5g: The RSSI threshold below which the
715  *                        raise_factor_5g (boost factor) should be applied.
716  * @drop_rssi_thresh_5g: The RSSI threshold beyond which the
717  *                       drop_factor_5g (penalty factor) should be applied
718  * @raise_factor_5g: Boost factor
719  * @drop_factor_5g: Penalty factor
720  * @max_raise_rssi_5g: Maximum amount of Boost that can added
721  * @cat_rssi_offset:
722  * @is_fils_roaming_supported: fils roaming supported
723  * @policy_params: roam policy params
724  * @neighbor_report_offload: neighbor report offload params
725  */
726 struct rso_config_params {
727 	uint8_t num_bssid_favored;
728 	struct qdf_mac_addr bssid_favored[MAX_BSSID_FAVORED];
729 	uint8_t bssid_favored_factor[MAX_BSSID_FAVORED];
730 	int good_rssi_roam;
731 	int alert_rssi_threshold;
732 	int rssi_diff;
733 	int raise_rssi_thresh_5g;
734 	int drop_rssi_thresh_5g;
735 	uint8_t raise_factor_5g;
736 	uint8_t drop_factor_5g;
737 	int max_raise_rssi_5g;
738 	uint8_t cat_rssi_offset;
739 	bool is_fils_roaming_supported;
740 	struct rso_roam_policy_params policy_params;
741 	struct cm_roam_neighbor_report_offload_params neighbor_report_offload;
742 };
743 
744 /**
745  * enum roam_cfg_param  - Type values for roaming parameters used as index
746  * for get/set of roaming config values(pNeighborRoamInfo in legacy)
747  * @RSSI_CHANGE_THRESHOLD: Rssi change threshold
748  * @BEACON_RSSI_WEIGHT: Beacon Rssi weight parameter
749  * @HI_RSSI_DELAY_BTW_SCANS: High Rssi delay between scans
750  * @EMPTY_SCAN_REFRESH_PERIOD: empty scan refresh period
751  * @FULL_ROAM_SCAN_PERIOD: Full roam scan period
752  * @ENABLE_SCORING_FOR_ROAM: enable scoring
753  * @SCAN_MIN_CHAN_TIME: scan min chan time
754  * @SCAN_MAX_CHAN_TIME: scan max chan time
755  * @NEIGHBOR_SCAN_PERIOD: neighbour scan period
756  * @ROAM_CONFIG_ENABLE: Roam config enable
757  * @ROAM_PREFERRED_CHAN: preferred channel list
758  * @ROAM_SPECIFIC_CHAN: specific channel list
759  * @ROAM_RSSI_DIFF: rssi diff
760  * @NEIGHBOUR_LOOKUP_THRESHOLD: lookup threshold
761  * @NEXT_RSSI_THRESHOLD: Next roam can trigger rssi threshold
762  * @SCAN_N_PROBE: scan n probe
763  * @SCAN_HOME_AWAY: scan and away
764  * @NEIGHBOUR_SCAN_REFRESH_PERIOD: scan refresh
765  * @ROAM_CONTROL_ENABLE: roam control enable
766  * @UAPSD_MASK: uapsd mask
767  * @MOBILITY_DOMAIN: mobility domain
768  * @IS_11R_CONNECTION: is 11r connection
769  * @ADAPTIVE_11R_CONNECTION: adaptive 11r
770  * @HS_20_AP: Hotspot 2.0 AP
771  * @MBO_OCE_ENABLED_AP: MBO/OCE enabled network
772  * @IS_SINGLE_PMK:
773  * @LOST_LINK_RSSI: lost link RSSI
774  * @ROAM_BAND: Allowed band for roaming in FW
775  * @HI_RSSI_SCAN_RSSI_DELTA:
776  * @ROAM_RSSI_DIFF_6GHZ: roam rssi diff for 6 GHz AP
777  * @IS_DISABLE_BTM: disable btm roaming
778  */
779 enum roam_cfg_param {
780 	RSSI_CHANGE_THRESHOLD,
781 	BEACON_RSSI_WEIGHT,
782 	HI_RSSI_DELAY_BTW_SCANS,
783 	EMPTY_SCAN_REFRESH_PERIOD,
784 	FULL_ROAM_SCAN_PERIOD,
785 	ENABLE_SCORING_FOR_ROAM,
786 	SCAN_MIN_CHAN_TIME,
787 	SCAN_MAX_CHAN_TIME,
788 	NEIGHBOR_SCAN_PERIOD,
789 	ROAM_CONFIG_ENABLE,
790 	ROAM_PREFERRED_CHAN,
791 	ROAM_SPECIFIC_CHAN,
792 	ROAM_RSSI_DIFF,
793 	NEIGHBOUR_LOOKUP_THRESHOLD,
794 	NEXT_RSSI_THRESHOLD,
795 	SCAN_N_PROBE,
796 	SCAN_HOME_AWAY,
797 	NEIGHBOUR_SCAN_REFRESH_PERIOD,
798 	ROAM_CONTROL_ENABLE,
799 	UAPSD_MASK,
800 	MOBILITY_DOMAIN,
801 	IS_11R_CONNECTION,
802 	ADAPTIVE_11R_CONNECTION,
803 	HS_20_AP,
804 	MBO_OCE_ENABLED_AP,
805 	IS_SINGLE_PMK,
806 	LOST_LINK_RSSI,
807 	ROAM_BAND,
808 	HI_RSSI_SCAN_RSSI_DELTA,
809 	ROAM_RSSI_DIFF_6GHZ,
810 	IS_DISABLE_BTM,
811 };
812 
813 /**
814  * enum roam_offload_init_flags  - Flags sent in Roam offload initialization.
815  * @WLAN_ROAM_FW_OFFLOAD_ENABLE: Init roaming module at firmware
816  * @WLAN_ROAM_BMISS_FINAL_SCAN_ENABLE: Enable partial scan after final beacon
817  * miss event at firmware
818  * @WLAN_ROAM_SKIP_EAPOL_4WAY_HANDSHAKE: Disable 4 Way-HS offload to firmware
819  * Setting this flag will make the eapol packets reach to host every time
820  * and can cause frequent APPS wake-ups. And clearing this flag will make
821  * eapol offload to firmware except for SAE and OWE roam.
822  * @WLAN_ROAM_BMISS_FINAL_SCAN_TYPE: Set this flag to skip full scan on final
823  * bmiss and use the channel map to do the partial scan alone
824  * @WLAN_ROAM_SKIP_SAE_ROAM_4WAY_HANDSHAKE: Disable 4 Way-HS offload to firmware
825  * Setting this flag will make the eapol packets reach to host and clearing this
826  * flag will make eapol offload to firmware including for SAE roam.
827  */
828 enum roam_offload_init_flags {
829 	WLAN_ROAM_FW_OFFLOAD_ENABLE = BIT(1),
830 	WLAN_ROAM_BMISS_FINAL_SCAN_ENABLE = BIT(2),
831 	WLAN_ROAM_SKIP_EAPOL_4WAY_HANDSHAKE = BIT(3),
832 	WLAN_ROAM_BMISS_FINAL_SCAN_TYPE = BIT(4),
833 	WLAN_ROAM_SKIP_SAE_ROAM_4WAY_HANDSHAKE = BIT(5)
834 };
835 
836 /**
837  * struct wlan_roam_offload_init_params - Firmware roam module initialization
838  * parameters. Used to fill
839  * @vdev_id: vdev for which the roaming has to be enabled/disabled
840  * @roam_offload_flag:  flag to init/deinit roam module
841  */
842 struct wlan_roam_offload_init_params {
843 	uint8_t vdev_id;
844 	uint32_t roam_offload_flag;
845 };
846 
847 /**
848  * struct wlan_cm_roam_vendor_btm_params - vendor config roam control param
849  * @scan_freq_scheme: scan frequency scheme from enum
850  * qca_roam_scan_freq_scheme
851  * @connected_rssi_threshold: RSSI threshold of the current
852  * connected AP
853  * @candidate_rssi_threshold_2g: RSSI threshold of the
854  * candidate AP in 2.4Ghz band
855  * @candidate_rssi_threshold_5g: RSSI threshold of the candidate AP in 5Ghz
856  * band
857  * @candidate_rssi_threshold_6g: RSSI threshold of the candidate AP in 6Ghz
858  * band
859  * @user_roam_reason: Roam triggered reason code, value zero is for enable
860  * and non zero value is disable
861  */
862 struct wlan_cm_roam_vendor_btm_params {
863 	uint32_t scan_freq_scheme;
864 	uint32_t connected_rssi_threshold;
865 	uint32_t candidate_rssi_threshold_2g;
866 	uint32_t candidate_rssi_threshold_5g;
867 	uint32_t candidate_rssi_threshold_6g;
868 	uint32_t user_roam_reason;
869 };
870 
871 /**
872  * struct ap_profile - Structure ap profile to match candidate
873  * @flags: flags
874  * @rssi_threshold: the value of the the candidate AP should higher by this
875  *                  threshold than the rssi of the currently associated AP
876  * @ssid: ssid value to be matched
877  * @rsn_authmode: security params to be matched
878  * @rsn_ucastcipherset: unicast cipher set
879  * @rsn_mcastcipherset: mcast/group cipher set
880  * @rsn_mcastmgmtcipherset: mcast/group management frames cipher set
881  * @rssi_abs_thresh: the value of the candidate AP should higher than this
882  *                   absolute RSSI threshold. Zero means no absolute minimum
883  *                   RSSI is required. units are the offset from the noise
884  *                   floor in dB
885  * @bg_rssi_threshold: Value of rssi threshold to trigger roaming
886  *                     after background scan.
887  * @num_allowed_authmode: Number of allowerd authmode
888  * @allowed_authmode: List of allowed authmode other than connected
889  */
890 struct ap_profile {
891 	uint32_t flags;
892 	uint32_t rssi_threshold;
893 	struct wlan_ssid  ssid;
894 	uint32_t rsn_authmode;
895 	uint32_t rsn_ucastcipherset;
896 	uint32_t rsn_mcastcipherset;
897 	uint32_t rsn_mcastmgmtcipherset;
898 	uint32_t rssi_abs_thresh;
899 	uint8_t bg_rssi_threshold;
900 	uint32_t num_allowed_authmode;
901 	uint32_t allowed_authmode[WLAN_CRYPTO_AUTH_MAX];
902 };
903 
904 /**
905  * struct scoring_param - scoring param to sortlist selected AP
906  * @disable_bitmap: Each bit will be either allow(0)/disallow(1) to
907  *                 considered the roam score param.
908  * @rssi_weightage: RSSI weightage out of total score in %
909  * @ht_weightage: HT weightage out of total score in %.
910  * @vht_weightage: VHT weightage out of total score in %.
911  * @he_weightage: 11ax weightage out of total score in %.
912  * @bw_weightage: Bandwidth weightage out of total score in %.
913  * @band_weightage: Band(2G/5G) weightage out of total score in %.
914  * @nss_weightage: NSS(1x1 / 2x2)weightage out of total score in %.
915  * @esp_qbss_weightage: ESP/QBSS weightage out of total score in %.
916  * @beamforming_weightage: Beamforming weightage out of total score in %.
917  * @pcl_weightage: PCL weightage out of total score in %.
918  * @oce_wan_weightage: OCE WAN metrics weightage out of total score in %.
919  * @oce_ap_tx_pwr_weightage: OCE AP TX power score in %
920  * @oce_subnet_id_weightage: OCE subnet id score in %
921  * @sae_pk_ap_weightage: SAE-PK AP score in %
922  * @bw_index_score: channel BW scoring percentage information.
923  *                 BITS 0-7   :- It contains scoring percentage of 20MHz   BW
924  *                 BITS 8-15  :- It contains scoring percentage of 40MHz   BW
925  *                 BITS 16-23 :- It contains scoring percentage of 80MHz   BW
926  *                 BITS 24-31 :- It contains scoring percentage of 1600MHz BW
927  *                 The value of each index must be 0-100
928  * @band_index_score: band scording percentage information.
929  *                   BITS 0-7   :- It contains scoring percentage of 2G
930  *                   BITS 8-15  :- It contains scoring percentage of 5G
931  *                   BITS 16-23 :- reserved
932  *                   BITS 24-31 :- reserved
933  *                   The value of each index must be 0-100
934  * @nss_index_score: NSS scoring percentage information.
935  *                  BITS 0-7   :- It contains scoring percentage of 1x1
936  *                  BITS 8-15  :- It contains scoring percentage of 2x2
937  *                  BITS 16-23 :- It contains scoring percentage of 3x3
938  *                  BITS 24-31 :- It contains scoring percentage of 4x4
939  *                  The value of each index must be 0-100
940  * @roam_score_delta: delta value expected over the roam score of the candidate
941  * ap over the roam score of the current ap
942  * @roam_trigger_bitmap: bitmap of roam triggers on which roam_score_delta
943  * will be applied
944  * @vendor_roam_score_algorithm: Preferred algorithm for roam candidate
945  * selection
946  * @cand_min_roam_score_delta: candidate min roam score delta value
947  * @rssi_scoring: RSSI scoring information.
948  * @esp_qbss_scoring: ESP/QBSS scoring percentage information
949  * @oce_wan_scoring: OCE WAN metrics percentage information
950  * @eht_caps_weightage: EHT caps weightage out of total score in %
951  * @mlo_weightage: MLO weightage out of total score in %
952  * @security_weightage: Security(WPA/WPA2/WPA3) weightage out of
953  * total score in %
954  * @security_index_score: Security scoring percentage information.
955  *                BITS 0-7 :- It contains scoring percentage of WPA security
956  *                BITS 8-15  :- It contains scoring percentage of WPA2 security
957  *                BITS 16-23 :- It contains scoring percentage of WPA3 security
958  *                BITS 24-31 :- reserved
959  *                The value of each index must be 0-100
960  */
961 struct scoring_param {
962 	uint32_t disable_bitmap;
963 	int32_t rssi_weightage;
964 	int32_t ht_weightage;
965 	int32_t vht_weightage;
966 	int32_t he_weightage;
967 	int32_t bw_weightage;
968 	int32_t band_weightage;
969 	int32_t nss_weightage;
970 	int32_t esp_qbss_weightage;
971 	int32_t beamforming_weightage;
972 	int32_t pcl_weightage;
973 	int32_t oce_wan_weightage;
974 	uint32_t oce_ap_tx_pwr_weightage;
975 	uint32_t oce_subnet_id_weightage;
976 	uint32_t sae_pk_ap_weightage;
977 	uint32_t bw_index_score;
978 	uint32_t band_index_score;
979 	uint32_t nss_index_score;
980 	uint32_t roam_score_delta;
981 	uint32_t roam_trigger_bitmap;
982 	uint32_t vendor_roam_score_algorithm;
983 	uint32_t cand_min_roam_score_delta;
984 	struct rssi_config_score rssi_scoring;
985 	struct per_slot_score esp_qbss_scoring;
986 	struct per_slot_score oce_wan_scoring;
987 #ifdef WLAN_FEATURE_11BE_MLO
988 	uint8_t eht_caps_weightage;
989 	uint8_t mlo_weightage;
990 #endif
991 	int32_t security_weightage;
992 	uint32_t security_index_score;
993 };
994 
995 /**
996  * enum roam_invoke_reason - Roam invoke reason.
997  *
998  * @WLAN_ROAM_STATS_INVOKE_REASON_UNDEFINED: Default value when target
999  *  invoke roam.
1000  * @WLAN_ROAM_STATS_INVOKE_REASON_NUD_FAILURE: Neighbor unreachable
1001  *  detection failed when the roam trigger.
1002  * @WLAN_ROAM_STATS_INVOKE_REASON_USER_SPACE: Invoke from user space.
1003  */
1004 enum roam_invoke_reason {
1005 	WLAN_ROAM_STATS_INVOKE_REASON_UNDEFINED = 0,
1006 	WLAN_ROAM_STATS_INVOKE_REASON_NUD_FAILURE = 1,
1007 	WLAN_ROAM_STATS_INVOKE_REASON_USER_SPACE = 2,
1008 };
1009 
1010 /**
1011  * enum roam_tx_failures_reason - Roam TX failures reason.
1012  *
1013  * @WLAN_ROAM_STATS_KICKOUT_REASON_UNSPECIFIED: Default value when
1014  *  roam by kickout.
1015  * @WLAN_ROAM_STATS_KICKOUT_REASON_XRETRY: Excessive retry when roam
1016  *  trigger by kickout.
1017  * @WLAN_ROAM_STATS_KICKOUT_REASON_INACTIVITY: Station inactivity when
1018  *  roam trigger by kickout.
1019  * @WLAN_ROAM_STATS_KICKOUT_REASON_IBSS_DISCONNECT: IBSS disconnect when
1020  *  roam trigger by kickout.
1021  * @WLAN_ROAM_STATS_KICKOUT_REASON_TDLS_DISCONNECT: TDLS peer has
1022  *  disappeared, and all TX is failing when roam trigger by kickout.
1023  * @WLAN_ROAM_STATS_KICKOUT_REASON_SA_QUERY_TIMEOUT: SA query process
1024  *   timeout when roam trigger by kickout.
1025  * @WLAN_ROAM_STATS_KICKOUT_REASON_ROAMING_EVENT: Directly connected
1026  *  peer has roamed to a repeater.
1027  */
1028 enum roam_tx_failures_reason {
1029 	WLAN_ROAM_STATS_KICKOUT_REASON_UNSPECIFIED = 0,
1030 	WLAN_ROAM_STATS_KICKOUT_REASON_XRETRY = 1,
1031 	WLAN_ROAM_STATS_KICKOUT_REASON_INACTIVITY = 2,
1032 	WLAN_ROAM_STATS_KICKOUT_REASON_IBSS_DISCONNECT = 3,
1033 	WLAN_ROAM_STATS_KICKOUT_REASON_TDLS_DISCONNECT = 4,
1034 	WLAN_ROAM_STATS_KICKOUT_REASON_SA_QUERY_TIMEOUT = 5,
1035 	WLAN_ROAM_STATS_KICKOUT_REASON_ROAMING_EVENT = 6,
1036 };
1037 
1038 /**
1039  * enum roam_abort_reason - Roam abort reason.
1040  *
1041  * @WLAN_ROAM_STATS_ABORT_UNSPECIFIED: Target did not specify the
1042  *  detailed reason for roam scan being aborted.
1043  * @WLAN_ROAM_STATS_ABORT_LOWRSSI_DATA_RSSI_HIGH: Roam scan is not
1044  *  started due to high data RSSI during LOW-RSSI roaming.
1045  * @WLAN_ROAM_STATS_ABORT_LOWRSSI_LINK_SPEED_GOOD: Roam scan is not
1046  *  started due to good link speed during LOW-RSSI roaming.
1047  * @WLAN_ROAM_STATS_ABORT_BG_DATA_RSSI_HIGH: Roam scan is not started
1048  *  due to high data RSSI during background roaming.
1049  * @WLAN_ROAM_STATS_ABORT_BG_RSSI_ABOVE_THRESHOLD: Roam scan is not
1050  *  started due to high beacon RSSI during background roaming
1051  */
1052 enum roam_abort_reason {
1053 	WLAN_ROAM_STATS_ABORT_UNSPECIFIED = 0,
1054 	WLAN_ROAM_STATS_ABORT_LOWRSSI_DATA_RSSI_HIGH = 1,
1055 	WLAN_ROAM_STATS_ABORT_LOWRSSI_LINK_SPEED_GOOD = 2,
1056 	WLAN_ROAM_STATS_ABORT_BG_DATA_RSSI_HIGH = 3,
1057 	WLAN_ROAM_STATS_ABORT_BG_RSSI_ABOVE_THRESHOLD = 4,
1058 };
1059 
1060 /**
1061  * enum roam_scan_dwell_type  - Roam scan dwell type defines
1062  * @WLAN_ROAM_DWELL_TYPE_UNSPECIFIED: Target did not specify the
1063  *  detailed roam scan type.
1064  * @WLAN_ROAM_DWELL_ACTIVE_TYPE: active scan during roam
1065  * @WLAN_ROAM_DWELL_PASSIVE_TYPE: passive scan during roam.
1066  */
1067 enum roam_scan_dwell_type {
1068 	WLAN_ROAM_DWELL_TYPE_UNSPECIFIED = 0,
1069 	WLAN_ROAM_DWELL_ACTIVE_TYPE = 1,
1070 	WLAN_ROAM_DWELL_PASSIVE_TYPE = 2,
1071 };
1072 
1073 /**
1074  * enum eroam_frame_subtype - Enhanced roam frame subtypes.
1075  *
1076  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_INVALID: Invalid subtype
1077  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_AUTH_RESP: Authentication resp frame
1078  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_REASSOC_RESP: Reassociation resp frame
1079  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M1: EAPOL-Key M1 frame
1080  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M2: EAPOL-Key M2 frame
1081  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M3: EAPOL-Key M3 frame
1082  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M4: EAPOL-Key M4 frame
1083  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_GTK_M1: EAPOL-Key GTK M1 frame
1084  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_GTK_M2: EAPOL-Key GTK M2 frame
1085  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_AUTH_REQ: Authentication req frame
1086  * @WLAN_ROAM_STATS_FRAME_SUBTYPE_REASSOC_REQ: Reassociation req frame
1087  */
1088 enum eroam_frame_subtype {
1089 	WLAN_ROAM_STATS_FRAME_SUBTYPE_INVALID = 0,
1090 	WLAN_ROAM_STATS_FRAME_SUBTYPE_AUTH_RESP = 1,
1091 	WLAN_ROAM_STATS_FRAME_SUBTYPE_REASSOC_RESP = 2,
1092 	WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M1 = 3,
1093 	WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M2 = 4,
1094 	WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M3 = 5,
1095 	WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_M4 = 6,
1096 	WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_GTK_M1 = 7,
1097 	WLAN_ROAM_STATS_FRAME_SUBTYPE_EAPOL_GTK_M2 = 8,
1098 	WLAN_ROAM_STATS_FRAME_SUBTYPE_AUTH_REQ = 9,
1099 	WLAN_ROAM_STATS_FRAME_SUBTYPE_REASSOC_REQ = 10,
1100 };
1101 
1102 /**
1103  * enum eroam_frame_status - Specifies the valid values of roam frame status
1104  *
1105  * @WLAN_ROAM_STATS_FRAME_STATUS_SUCCESS: indicates the roam frame was
1106  *  sent or received successfully.
1107  * @WLAN_ROAM_STATS_FRAME_STATUS_FAIL: indicates the roam frame sending or
1108  *  receiving failed.
1109  */
1110 enum eroam_frame_status {
1111 	WLAN_ROAM_STATS_FRAME_STATUS_SUCCESS = 0,
1112 	WLAN_ROAM_STATS_FRAME_STATUS_FAIL = 1,
1113 };
1114 
1115 /**
1116  * enum roam_trigger_reason - Reason for triggering roam
1117  * @ROAM_TRIGGER_REASON_NONE: Roam trigger reason none
1118  * @ROAM_TRIGGER_REASON_PER:  Roam triggered due to packet error
1119  * @ROAM_TRIGGER_REASON_BMISS: Roam triggered due to beacon miss
1120  * @ROAM_TRIGGER_REASON_LOW_RSSI: Roam triggered due to low RSSI of current
1121  * connected AP.
1122  * @ROAM_TRIGGER_REASON_HIGH_RSSI: Roam triggered because sta is connected to
1123  * a AP in 2.4GHz band and a better 5GHz AP is available
1124  * @ROAM_TRIGGER_REASON_PERIODIC: Roam triggered as better AP was found during
1125  * periodic roam scan.
1126  * @ROAM_TRIGGER_REASON_MAWC: Motion Aided WiFi Connectivity triggered roam.
1127  * @ROAM_TRIGGER_REASON_DENSE: Roaming triggered due to dense environment
1128  * detected.
1129  * @ROAM_TRIGGER_REASON_BACKGROUND: Roam triggered due to current AP having
1130  * poor rssi and scan candidate found in scan results provided by other
1131  * scan clients.
1132  * @ROAM_TRIGGER_REASON_FORCED: Forced roam trigger.
1133  * @ROAM_TRIGGER_REASON_BTM: Roam triggered due to AP sent BTM query with
1134  * Disassoc imminent bit set.
1135  * @ROAM_TRIGGER_REASON_UNIT_TEST: Roam triggered due to unit test command.
1136  * @ROAM_TRIGGER_REASON_BSS_LOAD: Roam triggered due to high channel utilization
1137  * in the current connected channel
1138  * @ROAM_TRIGGER_REASON_DEAUTH: Roam triggered due to deauth received from the
1139  * current connected AP.
1140  * @ROAM_TRIGGER_REASON_IDLE: Roam triggered due to inactivity of the device.
1141  * @ROAM_TRIGGER_REASON_STA_KICKOUT: Roam triggered due to sta kickout event.
1142  * @ROAM_TRIGGER_REASON_ESS_RSSI: Roam triggered due to ess rssi
1143  * @ROAM_TRIGGER_REASON_WTC_BTM: Roam triggered due to WTC BTM
1144  * @ROAM_TRIGGER_REASON_PMK_TIMEOUT: Roam triggered due to PMK expiry
1145  * @ROAM_TRIGGER_REASON_BTC: Roam triggered due to BT Coex
1146  * @ROAM_TRIGGER_REASON_MAX: Maximum number of roam triggers
1147  */
1148 enum roam_trigger_reason {
1149 	ROAM_TRIGGER_REASON_NONE = 0,
1150 	ROAM_TRIGGER_REASON_PER,
1151 	ROAM_TRIGGER_REASON_BMISS,
1152 	ROAM_TRIGGER_REASON_LOW_RSSI,
1153 	ROAM_TRIGGER_REASON_HIGH_RSSI,
1154 	ROAM_TRIGGER_REASON_PERIODIC,
1155 	ROAM_TRIGGER_REASON_MAWC,
1156 	ROAM_TRIGGER_REASON_DENSE,
1157 	ROAM_TRIGGER_REASON_BACKGROUND,
1158 	ROAM_TRIGGER_REASON_FORCED,
1159 	ROAM_TRIGGER_REASON_BTM,
1160 	ROAM_TRIGGER_REASON_UNIT_TEST,
1161 	ROAM_TRIGGER_REASON_BSS_LOAD,
1162 	ROAM_TRIGGER_REASON_DEAUTH,
1163 	ROAM_TRIGGER_REASON_IDLE,
1164 	ROAM_TRIGGER_REASON_STA_KICKOUT,
1165 	ROAM_TRIGGER_REASON_ESS_RSSI,
1166 	ROAM_TRIGGER_REASON_WTC_BTM,
1167 	ROAM_TRIGGER_REASON_PMK_TIMEOUT,
1168 	ROAM_TRIGGER_REASON_BTC,
1169 	ROAM_TRIGGER_REASON_MAX,
1170 };
1171 
1172 /**
1173  * struct roam_trigger_min_rssi - structure to hold minimum rssi value of
1174  * candidate APs for each roam trigger
1175  * @min_rssi: minimum RSSI of candidate AP for the trigger reason specified in
1176  * trigger_id
1177  * @trigger_reason: Roam trigger reason
1178  */
1179 struct roam_trigger_min_rssi {
1180 	int32_t  min_rssi;
1181 	enum roam_trigger_reason trigger_reason;
1182 };
1183 
1184 /**
1185  * struct roam_trigger_score_delta - structure to hold roam score delta value of
1186  * candidate APs for each roam trigger
1187  * @roam_score_delta: delta value in score of the candidate AP for the roam
1188  * trigger mentioned in the trigger_id.
1189  * @trigger_reason: Roam trigger reason
1190  */
1191 struct roam_trigger_score_delta {
1192 	uint32_t roam_score_delta;
1193 	enum roam_trigger_reason trigger_reason;
1194 };
1195 
1196 /**
1197  * struct wlan_roam_triggers - vendor configured roam triggers
1198  * @vdev_id: vdev id
1199  * @trigger_bitmap: vendor configured roam trigger bitmap as
1200  *		    defined @enum roam_control_trigger_reason
1201  * @roam_score_delta: Value of roam score delta
1202  * percentage to trigger roam
1203  * @roam_scan_scheme_bitmap: Bitmap of roam triggers as defined in
1204  * enum roam_trigger_reason, for which the roam scan scheme should
1205  * be partial scan
1206  * @vendor_btm_param: roam trigger param
1207  * @min_rssi_params: Min RSSI values for different roam triggers
1208  * @score_delta_param: Roam score delta values for different triggers
1209  */
1210 struct wlan_roam_triggers {
1211 	uint32_t vdev_id;
1212 	uint32_t trigger_bitmap;
1213 	uint32_t roam_score_delta;
1214 	uint32_t roam_scan_scheme_bitmap;
1215 	struct wlan_cm_roam_vendor_btm_params vendor_btm_param;
1216 	struct roam_trigger_min_rssi min_rssi_params[NUM_OF_ROAM_MIN_RSSI];
1217 	struct roam_trigger_score_delta score_delta_param[NUM_OF_ROAM_TRIGGERS];
1218 };
1219 
1220 /**
1221  * struct ap_profile_params - ap profile params
1222  * @vdev_id: vdev id
1223  * @profile: ap profile to match candidate
1224  * @param: scoring params to short candidate
1225  * @min_rssi_params: Min RSSI values for different roam triggers
1226  * @score_delta_param: Roam score delta values for different triggers
1227  * @owe_ap_profile: owe ap profile info
1228  */
1229 struct ap_profile_params {
1230 	uint8_t vdev_id;
1231 	struct ap_profile profile;
1232 	struct scoring_param param;
1233 	struct roam_trigger_min_rssi min_rssi_params[NUM_OF_ROAM_MIN_RSSI];
1234 	struct roam_trigger_score_delta score_delta_param[NUM_OF_ROAM_TRIGGERS];
1235 	struct owe_transition_mode_info owe_ap_profile;
1236 };
1237 
1238 /**
1239  * struct wlan_roam_mawc_params - Motion Aided wireless connectivity params
1240  * @vdev_id: VDEV on which the parameters should be applied
1241  * @enable: MAWC roaming feature enable/disable
1242  * @traffic_load_threshold: Traffic threshold in kBps for MAWC roaming
1243  * @best_ap_rssi_threshold: AP RSSI Threshold for MAWC roaming
1244  * @rssi_stationary_high_adjust: High RSSI adjustment value to suppress scan
1245  * @rssi_stationary_low_adjust: Low RSSI adjustment value to suppress scan
1246  */
1247 struct wlan_roam_mawc_params {
1248 	uint8_t vdev_id;
1249 	bool enable;
1250 	uint32_t traffic_load_threshold;
1251 	uint32_t best_ap_rssi_threshold;
1252 	uint8_t rssi_stationary_high_adjust;
1253 	uint8_t rssi_stationary_low_adjust;
1254 };
1255 
1256 /**
1257  * struct roam_scan_filter_params - Structure holding roaming scan
1258  *                                  parameters
1259  * @op_bitmap: bitmap to determine reason of roaming
1260  * @vdev_id: vdev id
1261  * @num_bssid_deny_list: The number of BSSID's that we should avoid
1262  *                        connecting to. It is like a denylist of BSSID's.
1263  * @num_ssid_allow_list: The number of SSID profiles that are in the
1264  *                       Allowlist. When roaming, we consider the BSSID's with
1265  *                       this SSID also for roaming apart from the connected
1266  *                       one's
1267  * @num_bssid_preferred_list: Number of BSSID's which have a preference over
1268  *                            others
1269  * @bssid_avoid_list: Denylist SSID's
1270  * @ssid_allowed_list: Allowlist SSID's
1271  * @bssid_favored: Favorable BSSID's
1272  * @bssid_favored_factor: RSSI to be added to this BSSID to prefer it
1273  * @lca_disallow_config_present: LCA [Last Connected AP] disallow config
1274  *                               present
1275  * @disallow_duration: How long LCA AP will be disallowed before it can be a
1276  *                     roaming candidate again, in seconds
1277  * @rssi_channel_penalization: How much RSSI will be penalized if candidate(s)
1278  *                             are found in the same channel as disallowed
1279  *                             AP's, in units of db
1280  * @num_disallowed_aps: How many APs the target should maintain in its LCA
1281  *                      list
1282  * @num_rssi_rejection_ap: Number of entries in @rssi_rejection_ap
1283  * @rssi_rejection_ap: APs rejected due to poor RSSI
1284  * @delta_rssi: (dB units) when AB in RSSI denylist improved by at least
1285  *              delta_rssi,it will be removed from denylist
1286  *
1287  * This structure holds all the key parameters related to
1288  * initial connection and roaming connections.
1289  */
1290 
1291 struct roam_scan_filter_params {
1292 	uint32_t op_bitmap;
1293 	uint8_t vdev_id;
1294 	uint32_t num_bssid_deny_list;
1295 	uint32_t num_ssid_allow_list;
1296 	uint32_t num_bssid_preferred_list;
1297 	struct qdf_mac_addr bssid_avoid_list[MAX_BSSID_AVOID_LIST];
1298 	struct wlan_ssid ssid_allowed_list[MAX_SSID_ALLOWED_LIST];
1299 	struct qdf_mac_addr bssid_favored[MAX_BSSID_FAVORED];
1300 	uint8_t bssid_favored_factor[MAX_BSSID_FAVORED];
1301 	uint8_t lca_disallow_config_present;
1302 	uint32_t disallow_duration;
1303 	uint32_t rssi_channel_penalization;
1304 	uint32_t num_disallowed_aps;
1305 	uint32_t num_rssi_rejection_ap;
1306 	struct reject_ap_config_params
1307 				rssi_rejection_ap[MAX_RSSI_AVOID_BSSID_LIST];
1308 	uint32_t delta_rssi;
1309 };
1310 
1311 /**
1312  * struct wlan_roam_scan_filter_params - structure containing parameters for
1313  * roam scan offload filter
1314  * @reason: reason for changing roam state for the requested vdev id
1315  * @filter_params: roam scan filter parameters
1316  */
1317 struct wlan_roam_scan_filter_params {
1318 	uint8_t reason;
1319 	struct roam_scan_filter_params filter_params;
1320 };
1321 
1322 /**
1323  * struct wlan_roam_btm_config - BSS Transition Management offload params
1324  * @vdev_id: VDEV on which the parameters should be applied
1325  * @btm_offload_config: BTM config
1326  * @btm_solicited_timeout: Timeout value for waiting BTM request
1327  * @btm_max_attempt_cnt: Maximum attempt for sending BTM query to ESS
1328  * @btm_sticky_time: Stick time after roaming to new AP by BTM
1329  * @disassoc_timer_threshold: threshold value till which the firmware can
1330  * wait before triggering the roam scan after receiving the disassoc imminent
1331  * @btm_query_bitmask: bitmask to btm query with candidate list
1332  * @btm_candidate_min_score: Minimum score of the AP to consider it as a
1333  * candidate if the roam trigger is BTM kickout.
1334  */
1335 struct wlan_roam_btm_config {
1336 	uint8_t vdev_id;
1337 	uint32_t btm_offload_config;
1338 	uint32_t btm_solicited_timeout;
1339 	uint32_t btm_max_attempt_cnt;
1340 	uint32_t btm_sticky_time;
1341 	uint32_t disassoc_timer_threshold;
1342 	uint32_t btm_query_bitmask;
1343 	uint32_t btm_candidate_min_score;
1344 };
1345 
1346 /**
1347  * struct wlan_roam_neighbor_report_params -neighbour report params
1348  * @time_offset: time offset after 11k offload command to trigger a neighbor
1349  *	report request (in seconds)
1350  * @low_rssi_offset: Offset from rssi threshold to trigger a neighbor
1351  *	report request (in dBm)
1352  * @bmiss_count_trigger: Number of beacon miss events to trigger neighbor
1353  *	report request
1354  * @per_threshold_offset: offset from PER threshold to trigger neighbor
1355  *	report request (in %)
1356  * @neighbor_report_cache_timeout: timeout after which new trigger can enable
1357  *	sending of a neighbor report request (in seconds)
1358  * @max_neighbor_report_req_cap: max number of neighbor report requests that
1359  *	can be sent to the peer in the current session
1360  * @ssid: Current connect SSID info
1361  */
1362 struct wlan_roam_neighbor_report_params {
1363 	uint32_t time_offset;
1364 	uint32_t low_rssi_offset;
1365 	uint32_t bmiss_count_trigger;
1366 	uint32_t per_threshold_offset;
1367 	uint32_t neighbor_report_cache_timeout;
1368 	uint32_t max_neighbor_report_req_cap;
1369 	struct wlan_ssid ssid;
1370 };
1371 
1372 /**
1373  * struct wlan_roam_11k_offload_params - offload 11k features to FW
1374  * @vdev_id: vdev id
1375  * @offload_11k_bitmask: bitmask to specify offloaded features
1376  *	B0: Neighbor Report Request offload
1377  *	B1-B31: Reserved
1378  * @neighbor_report_params: neighbor report offload params
1379  */
1380 struct wlan_roam_11k_offload_params {
1381 	uint32_t vdev_id;
1382 	uint32_t offload_11k_bitmask;
1383 	struct wlan_roam_neighbor_report_params neighbor_report_params;
1384 };
1385 
1386 /**
1387  * struct wlan_roam_bss_load_config - BSS load trigger parameters
1388  * @vdev_id: VDEV on which the parameters should be applied
1389  * @bss_load_threshold: BSS load threshold after which roam scan should trigger
1390  * @bss_load_sample_time: Time duration in milliseconds for which the bss load
1391  * trigger needs to be enabled
1392  * @rssi_threshold_6ghz: RSSI threshold of the current connected AP below which
1393  * roam should be triggered if bss load threshold exceeds the configured value.
1394  * This value is applicable only when we are connected in 6GHz band.
1395  * @rssi_threshold_5ghz: RSSI threshold of the current connected AP below which
1396  * roam should be triggered if bss load threshold exceeds the configured value.
1397  * This value is applicable only when we are connected in 5GHz band.
1398  * @rssi_threshold_24ghz: RSSI threshold of the current connected AP below which
1399  * roam should be triggered if bss load threshold exceeds the configured value.
1400  * This value is applicable only when we are connected in 2.4GHz band.
1401  */
1402 struct wlan_roam_bss_load_config {
1403 	uint32_t vdev_id;
1404 	uint32_t bss_load_threshold;
1405 	uint32_t bss_load_sample_time;
1406 	int32_t rssi_threshold_6ghz;
1407 	int32_t rssi_threshold_5ghz;
1408 	int32_t rssi_threshold_24ghz;
1409 };
1410 
1411 /**
1412  * struct roam_disable_cfg - Firmware roam module disable parameters
1413  * @vdev_id: vdev for which the roaming has to be enabled/disabled
1414  * @cfg:  Config to enable/disable FW roam module
1415  */
1416 struct roam_disable_cfg {
1417 	uint8_t vdev_id;
1418 	uint8_t cfg;
1419 };
1420 
1421 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
1422 /**
1423  * struct vendor_handoff_cfg - vendor handoff command params
1424  * @vdev_id: vdev for which host sends vendor handoff command
1425  * @param_id:  parameter id
1426  */
1427 struct vendor_handoff_cfg {
1428 	uint32_t vdev_id;
1429 	uint32_t param_id;
1430 };
1431 #endif
1432 
1433 /**
1434  * struct wlan_roam_disconnect_params - Emergency deauth/disconnect roam params
1435  * @vdev_id: VDEV on which the parameters should be applied
1436  * @enable: Enable or disable disconnect roaming.
1437  */
1438 struct wlan_roam_disconnect_params {
1439 	uint32_t vdev_id;
1440 	bool enable;
1441 };
1442 
1443 /**
1444  * struct wlan_roam_idle_params - Idle roam trigger parameters
1445  * @vdev_id: VDEV on which the parameters should be applied
1446  * @enable: Enable/Disable Idle roaming
1447  * @band: Connected AP band
1448  * @conn_ap_rssi_delta: Rssi change of connected AP in dBm
1449  * @conn_ap_min_rssi: If connected AP rssi is less than min rssi trigger roam
1450  * @inactive_time: Connected AP idle time
1451  * @data_pkt_count: Data packet count allowed during idle time
1452  */
1453 struct wlan_roam_idle_params {
1454 	uint32_t vdev_id;
1455 	bool enable;
1456 	uint32_t band;
1457 	uint32_t conn_ap_rssi_delta;
1458 	int32_t conn_ap_min_rssi;
1459 	uint32_t inactive_time;
1460 	uint32_t data_pkt_count;
1461 };
1462 
1463 /**
1464  * struct wlan_per_roam_config - per based roaming parameters
1465  * @enable: if PER based roaming is enabled/disabled
1466  * @tx_high_rate_thresh: high rate threshold at which PER based
1467  *     roam will stop in tx path
1468  * @rx_high_rate_thresh: high rate threshold at which PER based
1469  *     roam will stop in rx path
1470  * @tx_low_rate_thresh: rate below which traffic will be considered
1471  *     for PER based roaming in Tx path
1472  * @rx_low_rate_thresh: rate below which traffic will be considered
1473  *     for PER based roaming in Tx path
1474  * @tx_rate_thresh_percnt: % above which when traffic is below low_rate_thresh
1475  *     will be considered for PER based scan in tx path
1476  * @rx_rate_thresh_percnt: % above which when traffic is below low_rate_thresh
1477  *     will be considered for PER based scan in rx path
1478  * @per_rest_time: time for which PER based roam will wait once it
1479  *     issues a roam scan.
1480  * @tx_per_mon_time: Minimum time required to be considered as valid scenario
1481  *     for PER based roam in tx path
1482  * @rx_per_mon_time: Minimum time required to be considered as valid scenario
1483  *     for PER based roam in rx path
1484  * @min_candidate_rssi: Minimum RSSI threshold for candidate AP to be used for
1485  *     PER based roaming
1486  */
1487 struct wlan_per_roam_config {
1488 	uint32_t enable;
1489 	uint32_t tx_high_rate_thresh;
1490 	uint32_t rx_high_rate_thresh;
1491 	uint32_t tx_low_rate_thresh;
1492 	uint32_t rx_low_rate_thresh;
1493 	uint32_t tx_rate_thresh_percnt;
1494 	uint32_t rx_rate_thresh_percnt;
1495 	uint32_t per_rest_time;
1496 	uint32_t tx_per_mon_time;
1497 	uint32_t rx_per_mon_time;
1498 	uint32_t min_candidate_rssi;
1499 };
1500 
1501 /**
1502  * struct wlan_per_roam_config_req: PER based roaming config request
1503  * @vdev_id: vdev id on which config needs to be set
1504  * @per_config: PER config
1505  */
1506 struct wlan_per_roam_config_req {
1507 	uint8_t vdev_id;
1508 	struct wlan_per_roam_config per_config;
1509 };
1510 
1511 #define NOISE_FLOOR_DBM_DEFAULT          (-96)
1512 #define RSSI_MIN_VALUE                   (-128)
1513 #define RSSI_MAX_VALUE                   (127)
1514 
1515 #ifdef WLAN_FEATURE_FILS_SK
1516 #define WLAN_FILS_MAX_USERNAME_LENGTH 16
1517 
1518 /**
1519  * struct wlan_roam_fils_params - Roaming FILS params
1520  * @next_erp_seq_num: next ERP sequence number
1521  * @username: username
1522  * @username_length: username length
1523  * @rrk: RRK
1524  * @rrk_length: length of @rrk
1525  * @rik: RIK
1526  * @rik_length: length of @rik
1527  * @realm: realm
1528  * @realm_len: length of @realm
1529  * @fils_ft: xx_key for FT-FILS connection
1530  * @fils_ft_len: length of FT-FILS
1531  */
1532 struct wlan_roam_fils_params {
1533 	uint32_t next_erp_seq_num;
1534 	uint8_t username[WLAN_FILS_MAX_USERNAME_LENGTH];
1535 	uint32_t username_length;
1536 	uint8_t rrk[WLAN_FILS_MAX_RRK_LENGTH];
1537 	uint32_t rrk_length;
1538 	uint8_t rik[WLAN_FILS_MAX_RIK_LENGTH];
1539 	uint32_t rik_length;
1540 	uint8_t realm[WLAN_FILS_MAX_REALM_LEN];
1541 	uint32_t realm_len;
1542 	uint8_t fils_ft[WLAN_FILS_FT_MAX_LEN];
1543 	uint8_t fils_ft_len;
1544 };
1545 #endif
1546 
1547 /**
1548  * struct wlan_roam_scan_params  - Roaming scan parameters
1549  * @vdev_id: vdev id
1550  * @dwell_time_passive: dwell time in msec on passive channels
1551  * @dwell_time_active: dwell time in msec on active channels
1552  * @min_dwell_time_6ghz: minimum dwell time in msec for 6 GHz channel
1553  * @burst_duration: Burst duration time in msec
1554  * @min_rest_time: min time in msec on the BSS channel,only valid if atleast
1555  * one VDEV is active
1556  * @max_rest_time: max rest time in msec on the BSS channel,only valid if
1557  * at least one VDEV is active
1558  * @probe_spacing_time: time in msec between 2 consecutive probe requests with
1559  * in a set
1560  * @probe_delay: delay in msec before sending first probe request after
1561  * switching to a channel
1562  * @repeat_probe_time: time in msec between 2 consecutive probe requests within
1563  * a set
1564  * @max_scan_time: maximum time in msec allowed for scan
1565  * @idle_time: data inactivity time in msec on bss channel that will be used by
1566  * scanner for measuring the inactivity
1567  * @n_probes: Max number of probes to be sent
1568  * @scan_ctrl_flags: Scan control flags
1569  * @scan_ctrl_flags_ext: Scan control flags extended
1570  * @rso_adaptive_dwell_mode: Adaptive dwell mode
1571  * @num_chan: number of channels
1572  * @num_bssid: number of bssids in tlv bssid_list[]
1573  * @ie_len: number of bytes in ie data. In the TLV ie_data[]
1574  * @dwell_time_active_2g: dwell time in msec on active 2G channels.
1575  * @dwell_time_active_6ghz: dwell time in msec when 6 GHz channel
1576  * @dwell_time_passive_6ghz: Passive scan dwell time in msec for 6Ghz channel.
1577  * @scan_start_offset: Offset time is in milliseconds per channel
1578  */
1579 struct wlan_roam_scan_params {
1580 	uint32_t vdev_id;
1581 	uint32_t dwell_time_passive;
1582 	uint32_t dwell_time_active;
1583 	uint32_t min_dwell_time_6ghz;
1584 	uint32_t burst_duration;
1585 	uint32_t min_rest_time;
1586 	uint32_t max_rest_time;
1587 	uint32_t probe_spacing_time;
1588 	uint32_t probe_delay;
1589 	uint32_t repeat_probe_time;
1590 	uint32_t max_scan_time;
1591 	uint32_t idle_time;
1592 	uint32_t n_probes;
1593 	uint32_t scan_ctrl_flags;
1594 	uint32_t scan_ctrl_flags_ext;
1595 	enum scan_dwelltime_adaptive_mode rso_adaptive_dwell_mode;
1596 	uint32_t num_chan;
1597 	uint32_t num_bssid;
1598 	uint32_t ie_len;
1599 	uint32_t dwell_time_active_2g;
1600 	uint32_t dwell_time_active_6ghz;
1601 	uint32_t dwell_time_passive_6ghz;
1602 	uint32_t scan_start_offset;
1603 };
1604 
1605 /**
1606  * struct wlan_roam_scan_mode_params  - WMI_ROAM_SCAN_MODE command fixed_param
1607  * wmi_roam_scan_mode_fixed_param related params
1608  * @roam_scan_mode: Roam scan mode flags
1609  * @min_delay_btw_scans: Minimum duration allowed between two consecutive roam
1610  * scans in millisecs.
1611  * @min_delay_roam_trigger_bitmask: Roaming triggers for which the min delay
1612  * between roam scans is applicable(bitmask of enum WMI_ROAM_TRIGGER_REASON_ID)
1613  */
1614 struct wlan_roam_scan_mode_params {
1615 	uint32_t roam_scan_mode;
1616 	uint32_t min_delay_btw_scans;
1617 	uint32_t min_delay_roam_trigger_bitmask;
1618 };
1619 
1620 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
1621 /**
1622  * struct wlan_rso_lfr3_params  - LFR-3.0 roam offload params to be filled
1623  * in the wmi_roam_offload_tlv_param TLV of WMI_ROAM_SCAN_MODE command.
1624  * @roam_rssi_cat_gap: RSSI category gap
1625  * @prefer_5ghz: Prefer 5G candidate AP
1626  * @select_5ghz_margin: Prefer connecting to 5G AP even if its RSSI is lower by
1627  * select_5g_margin dBm
1628  * @reassoc_failure_timeout: reassociation response failure timeout
1629  * @ho_delay_for_rx: Time in millisecs to delay hand-off by this duration to
1630  * receive pending Rx frames from current BSS
1631  * @roam_retry_count: maximum number of software retries for preauth and
1632  * reassoc req
1633  * @roam_preauth_no_ack_timeout: duration in millsecs to wait before another SW
1634  * retry made if no ack seen for previous frame
1635  * @disable_self_roam: Disable roaming to current connected BSS.
1636  * @rct_validity_timer: duration value for which the entries in
1637  * roam candidate table(rct) are valid
1638  */
1639 struct wlan_rso_lfr3_params {
1640 	uint8_t roam_rssi_cat_gap;
1641 	uint8_t prefer_5ghz;
1642 	uint8_t select_5ghz_margin;
1643 	uint32_t reassoc_failure_timeout;
1644 	uint32_t ho_delay_for_rx;
1645 	uint32_t roam_retry_count;
1646 	uint32_t roam_preauth_no_ack_timeout;
1647 	bool disable_self_roam;
1648 	uint32_t rct_validity_timer;
1649 };
1650 
1651 #define WLAN_ROAM_OFFLOAD_NUM_MCS_SET     (16)
1652 /**
1653  * struct wlan_rso_lfr3_caps  - LFR3 Roaming offload parameters
1654  * @capability: RSN capabilities
1655  * @ht_caps_info: HT capabilities information
1656  * @ampdu_param: AMPDU configs
1657  * @ht_ext_cap: HT extended capabilities info
1658  * @ht_txbf: HT Tx Beamform capabilities
1659  * @asel_cap: Antena selection capabilities
1660  * @qos_enabled: QoS enabled
1661  * @qos_caps: QoS capabilities
1662  * @wmm_caps: WMM capabilities
1663  * @mcsset: MCS set
1664  */
1665 struct wlan_rso_lfr3_caps {
1666 	uint32_t capability;
1667 	uint32_t ht_caps_info;
1668 	uint32_t ampdu_param;
1669 	uint32_t ht_ext_cap;
1670 	uint32_t ht_txbf;
1671 	uint32_t asel_cap;
1672 	uint32_t qos_enabled;
1673 	uint32_t qos_caps;
1674 	uint32_t wmm_caps;
1675 	/* since this is 4 byte aligned, we don't declare it as tlv array */
1676 	uint32_t mcsset[WLAN_ROAM_OFFLOAD_NUM_MCS_SET >> 2];
1677 };
1678 
1679 /**
1680  * struct wlan_rso_11i_params  - LFR-3.0 related parameters to be filled in
1681  * wmi_roam_11i_offload_tlv_param TLV in the WMI_ROAM_SCAN_MODE command.
1682  * @roam_key_mgmt_offload_enabled: Enable 4-way HS offload to firmware
1683  * @fw_okc: use OKC in firmware
1684  * @fw_pmksa_cache: use PMKSA cache in firmware
1685  * @is_sae_same_pmk: Flag to indicate fw whether WLAN_SAE_SINGLE_PMK feature is
1686  * enable or not
1687  * @psk_pmk: pre shared key/pairwise master key
1688  * @pmk_len: length of PMK
1689  */
1690 struct wlan_rso_11i_params {
1691 	bool roam_key_mgmt_offload_enabled;
1692 	bool fw_okc;
1693 	bool fw_pmksa_cache;
1694 	bool is_sae_same_pmk;
1695 	uint8_t psk_pmk[MAX_PMK_LEN];
1696 	uint8_t pmk_len;
1697 };
1698 
1699 /**
1700  * struct wlan_rso_11r_params  - LFR-3.0 parameters to fill
1701  * wmi_roam_11r_offload_tlv_param TLV related info in WMI_ROAM_SCAN_MODE command
1702  * @is_11r_assoc:
1703  * @is_adaptive_11r:
1704  * @enable_ft_im_roaming: Flag to enable/disable FT-IM roaming upon receiving
1705  * deauth
1706  * @psk_pmk: key material
1707  * @pmk_len: length of key material
1708  * @r0kh_id_length: r0kh id length
1709  * @r0kh_id: r0kh id
1710  * @mdid: mobility domain info
1711  * @enable_ft_over_ds: Flag to enable/disable FT-over-DS
1712  */
1713 struct wlan_rso_11r_params {
1714 	bool is_11r_assoc;
1715 	bool is_adaptive_11r;
1716 	bool enable_ft_im_roaming;
1717 	uint8_t psk_pmk[MAX_PMK_LEN];
1718 	uint8_t pmk_len;
1719 	uint32_t r0kh_id_length;
1720 	uint8_t r0kh_id[WMI_ROAM_R0KH_ID_MAX_LEN];
1721 	struct mobility_domain_info mdid;
1722 	bool enable_ft_over_ds;
1723 };
1724 
1725 /**
1726  * struct wlan_rso_ese_params  - LFR-3.0 parameters to fill the
1727  * wmi_roam_ese_offload_tlv_param TLV related info in WMI_ROAM_SCAN_MODE command
1728  * @is_ese_assoc: flag to determine ese assoc
1729  * @krk: KRK
1730  * @btk: BTK
1731  */
1732 struct wlan_rso_ese_params {
1733 	bool is_ese_assoc;
1734 	uint8_t krk[WMI_KRK_KEY_LEN];
1735 	uint8_t btk[WMI_BTK_KEY_LEN];
1736 };
1737 
1738 /**
1739  * struct wlan_rso_sae_offload_params - SAE authentication offload related
1740  * parameters.
1741  * @spmk_timeout: Single PMK timeout value in seconds.
1742  */
1743 struct wlan_rso_sae_offload_params {
1744 	uint32_t spmk_timeout;
1745 };
1746 #endif
1747 
1748 #define ROAM_SCAN_DWELL_TIME_ACTIVE_DEFAULT   (100)
1749 #define ROAM_SCAN_DWELL_TIME_PASSIVE_DEFAULT  (110)
1750 #define ROAM_SCAN_MIN_REST_TIME_DEFAULT       (50)
1751 #define ROAM_SCAN_MAX_REST_TIME_DEFAULT       (500)
1752 #define ROAM_SCAN_HW_DEF_SCAN_MAX_DURATION    30000 /* 30 secs */
1753 #define ROAM_SCAN_CHANNEL_SWITCH_TIME         (4)
1754 
1755 /**
1756  * struct wlan_roam_scan_offload_params - structure containing roaming offload
1757  * scan parameters to be filled over WMI_ROAM_SCAN_MODE command.
1758  * @vdev_id: vdev id
1759  * @is_rso_stop: flag to tell whether roam req is valid or NULL
1760  * @roaming_scan_policy:
1761  * @rso_mode_info: Roam scan mode related parameters
1762  * @rso_scan_params: Roam scan offload scan start params
1763  * @scan_params: Roaming scan related parameters
1764  * @assoc_ie_length: Assoc IE length
1765  * @assoc_ie: Assoc IE buffer
1766  * @roam_offload_enabled: flag for offload enable
1767  * @add_fils_tlv: add FILS TLV boolean
1768  * @akm: authentication key management mode
1769  * @rso_lfr3_params: Candidate selection and other lfr-3.0 offload parameters
1770  * @rso_lfr3_caps: Self capabilities
1771  * @rso_11i_info: PMK, PMKSA, SAE single PMK related parameters
1772  * @rso_11r_info: FT related parameters
1773  * @rso_ese_info: ESE related parameters
1774  * @fils_roam_config: roam fils params
1775  * @sae_offload_params: SAE offload/single pmk related parameters
1776  */
1777 struct wlan_roam_scan_offload_params {
1778 	uint32_t vdev_id;
1779 	uint8_t is_rso_stop;
1780 	/* Parameters common for LFR-3.0 and LFR-2.0 */
1781 	bool roaming_scan_policy;
1782 	struct wlan_roam_scan_mode_params rso_mode_info;
1783 	struct wlan_roam_scan_params rso_scan_params;
1784 	uint32_t assoc_ie_length;
1785 	uint8_t  assoc_ie[MAX_ASSOC_IE_LENGTH];
1786 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
1787 	/* Parameters specific to LFR-3.0 */
1788 	bool roam_offload_enabled;
1789 	bool add_fils_tlv;
1790 	int akm;
1791 	struct wlan_rso_lfr3_params rso_lfr3_params;
1792 	struct wlan_rso_lfr3_caps rso_lfr3_caps;
1793 	struct wlan_rso_11i_params rso_11i_info;
1794 	struct wlan_rso_11r_params rso_11r_info;
1795 	struct wlan_rso_ese_params rso_ese_info;
1796 #ifdef WLAN_FEATURE_FILS_SK
1797 	struct wlan_roam_fils_params fils_roam_config;
1798 #endif
1799 	struct wlan_rso_sae_offload_params sae_offload_params;
1800 #endif
1801 };
1802 
1803 /**
1804  * enum wlan_roam_offload_scan_rssi_flags - Flags for roam scan RSSI threshold
1805  * params, this enums will be used in flags param of the structure
1806  * wlan_roam_offload_scan_rssi_params
1807  * @ROAM_SCAN_RSSI_THRESHOLD_INVALID_FLAG: invalid flag
1808  * @ROAM_SCAN_RSSI_THRESHOLD_FLAG_ROAM_HI_RSSI_EN_ON_5G: enable high RSSI roam
1809  * trigger support to roam from 5 GHz to 6 GHz band
1810  */
1811 enum wlan_roam_offload_scan_rssi_flags {
1812 	ROAM_SCAN_RSSI_THRESHOLD_INVALID_FLAG,
1813 	ROAM_SCAN_RSSI_THRESHOLD_FLAG_ROAM_HI_RSSI_EN_ON_5G = BIT(0),
1814 };
1815 
1816 /**
1817  * struct wlan_roam_offload_scan_rssi_params - structure containing
1818  *              parameters for roam offload scan based on RSSI
1819  * @rssi_thresh: rssi threshold
1820  * @rssi_thresh_diff: difference in rssi threshold
1821  * @hi_rssi_scan_max_count: 5G scan max count
1822  * @hi_rssi_scan_rssi_delta: 5G scan rssi change threshold value
1823  * @hi_rssi_scan_rssi_ub: 5G scan upper bound
1824  * @raise_rssi_thresh_5g: flag to determine penalty and boost thresholds
1825  * @drop_rssi_thresh_5g: flag to determine penalty and boost thresholds
1826  * @vdev_id: vdev id
1827  * @penalty_threshold_5g: RSSI threshold below which 5GHz RSSI is penalized
1828  * @boost_threshold_5g: RSSI threshold above which 5GHz RSSI is favored
1829  * @raise_factor_5g: factor by which 5GHz RSSI is boosted
1830  * @drop_factor_5g: factor by which 5GHz RSSI is penalized
1831  * @max_raise_rssi_5g: maximum boost that can be applied to a 5GHz RSSI
1832  * @max_drop_rssi_5g: maximum penalty that can be applied to a 5GHz RSSI
1833  * @good_rssi_threshold: RSSI below which roam is kicked in by background
1834  *                       scan although rssi is still good
1835  * @early_stop_scan_enable: early stop scan enable
1836  * @roam_earlystop_thres_min: Minimum RSSI threshold value for early stop,
1837  *                            unit is dB above NF
1838  * @roam_earlystop_thres_max: Maximum RSSI threshold value for early stop,
1839  *                            unit is dB above NF
1840  * @dense_rssi_thresh_offset: dense roam RSSI threshold difference
1841  * @dense_min_aps_cnt: dense roam minimum APs
1842  * @initial_dense_status: dense status detected by host
1843  * @traffic_threshold: dense roam RSSI threshold
1844  * @rssi_thresh_offset_5g:
1845  * @bg_scan_bad_rssi_thresh: Bad RSSI threshold to perform bg scan
1846  * @roam_bad_rssi_thresh_offset_2g: Offset from Bad RSSI threshold for 2G
1847  *                                  to 5G Roam
1848  * @bg_scan_client_bitmap: Bitmap used to identify the client scans to snoop
1849  * @roam_data_rssi_threshold_triggers: triggers of bad data RSSI threshold to
1850  *                                  roam
1851  * @roam_data_rssi_threshold: Bad data RSSI threshold to roam
1852  * @rx_data_inactivity_time: Rx duration to check data RSSI
1853  * @flags: Flags for roam scan RSSI threshold params
1854  */
1855 struct wlan_roam_offload_scan_rssi_params {
1856 	int8_t rssi_thresh;
1857 	uint8_t rssi_thresh_diff;
1858 	uint32_t hi_rssi_scan_max_count;
1859 	uint32_t hi_rssi_scan_rssi_delta;
1860 	int32_t hi_rssi_scan_rssi_ub;
1861 	int raise_rssi_thresh_5g;
1862 	int drop_rssi_thresh_5g;
1863 	uint8_t vdev_id;
1864 	uint32_t penalty_threshold_5g;
1865 	uint32_t boost_threshold_5g;
1866 	uint8_t raise_factor_5g;
1867 	uint8_t drop_factor_5g;
1868 	int max_raise_rssi_5g;
1869 	int max_drop_rssi_5g;
1870 	uint32_t good_rssi_threshold;
1871 	bool early_stop_scan_enable;
1872 	int32_t roam_earlystop_thres_min;
1873 	int32_t roam_earlystop_thres_max;
1874 	int dense_rssi_thresh_offset;
1875 	int dense_min_aps_cnt;
1876 	int initial_dense_status;
1877 	int traffic_threshold;
1878 	int32_t rssi_thresh_offset_5g;
1879 	int8_t bg_scan_bad_rssi_thresh;
1880 	uint8_t roam_bad_rssi_thresh_offset_2g;
1881 	uint32_t bg_scan_client_bitmap;
1882 	uint32_t roam_data_rssi_threshold_triggers;
1883 	int32_t roam_data_rssi_threshold;
1884 	uint32_t rx_data_inactivity_time;
1885 	uint32_t flags;
1886 };
1887 
1888 /**
1889  * struct wlan_roam_beacon_miss_cnt - roam beacon miss count
1890  * @vdev_id: vdev id
1891  * @roam_bmiss_first_bcnt: First beacon miss count
1892  * @roam_bmiss_final_bcnt: Final beacon miss count
1893  */
1894 struct wlan_roam_beacon_miss_cnt {
1895 	uint32_t vdev_id;
1896 	uint8_t roam_bmiss_first_bcnt;
1897 	uint8_t roam_bmiss_final_bcnt;
1898 };
1899 
1900 /**
1901  * struct wlan_roam_bmiss_timeout - roam beacon miss timeout
1902  * @vdev_id: vdev id
1903  * @bmiss_timeout_onwakeup : timeout on wakeup in seconds
1904  * @bmiss_timeout_onsleep : timeout on sleep in seconds
1905  */
1906 struct wlan_roam_bmiss_timeout {
1907 	uint32_t vdev_id;
1908 	uint8_t bmiss_timeout_onwakeup;
1909 	uint8_t bmiss_timeout_onsleep;
1910 };
1911 
1912 /**
1913  * struct wlan_roam_reason_vsie_enable - roam reason vsie enable parameters
1914  * @vdev_id: vdev id
1915  * @enable_roam_reason_vsie: enable/disable inclusion of roam Reason
1916  * in Re(association) frame
1917  */
1918 struct wlan_roam_reason_vsie_enable {
1919 	uint32_t vdev_id;
1920 	uint8_t enable_roam_reason_vsie;
1921 };
1922 
1923 /**
1924  * struct wlan_roam_scan_period_params - Roam scan period parameters
1925  * @vdev_id: Vdev for which the scan period parameters are sent
1926  * @empty_scan_refresh_period: empty scan refresh period
1927  * @scan_period: Opportunistic scan runs on a timer for scan_period
1928  * @scan_age: Duration after which the scan entries are to be aged out
1929  * @roam_scan_inactivity_time: inactivity monitoring time in ms for which the
1930  * device is considered to be inactive
1931  * @roam_inactive_data_packet_count: Maximum allowed data packets count during
1932  * roam_scan_inactivity_time.
1933  * @full_scan_period: Full scan period is the idle period in seconds
1934  * between two successive full channel roam scans.
1935  */
1936 struct wlan_roam_scan_period_params {
1937 	uint32_t vdev_id;
1938 	uint32_t empty_scan_refresh_period;
1939 	uint32_t scan_period;
1940 	uint32_t scan_age;
1941 	uint32_t roam_scan_inactivity_time;
1942 	uint32_t roam_inactive_data_packet_count;
1943 	uint32_t full_scan_period;
1944 };
1945 
1946 /**
1947  * struct wlan_roam_scan_channel_list  - Roam Scan channel list related
1948  * parameters
1949  * @vdev_id: Vdev id
1950  * @chan_count: Channel count
1951  * @chan_freq_list: Frequency list pointer
1952  * @chan_cache_type: Static or dynamic channel cache
1953  */
1954 struct wlan_roam_scan_channel_list {
1955 	uint32_t vdev_id;
1956 	uint8_t chan_count;
1957 	uint32_t chan_freq_list[CFG_VALID_CHANNEL_LIST_LEN];
1958 	uint8_t chan_cache_type;
1959 };
1960 
1961 /**
1962  * struct wlan_roam_rssi_change_params  - RSSI change parameters to be sent over
1963  * WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD command
1964  * @vdev_id: vdev id
1965  * only if current RSSI changes by rssi_change_thresh value.
1966  * @bcn_rssi_weight: Beacon RSSI weightage
1967  * @hirssi_delay_btw_scans: Delay between high RSSI scans
1968  * @rssi_change_thresh: RSSI change threshold. Start new rssi triggered scan
1969  */
1970 struct wlan_roam_rssi_change_params {
1971 	uint32_t vdev_id;
1972 	uint32_t bcn_rssi_weight;
1973 	uint32_t hirssi_delay_btw_scans;
1974 	int32_t rssi_change_thresh;
1975 };
1976 
1977 /**
1978  * struct wlan_cm_roam_rt_stats - Roam events stats update
1979  * @roam_stats_enabled: set 1 if roam stats feature is enabled from userspace
1980  * @roam_stats_wow_sent: set 1 if roam stats wow event is sent to FW
1981  */
1982 struct wlan_cm_roam_rt_stats {
1983 	uint8_t roam_stats_enabled;
1984 	uint8_t roam_stats_wow_sent;
1985 };
1986 
1987 /**
1988  * enum roam_rt_stats_params: different types of params to set or get roam
1989  * events stats for the vdev
1990  * @ROAM_RT_STATS_ENABLE:              Roam stats feature if enable/not
1991  * @ROAM_RT_STATS_SUSPEND_MODE_ENABLE: Roam stats wow event if sent to FW/not
1992  */
1993 enum roam_rt_stats_params {
1994 	ROAM_RT_STATS_ENABLE,
1995 	ROAM_RT_STATS_SUSPEND_MODE_ENABLE,
1996 };
1997 
1998 /**
1999  * struct wlan_roam_mlo_config - Roam MLO config parameters
2000  * @vdev_id: VDEV id
2001  * @partner_link_addr: Assigned link address which can be used as self
2002  *  link addr when vdev is not created
2003  * @support_link_num: Configure max number of link mlo connection supports.
2004  *  Invalid value or 0 will use max supported value by fw.
2005  * @support_link_band: Configure the band bitmap of mlo connection supports
2006  * The bits of the bitmap are defined by the enum reg_wifi_band
2007  * @mlo_5gl_5gh_mlsr: 5GL+5GH MLSR support
2008  */
2009 struct wlan_roam_mlo_config {
2010 	uint8_t vdev_id;
2011 	struct qdf_mac_addr partner_link_addr;
2012 	uint32_t support_link_num;
2013 	uint32_t support_link_band;
2014 	uint32_t mlo_5gl_5gh_mlsr;
2015 };
2016 
2017 /**
2018  * struct wlan_roam_start_config - structure containing parameters for
2019  * roam start config
2020  * @rssi_params: roam scan rssi threshold parameters
2021  * @beacon_miss_cnt: roam beacon miss count parameters
2022  * @bmiss_timeout: roam consecutive beaconloss timeout parameters
2023  * @reason_vsie_enable: roam reason vsie enable parameters
2024  * @roam_triggers: roam triggers parameters
2025  * @scan_period_params: roam scan period parameters
2026  * @rso_config: roam scan offload configuration
2027  * @rssi_change_params: Roam offload RSSI change parameters
2028  * @profile_params: ap profile parameters
2029  * @rso_chan_info: Roam scan channel list parameters
2030  * @mawc_params: mawc parameters
2031  * @scan_filter_params: roam scan filter parameters
2032  * @btm_config: btm configuration
2033  * @roam_11k_params: 11k params
2034  * @bss_load_config: bss load config
2035  * @disconnect_params: disconnect params
2036  * @idle_params: idle params
2037  * @wlan_roam_rt_stats_config: roam events stats config
2038  * @roam_mlo_params: roam mlo config params
2039  * @wlan_roam_ho_delay_config: roam HO delay value
2040  * @wlan_exclude_rm_partial_scan_freq: Include/exclude the channels in roam full
2041  * scan that are already scanned as part of partial scan.
2042  * @wlan_roam_full_scan_6ghz_on_disc: Include the 6 GHz channels in roam full
2043  * scan only on prior discovery of any 6 GHz support in the environment.
2044  * @wlan_roam_rssi_diff_6ghz: This value is used as to how better the RSSI of
2045  * the new/roamable 6GHz AP should be for roaming.
2046  */
2047 struct wlan_roam_start_config {
2048 	struct wlan_roam_offload_scan_rssi_params rssi_params;
2049 	struct wlan_roam_beacon_miss_cnt beacon_miss_cnt;
2050 	struct wlan_roam_bmiss_timeout bmiss_timeout;
2051 	struct wlan_roam_reason_vsie_enable reason_vsie_enable;
2052 	struct wlan_roam_triggers roam_triggers;
2053 	struct wlan_roam_scan_period_params scan_period_params;
2054 	struct wlan_roam_scan_offload_params rso_config;
2055 	struct wlan_roam_rssi_change_params rssi_change_params;
2056 	struct ap_profile_params profile_params;
2057 	struct wlan_roam_scan_channel_list rso_chan_info;
2058 	struct wlan_roam_mawc_params mawc_params;
2059 	struct wlan_roam_scan_filter_params scan_filter_params;
2060 	struct wlan_roam_btm_config btm_config;
2061 	struct wlan_roam_11k_offload_params roam_11k_params;
2062 	struct wlan_roam_bss_load_config bss_load_config;
2063 	struct wlan_roam_disconnect_params disconnect_params;
2064 	struct wlan_roam_idle_params idle_params;
2065 	uint8_t wlan_roam_rt_stats_config;
2066 	struct wlan_roam_mlo_config roam_mlo_params;
2067 	uint16_t wlan_roam_ho_delay_config;
2068 	uint8_t wlan_exclude_rm_partial_scan_freq;
2069 	uint8_t wlan_roam_full_scan_6ghz_on_disc;
2070 	uint8_t wlan_roam_rssi_diff_6ghz;
2071 	/* other wmi cmd structures */
2072 };
2073 
2074 /**
2075  * struct wlan_roam_stop_config - structure containing parameters for
2076  * roam stop
2077  * @reason: roaming reason
2078  * @middle_of_roaming: in the middle of roaming
2079  * @rso_config: Roam scan mode config
2080  * @roam_11k_params: 11k params
2081  * @btm_config: btm configuration
2082  * @scan_filter_params: roam scan filter parameters
2083  * @disconnect_params: disconnect params
2084  * @idle_params: idle params
2085  * @roam_triggers: roam triggers parameters
2086  * @rssi_params: roam scan rssi threshold parameters
2087  * @send_rso_stop_resp: send rso stop response
2088  * @start_rso_stop_timer: start rso stop timer
2089  */
2090 struct wlan_roam_stop_config {
2091 	uint8_t reason;
2092 	uint8_t middle_of_roaming;
2093 	struct wlan_roam_scan_offload_params rso_config;
2094 	struct wlan_roam_11k_offload_params roam_11k_params;
2095 	struct wlan_roam_btm_config btm_config;
2096 	struct wlan_roam_scan_filter_params scan_filter_params;
2097 	struct wlan_roam_disconnect_params disconnect_params;
2098 	struct wlan_roam_idle_params idle_params;
2099 	struct wlan_roam_triggers roam_triggers;
2100 	struct wlan_roam_offload_scan_rssi_params rssi_params;
2101 	bool send_rso_stop_resp;
2102 	bool start_rso_stop_timer;
2103 };
2104 
2105 /**
2106  * struct wlan_roam_update_config - structure containing parameters for
2107  * roam update config
2108  * @beacon_miss_cnt: roam beacon miss count parameters
2109  * @bmiss_timeout: roam scan bmiss timeout parameters
2110  * @scan_filter_params: roam scan filter parameters
2111  * @scan_period_params: roam scan period parameters
2112  * @rssi_change_params: roam scan rssi change parameters
2113  * @rso_config: roam scan mode configurations
2114  * @profile_params: ap profile parameters
2115  * @rso_chan_info: Roam scan channel list parameters
2116  * @rssi_params: roam scan rssi threshold parameters
2117  * @disconnect_params: disconnect params
2118  * @idle_params: idle params
2119  * @roam_triggers: roam triggers parameters
2120  * @wlan_roam_rt_stats_config: roam events stats config
2121  * @wlan_roam_ho_delay_config: roam HO delay value
2122  * @wlan_exclude_rm_partial_scan_freq: Include/exclude the channels in roam full
2123  * scan that are already scanned as part of partial scan.
2124  * @wlan_roam_full_scan_6ghz_on_disc: Include the 6 GHz channels in roam full
2125  * scan only on prior discovery of any 6 GHz support in the environment.
2126  * @wlan_roam_rssi_diff_6ghz: This value is used as to how better the RSSI of
2127  * the new/roamable 6GHz AP should be for roaming.
2128  */
2129 struct wlan_roam_update_config {
2130 	struct wlan_roam_beacon_miss_cnt beacon_miss_cnt;
2131 	struct wlan_roam_bmiss_timeout bmiss_timeout;
2132 	struct wlan_roam_scan_filter_params scan_filter_params;
2133 	struct wlan_roam_scan_period_params scan_period_params;
2134 	struct wlan_roam_rssi_change_params rssi_change_params;
2135 	struct wlan_roam_scan_offload_params rso_config;
2136 	struct ap_profile_params profile_params;
2137 	struct wlan_roam_scan_channel_list rso_chan_info;
2138 	struct wlan_roam_offload_scan_rssi_params rssi_params;
2139 	struct wlan_roam_disconnect_params disconnect_params;
2140 	struct wlan_roam_idle_params idle_params;
2141 	struct wlan_roam_triggers roam_triggers;
2142 	uint8_t wlan_roam_rt_stats_config;
2143 	uint16_t wlan_roam_ho_delay_config;
2144 	uint8_t wlan_exclude_rm_partial_scan_freq;
2145 	uint8_t wlan_roam_full_scan_6ghz_on_disc;
2146 	uint8_t wlan_roam_rssi_diff_6ghz;
2147 };
2148 
2149 #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD)
2150 /**
2151  * enum roam_offload_state - Roaming module state for each STA vdev.
2152  * @WLAN_ROAM_DEINIT: Roaming module is not initialized at the
2153  *  firmware.
2154  * @WLAN_ROAM_INIT: Roaming module initialized at the firmware.
2155  * @WLAN_ROAM_RSO_ENABLED: RSO enabled, firmware can roam to different AP.
2156  * @WLAN_ROAM_RSO_STOPPED: RSO stopped - roaming module is initialized at
2157  * firmware, but firmware cannot do roaming due to supplicant disabled
2158  * roaming/driver disabled roaming.
2159  * @WLAN_ROAMING_IN_PROG: Roaming started at firmware. This state is
2160  * transitioned after candidate selection is done at fw and preauth to
2161  * the AP is started.
2162  * @WLAN_ROAM_SYNCH_IN_PROG: Roaming handoff complete
2163  * @WLAN_MLO_ROAM_SYNCH_IN_PROG: MLO Roam sync is ongoing,
2164  * only used for ml links.
2165  */
2166 enum roam_offload_state {
2167 	WLAN_ROAM_DEINIT,
2168 	WLAN_ROAM_INIT,
2169 	WLAN_ROAM_RSO_ENABLED,
2170 	WLAN_ROAM_RSO_STOPPED,
2171 	WLAN_ROAMING_IN_PROG,
2172 	WLAN_ROAM_SYNCH_IN_PROG,
2173 	WLAN_MLO_ROAM_SYNCH_IN_PROG,
2174 };
2175 
2176 #define WLAN_ROAM_SCAN_CANDIDATE_AP 0
2177 #define WLAN_ROAM_SCAN_CURRENT_AP   1
2178 #define WLAN_ROAM_SCAN_ROAMED_AP    2
2179 
2180 /**
2181  *  struct roam_btm_response_data - BTM response related data
2182  *  @present:       Flag to check if the roam btm_rsp tlv is present
2183  *  @btm_status:    Btm request status
2184  *  @target_bssid:  AP MAC address
2185  *  @vsie_reason:   Vsie_reason value
2186  *  @timestamp:     This timestamp indicates the time when btm rsp is sent
2187  *  @btm_resp_dialog_token: Dialog token
2188  *  @btm_delay: BTM bss termination delay
2189  *  @is_mlo: Flag to check if the current connection is a MLO connection
2190  *  @band: Band of the link that is involved in frame exchange
2191  */
2192 struct roam_btm_response_data {
2193 	bool present;
2194 	uint32_t btm_status;
2195 	struct qdf_mac_addr target_bssid;
2196 	uint32_t vsie_reason;
2197 	uint32_t timestamp;
2198 	uint16_t btm_resp_dialog_token;
2199 	uint8_t btm_delay;
2200 	bool is_mlo;
2201 	uint8_t band;
2202 };
2203 
2204 /**
2205  *  struct roam_initial_data - Roam initial related data
2206  *  @present:                Flag to check if the roam btm_rsp tlv is present
2207  *  @roam_full_scan_count:   Roam full scan count
2208  *  @rssi_th:                RSSI threshold
2209  *  @cu_th:                  Channel utilization threshold
2210  *  @fw_cancel_timer_bitmap: FW timers, which are getting cancelled
2211  */
2212 struct roam_initial_data {
2213 	bool present;
2214 	uint32_t roam_full_scan_count;
2215 	uint32_t rssi_th;
2216 	uint32_t cu_th;
2217 	uint32_t fw_cancel_timer_bitmap;
2218 };
2219 
2220 /**
2221  * struct roam_msg_info - Roam message related information
2222  * @present:    Flag to check if the roam msg info tlv is present
2223  * @timestamp:  Timestamp is the absolute time w.r.t host timer which is
2224  * synchronized between the host and target
2225  * @msg_id:     Message ID from WMI_ROAM_MSG_ID
2226  * @msg_param1: msg_param1, values is based on the host & FW
2227  * understanding and depend on the msg ID
2228  * @msg_param2: msg_param2 value is based on the host & FW understanding
2229  * and depend on the msg ID
2230  */
2231 struct roam_msg_info {
2232 	bool present;
2233 	uint32_t timestamp;
2234 	uint32_t msg_id;
2235 	uint32_t msg_param1;
2236 	uint32_t msg_param2;
2237 };
2238 
2239 /**
2240  * struct roam_event_rt_info - Roam event related information
2241  * @roam_scan_state: roam scan state notif value
2242  * @roam_invoke_fail_reason: roam invoke fail reason
2243  */
2244 struct roam_event_rt_info {
2245 	uint32_t roam_scan_state;
2246 	uint32_t roam_invoke_fail_reason;
2247 };
2248 
2249 /**
2250  * enum roam_rt_stats_type: different types of params to get roam event stats
2251  * for the vdev
2252  * @ROAM_RT_STATS_TYPE_SCAN_STATE: Roam Scan Start/End
2253  * @ROAM_RT_STATS_TYPE_INVOKE_FAIL_REASON: One of WMI_ROAM_FAIL_REASON_ID for
2254  * roam failure in case of forced roam
2255  * @ROAM_RT_STATS_TYPE_ROAM_SCAN_INFO: Roam Trigger/Fail/Scan/AP Stats
2256  */
2257 enum roam_rt_stats_type {
2258 	ROAM_RT_STATS_TYPE_SCAN_STATE,
2259 	ROAM_RT_STATS_TYPE_INVOKE_FAIL_REASON,
2260 	ROAM_RT_STATS_TYPE_ROAM_SCAN_INFO,
2261 };
2262 
2263 /**
2264  * struct roam_frame_info  - Structure to hold the mgmt frame/eapol frame
2265  * related info exchanged during roaming.
2266  * @present:     Flag to indicate if roam frame info TLV is present
2267  * @bssid:       BSSID of the candidate AP or roamed AP to which the
2268  * frame exchange happened
2269  * @timestamp:   Fw timestamp at which the frame was Tx/Rx'ed
2270  * @type:        Frame Type
2271  * @subtype:     Frame subtype
2272  * @is_rsp:      True if frame is response frame else false
2273  * @seq_num:     Frame sequence number from the 802.11 header
2274  * @status_code: Status code from 802.11 spec, section 9.4.1.9
2275  * @auth_algo: Authentication algorithm as defined in 802.11 spec,
2276  * 9.4.1.1 Authentication Algorithm Number field
2277  * @tx_status: Frame TX status defined by enum qdf_dp_tx_rx_status
2278  * applicable only for tx frames
2279  * @rssi: Frame rssi
2280  * @retry_count: Frame retry count
2281  * @assoc_id: Association id received in the association response/
2282  * reassociation response frame
2283  * @band: Band on which the packet is transmitted or received. Refer
2284  * enum wlan_diag_wifi_band
2285  */
2286 struct roam_frame_info {
2287 	bool present;
2288 	struct qdf_mac_addr bssid;
2289 	uint32_t timestamp;
2290 	uint8_t type;
2291 	uint8_t subtype;
2292 	uint8_t is_rsp;
2293 	enum qdf_dp_tx_rx_status tx_status;
2294 	uint16_t seq_num;
2295 	uint8_t auth_algo;
2296 	uint16_t status_code;
2297 	int32_t rssi;
2298 	uint16_t retry_count;
2299 	uint16_t assoc_id;
2300 	uint8_t band;
2301 };
2302 
2303 /**
2304  * enum wlan_cm_rso_control_requestor - Driver disabled roaming requestor that
2305  * will request the roam module to disable roaming based on the mlme operation
2306  * @RSO_INVALID_REQUESTOR: invalid requestor
2307  * @RSO_START_BSS: disable roaming temporarily due to start bss
2308  * @RSO_CHANNEL_SWITCH: disable roaming due to STA channel switch
2309  * @RSO_CONNECT_START: disable roaming temporarily due to connect
2310  * @RSO_SAP_CHANNEL_CHANGE: disable roaming due to SAP channel change
2311  * @RSO_NDP_CON_ON_NDI: disable roaming due to NDP connection on NDI
2312  * @RSO_SET_PCL: Disable roaming to set pcl to firmware
2313  */
2314 enum wlan_cm_rso_control_requestor {
2315 	RSO_INVALID_REQUESTOR,
2316 	RSO_START_BSS          = BIT(0),
2317 	RSO_CHANNEL_SWITCH     = BIT(1),
2318 	RSO_CONNECT_START      = BIT(2),
2319 	RSO_SAP_CHANNEL_CHANGE = BIT(3),
2320 	RSO_NDP_CON_ON_NDI     = BIT(4),
2321 	RSO_SET_PCL            = BIT(5),
2322 };
2323 #endif
2324 
2325 /**
2326  * struct set_pcl_req - Request message to set the PCL
2327  * @vdev_id:   Vdev id
2328  * @band_mask: Supported band mask
2329  * @clear_vdev_pcl: Clear the configured vdev pcl channels
2330  * @chan_weights: PCL channel weights
2331  */
2332 struct set_pcl_req {
2333 	uint8_t vdev_id;
2334 	uint32_t band_mask;
2335 	bool clear_vdev_pcl;
2336 	struct wmi_pcl_chan_weights chan_weights;
2337 };
2338 
2339 /**
2340  * struct roam_invoke_req - roam invoke request
2341  * @vdev_id: vdev for which the roaming has to be enabled/disabled
2342  * @target_bssid: target mac address
2343  * @ch_freq: channel frequency
2344  * @frame_len: frame length, includs mac header, fixed params and ies
2345  * @frame_buf: buffer containing probe response or beacon
2346  * @is_same_bssid: flag to indicate if roaming is requested for same bssid
2347  * @forced_roaming: Roam to any bssid in any ch (here bssid & ch is not given)
2348  */
2349 struct roam_invoke_req {
2350 	uint8_t vdev_id;
2351 	struct qdf_mac_addr target_bssid;
2352 	uint32_t ch_freq;
2353 	uint32_t frame_len;
2354 	uint8_t *frame_buf;
2355 	uint8_t is_same_bssid;
2356 	bool forced_roaming;
2357 };
2358 
2359 /**
2360  * enum cm_roam_notif: roaming notification
2361  * @CM_ROAM_NOTIF_INVALID: invalid notification. Do not interpret notif field
2362  * @CM_ROAM_NOTIF_ROAM_START: indicate that roaming is started. sent only in
2363  *			      non WOW state
2364  * @CM_ROAM_NOTIF_ROAM_ABORT: indicate that roaming is aborted. sent only in
2365  *			      non WOW state
2366  * @CM_ROAM_NOTIF_ROAM_REASSOC: indicate that reassociation is done. sent only
2367  *				in non WOW state
2368  * @CM_ROAM_NOTIF_SCAN_MODE_SUCCESS: indicate that roaming scan mode is
2369  *				     successful
2370  * @CM_ROAM_NOTIF_SCAN_MODE_FAIL: indicate that roaming scan mode is failed due
2371  *				  to internal roaming state
2372  * @CM_ROAM_NOTIF_DISCONNECT: indicate that roaming not allowed due BTM req
2373  * @CM_ROAM_NOTIF_SUBNET_CHANGED: indicate that subnet has changed
2374  * @CM_ROAM_NOTIF_SCAN_START: indicate roam scan start, notif_params to be sent
2375  *			      as WMI_ROAM_TRIGGER_REASON_ID
2376  * @CM_ROAM_NOTIF_DEAUTH_RECV: indicate deauth received, notif_params to be sent
2377  *			       as reason code, notif_params1 to be sent as
2378  *			       frame length
2379  * @CM_ROAM_NOTIF_DISASSOC_RECV: indicate disassoc received, notif_params to be
2380  *				 sent as reason code, notif_params1 to be sent
2381  *				 as frame length
2382  * @CM_ROAM_NOTIF_HO_FAIL: indicates that roaming scan mode is successful but
2383  *			   caused disconnection and subsequent
2384  *			   WMI_ROAM_REASON_HO_FAILED is event expected
2385  * @CM_ROAM_NOTIF_SCAN_END: indicate roam scan end, notif_params to be sent
2386  *			    as WMI_ROAM_TRIGGER_REASON_ID
2387  */
2388 enum cm_roam_notif {
2389 	CM_ROAM_NOTIF_INVALID = 0,
2390 	CM_ROAM_NOTIF_ROAM_START,
2391 	CM_ROAM_NOTIF_ROAM_ABORT,
2392 	CM_ROAM_NOTIF_ROAM_REASSOC,
2393 	CM_ROAM_NOTIF_SCAN_MODE_SUCCESS,
2394 	CM_ROAM_NOTIF_SCAN_MODE_FAIL,
2395 	CM_ROAM_NOTIF_DISCONNECT,
2396 	CM_ROAM_NOTIF_SUBNET_CHANGED,
2397 	CM_ROAM_NOTIF_SCAN_START,
2398 	CM_ROAM_NOTIF_DEAUTH_RECV,
2399 	CM_ROAM_NOTIF_DISASSOC_RECV,
2400 	CM_ROAM_NOTIF_HO_FAIL,
2401 	CM_ROAM_NOTIF_SCAN_END,
2402 };
2403 
2404 /**
2405  * enum roam_reason: Roam reason
2406  * @ROAM_REASON_INVALID: invalid reason. Do not interpret reason field
2407  * @ROAM_REASON_BETTER_AP: found a better AP
2408  * @ROAM_REASON_BMISS: beacon miss detected
2409  * @ROAM_REASON_LOW_RSSI: connected AP's low rssi condition detected
2410  * @ROAM_REASON_SUITABLE_AP: found another AP that matches SSID and Security
2411  *  profile in WMI_ROAM_AP_PROFILE, found during scan triggered upon FINAL_BMISS
2412  * @ROAM_REASON_HO_FAILED: LFR3.0 roaming failed, indicate the disconnection
2413  *			   to host
2414  * @ROAM_REASON_INVOKE_ROAM_FAIL: Result code of WMI_ROAM_INVOKE_CMDID. Any
2415  *  roaming failure before reassociation will be indicated to host with this
2416  *  reason. Any roaming failure after reassociation will be indicated to host
2417  *  with WMI_ROAM_REASON_HO_FAILED no matter WMI_ROAM_INVOKE_CMDID is
2418  *  called or not.
2419  * @ROAM_REASON_RSO_STATUS:
2420  * @ROAM_REASON_BTM: Roaming because of BTM request received
2421  * @ROAM_REASON_DEAUTH: deauth/disassoc received
2422  */
2423 enum roam_reason {
2424 	ROAM_REASON_INVALID,
2425 	ROAM_REASON_BETTER_AP,
2426 	ROAM_REASON_BMISS,
2427 	ROAM_REASON_LOW_RSSI,
2428 	ROAM_REASON_SUITABLE_AP,
2429 	ROAM_REASON_HO_FAILED,
2430 	ROAM_REASON_INVOKE_ROAM_FAIL,
2431 	ROAM_REASON_RSO_STATUS,
2432 	ROAM_REASON_BTM,
2433 	ROAM_REASON_DEAUTH,
2434 };
2435 
2436 /*
2437  * struct roam_denylist_timeout - BTM denylist entry
2438  * @bssid: bssid that is to be denylisted
2439  * @timeout: time duration for which the bssid is denylisted
2440  * @received_time: boot timestamp at which the firmware event was received
2441  * @rssi: rssi value for which the bssid is denylisted
2442  * @reject_reason: reason to add the BSSID to DLM
2443  * @original_timeout: original timeout sent by the AP
2444  * @source: Source of adding the BSSID to DLM
2445  */
2446 struct roam_denylist_timeout {
2447 	struct qdf_mac_addr bssid;
2448 	uint32_t timeout;
2449 	qdf_time_t received_time;
2450 	int32_t rssi;
2451 	enum dlm_reject_ap_reason reject_reason;
2452 	uint32_t original_timeout;
2453 	enum dlm_reject_ap_source source;
2454 };
2455 
2456 /**
2457  * struct roam_denylist_event - Denylist event entries destination structure
2458  * @vdev_id: vdev id
2459  * @num_entries: total entries sent over the event
2460  * @roam_denylist: denylist details
2461  */
2462 struct roam_denylist_event {
2463 	uint8_t vdev_id;
2464 	uint32_t num_entries;
2465 	struct roam_denylist_timeout roam_denylist[];
2466 };
2467 
2468 /**
2469  * enum cm_vdev_disconnect_reason - Roam disconnect reason
2470  * @CM_DISCONNECT_REASON_CSA_SA_QUERY_TIMEOUT: Disconnect due to SA query
2471  *  timeout after moving to new channel due to CSA in OCV enabled case.
2472  * @CM_DISCONNECT_REASON_MOVE_TO_CELLULAR: Disconnect from WiFi to move
2473  *  to cellular
2474  */
2475 enum cm_vdev_disconnect_reason {
2476 	CM_DISCONNECT_REASON_CSA_SA_QUERY_TIMEOUT = 1,
2477 	CM_DISCONNECT_REASON_MOVE_TO_CELLULAR,
2478 };
2479 
2480 /**
2481  * struct vdev_disconnect_event_data - Roam disconnect event data
2482  * @vdev_id: vdev id
2483  * @psoc: psoc object
2484  * @reason: roam reason of type @enum cm_vdev_disconnect_reason
2485  */
2486 struct vdev_disconnect_event_data {
2487 	uint8_t vdev_id;
2488 	struct wlan_objmgr_psoc *psoc;
2489 	enum cm_vdev_disconnect_reason reason;
2490 };
2491 
2492 /**
2493  * struct cm_roam_scan_ch_resp - roam scan chan list response to userspace
2494  * @vdev_id: vdev id
2495  * @num_channels: number of roam scan channels
2496  * @command_resp: command response or async event
2497  * @chan_list: list of roam scan channels
2498  */
2499 struct cm_roam_scan_ch_resp {
2500 	uint16_t vdev_id;
2501 	uint16_t num_channels;
2502 	uint32_t command_resp;
2503 	uint32_t *chan_list;
2504 };
2505 
2506 /**
2507  * enum roam_dispatcher_events - Roam events to post to scheduler thread
2508  * @ROAM_EVENT_INVALID: Invalid event
2509  * @ROAM_PMKID_REQ_EVENT: Roam pmkid request event
2510  * @ROAM_VDEV_DISCONNECT_EVENT: Roam disconnect event
2511  */
2512 enum roam_dispatcher_events {
2513 	ROAM_EVENT_INVALID,
2514 	ROAM_PMKID_REQ_EVENT,
2515 	ROAM_VDEV_DISCONNECT_EVENT,
2516 };
2517 
2518 /**
2519  * struct roam_offload_roam_event: Data carried by roam event
2520  * @vdev_id: vdev id
2521  * @psoc: psoc object
2522  * @reason: reason for roam event of type @enum roam_reason
2523  * @rssi: associated AP's rssi calculated by FW when reason code
2524  *	  is WMI_ROAM_REASON_LOW_RSSI
2525  * @notif: roam notification
2526  * @notif_params: Contains roam invoke fail reason from wmi_roam_invoke_error_t
2527  *		  if reason is WMI_ROAM_REASON_INVOKE_ROAM_FAIL.
2528  * @notif_params1: notif_params1 is exact frame length of deauth or disassoc if
2529  *		   reason is WMI_ROAM_REASON_DEAUTH.
2530  * @hw_mode_trans_ind: HW mode transition indication
2531  * @deauth_disassoc_frame: Deauth/disassoc frame received from AP
2532  * @rso_timer_stopped: RSO timer stopped
2533  */
2534 struct roam_offload_roam_event {
2535 	uint8_t vdev_id;
2536 	struct wlan_objmgr_psoc *psoc;
2537 	enum roam_reason reason;
2538 	uint32_t rssi;
2539 	enum cm_roam_notif notif;
2540 	uint32_t notif_params;
2541 	uint32_t notif_params1;
2542 	struct cm_hw_mode_trans_ind *hw_mode_trans_ind;
2543 	uint8_t *deauth_disassoc_frame;
2544 	bool rso_timer_stopped;
2545 };
2546 
2547 /**
2548  * struct roam_frame_stats  - Roam frame stats
2549  * @num_frame: number of frames
2550  * @frame_info: Roam frame info
2551  */
2552 struct roam_frame_stats {
2553 	uint8_t num_frame;
2554 	struct roam_frame_info frame_info[WLAN_ROAM_MAX_FRAME_INFO];
2555 };
2556 
2557 /**
2558  * struct roam_stats_event - Data carried by stats event
2559  * @vdev_id: vdev id
2560  * @num_tlv: Number of roam scans triggered
2561  * @num_roam_msg_info: Number of roam_msg_info present in event
2562  * @enhance_roam_rt_event:  flag of whether we need send event for
2563  *  real time enhance roam stats info to user space
2564  * @trigger: Roam trigger related details
2565  * @scan: Roam scan event details
2566  * @result: Roam result related info
2567  * @frame_stats: Info on frame exchange during roaming
2568  * @data_11kv: Neighbor report/BTM request related data
2569  * @btm_rsp: BTM response related data
2570  * @roam_init_info: Roam initial related data
2571  * @roam_msg_info: Roam message related information
2572  * @roam_event_param: Roam event notif params
2573  */
2574 struct roam_stats_event {
2575 	uint8_t vdev_id;
2576 	uint8_t num_tlv;
2577 	uint8_t num_roam_msg_info;
2578 	bool enhance_roam_rt_event;
2579 	struct wmi_roam_trigger_info trigger[MAX_ROAM_SCAN_STATS_TLV];
2580 	struct wmi_roam_scan_data scan[MAX_ROAM_SCAN_STATS_TLV];
2581 	struct wmi_roam_result result[MAX_ROAM_SCAN_STATS_TLV];
2582 	struct roam_frame_stats frame_stats[MAX_ROAM_SCAN_STATS_TLV];
2583 	struct wmi_neighbor_report_data data_11kv[MAX_ROAM_SCAN_STATS_TLV];
2584 	struct roam_btm_response_data btm_rsp[MAX_ROAM_SCAN_STATS_TLV];
2585 	struct roam_initial_data roam_init_info[MAX_ROAM_SCAN_STATS_TLV];
2586 	struct roam_msg_info *roam_msg_info;
2587 	struct roam_event_rt_info roam_event_param;
2588 };
2589 
2590 /**
2591  * struct auth_offload_event - offload data carried by roam event
2592  * @vdev_id: vdev id
2593  * @ap_bssid: SAE authentication offload AP MAC Address
2594  * @ta: SAE authentication offload Tx MAC Address
2595  * @akm: SAE AKM type
2596  */
2597 struct auth_offload_event {
2598 	uint8_t vdev_id;
2599 	struct qdf_mac_addr ap_bssid;
2600 	struct qdf_mac_addr ta;
2601 	uint32_t akm;
2602 };
2603 
2604 /**
2605  * struct roam_pmkid_req_event - Pmkid event with entries destination structure
2606  * @vdev_id: VDEV id
2607  * @psoc: psoc object
2608  * @num_entries: total entries sent over the event
2609  * @ap_bssid: bssid list
2610  */
2611 struct roam_pmkid_req_event {
2612 	uint8_t vdev_id;
2613 	struct wlan_objmgr_psoc *psoc;
2614 	uint32_t num_entries;
2615 	struct qdf_mac_addr ap_bssid[];
2616 };
2617 
2618 /**
2619  * struct wlan_cm_roam_tx_ops  - structure of tx function pointers for
2620  * roaming related commands
2621  * @send_vdev_set_pcl_cmd: TX ops function pointer to send set vdev PCL
2622  * command
2623  * @send_roam_offload_init_req: TX Ops function pointer to send roam offload
2624  * module initialize request
2625  * @send_roam_start_req: TX ops function pointer to send roam start related
2626  * commands
2627  * @send_roam_stop_offload:
2628  * @send_roam_update_config:
2629  * @send_roam_abort: send roam abort
2630  * @send_roam_per_config:
2631  * @send_roam_triggers:
2632  * @send_roam_disable_config: send roam disable config
2633  * @send_roam_invoke_cmd:
2634  * @send_roam_sync_complete_cmd:
2635  * @send_roam_rt_stats_config: Send roam events vendor command param value to FW
2636  * @send_roam_ho_delay_config: Send roam Hand-off delay value to FW
2637  * @send_exclude_rm_partial_scan_freq: Include/exclude the channels in roam full
2638  * scan that are already scanned as part of partial scan.
2639  * @send_roam_full_scan_6ghz_on_disc: Include the 6 GHz channels in roam full
2640  * scan only on prior discovery of any 6 GHz support in the environment.
2641  * @send_roam_mcc_disallow: Send MCC disallow to FW
2642  * @send_roam_linkspeed_state: Send roam link speed good/poor state to FW
2643  * @send_roam_vendor_handoff_config: send vendor handoff config command to FW
2644  * @send_roam_mlo_config: send MLO config to FW
2645  * @send_roam_scan_offload_rssi_params: Set the RSSI parameters for roam
2646  * offload scan
2647  * @send_roam_frequencies: send roam frequencies to FW
2648  */
2649 struct wlan_cm_roam_tx_ops {
2650 	QDF_STATUS (*send_vdev_set_pcl_cmd)(struct wlan_objmgr_vdev *vdev,
2651 					    struct set_pcl_req *req);
2652 	QDF_STATUS (*send_roam_offload_init_req)(
2653 			struct wlan_objmgr_vdev *vdev,
2654 			struct wlan_roam_offload_init_params *params);
2655 
2656 	QDF_STATUS (*send_roam_start_req)(struct wlan_objmgr_vdev *vdev,
2657 					  struct wlan_roam_start_config *req);
2658 	QDF_STATUS (*send_roam_stop_offload)(struct wlan_objmgr_vdev *vdev,
2659 					     struct wlan_roam_stop_config *req);
2660 	QDF_STATUS (*send_roam_update_config)(
2661 				struct wlan_objmgr_vdev *vdev,
2662 				struct wlan_roam_update_config *req);
2663 	QDF_STATUS (*send_roam_abort)(struct wlan_objmgr_vdev *vdev,
2664 				      uint8_t vdev_id);
2665 	QDF_STATUS (*send_roam_per_config)(
2666 				struct wlan_objmgr_vdev *vdev,
2667 				struct wlan_per_roam_config_req *req);
2668 	QDF_STATUS (*send_roam_triggers)(struct wlan_objmgr_vdev *vdev,
2669 					 struct wlan_roam_triggers *req);
2670 	QDF_STATUS (*send_roam_disable_config)(struct wlan_objmgr_vdev *vdev,
2671 				struct roam_disable_cfg *req);
2672 	QDF_STATUS (*send_roam_invoke_cmd)(struct wlan_objmgr_vdev *vdev,
2673 					   struct roam_invoke_req *req);
2674 	QDF_STATUS (*send_roam_sync_complete_cmd)(struct wlan_objmgr_vdev *vdev);
2675 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
2676 	QDF_STATUS (*send_roam_rt_stats_config)(struct wlan_objmgr_vdev *vdev,
2677 						uint8_t vdev_id, uint8_t value);
2678 	QDF_STATUS (*send_roam_ho_delay_config)(struct wlan_objmgr_vdev *vdev,
2679 						uint8_t vdev_id,
2680 						uint16_t value);
2681 	QDF_STATUS (*send_exclude_rm_partial_scan_freq)(
2682 						struct wlan_objmgr_vdev *vdev,
2683 						uint8_t value);
2684 	QDF_STATUS (*send_roam_full_scan_6ghz_on_disc)(
2685 						struct wlan_objmgr_vdev *vdev,
2686 						uint8_t value);
2687 	QDF_STATUS (*send_roam_mcc_disallow)(struct wlan_objmgr_vdev *vdev,
2688 					     uint8_t vdev_id, uint8_t value);
2689 	QDF_STATUS (*send_roam_scan_offload_rssi_params)(
2690 		struct wlan_objmgr_vdev *vdev,
2691 		struct wlan_roam_offload_scan_rssi_params *roam_rssi_params);
2692 #ifdef FEATURE_RX_LINKSPEED_ROAM_TRIGGER
2693 	QDF_STATUS (*send_roam_linkspeed_state)(struct wlan_objmgr_vdev *vdev,
2694 						uint8_t vdev_id, bool value);
2695 #endif
2696 #endif
2697 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
2698 	QDF_STATUS (*send_roam_vendor_handoff_config)(
2699 					struct wlan_objmgr_vdev *vdev,
2700 					uint8_t vdev_id, uint32_t param_id);
2701 #endif
2702 #ifdef WLAN_FEATURE_11BE_MLO
2703 	QDF_STATUS (*send_roam_mlo_config)(struct wlan_objmgr_vdev *vdev,
2704 					   struct wlan_roam_mlo_config *req);
2705 #endif
2706 	QDF_STATUS (*send_roam_frequencies)(
2707 			struct wlan_objmgr_vdev *vdev,
2708 			struct wlan_roam_scan_channel_list *rso_ch_info);
2709 };
2710 
2711 /**
2712  * enum roam_scan_freq_scheme - Scan mode for triggering roam
2713  * @ROAM_SCAN_FREQ_SCHEME_NO_SCAN: Indicates the fw to not scan.
2714  * @ROAM_SCAN_FREQ_SCHEME_PARTIAL_SCAN: Indicates the firmware to
2715  * trigger partial frequency scans.
2716  * @ROAM_SCAN_FREQ_SCHEME_FULL_SCAN: Indicates the firmware to
2717  * trigger full frequency scans.
2718  * @ROAM_SCAN_FREQ_SCHEME_NONE: Invalid scan mode
2719  */
2720 enum roam_scan_freq_scheme {
2721 	ROAM_SCAN_FREQ_SCHEME_NO_SCAN = 0,
2722 	ROAM_SCAN_FREQ_SCHEME_PARTIAL_SCAN = 1,
2723 	ROAM_SCAN_FREQ_SCHEME_FULL_SCAN = 2,
2724 	ROAM_SCAN_FREQ_SCHEME_NONE = 3,
2725 };
2726 
2727 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
2728 /**
2729  * struct wlan_cm_vendor_handoff_param - vendor handoff configuration
2730  * structure
2731  * @vendor_handoff_context: vendor handoff context
2732  * @req_in_progress: to check whether vendor handoff request in progress or not
2733  */
2734 struct wlan_cm_vendor_handoff_param {
2735 	void *vendor_handoff_context;
2736 	bool req_in_progress;
2737 };
2738 #endif
2739 
2740 /**
2741  * struct sae_offload_params - SAE roam auth offload related params
2742  * @ssid: SSID of the roam candidate
2743  * @bssid: BSSID of the roam candidate
2744  */
2745 struct sae_offload_params {
2746 	struct wlan_ssid ssid;
2747 	struct qdf_mac_addr bssid;
2748 };
2749 
2750 /**
2751  * struct wlan_cm_roam  - Connection manager roam configs, state and roam
2752  * data related structure
2753  * @pcl_vdev_cmd_active:  Flag to check if vdev level pcl command needs to be
2754  * sent or PDEV level PCL command needs to be sent
2755  * @vendor_handoff_param: vendor handoff params
2756  * @sae_offload: SAE roam offload related params
2757  */
2758 struct wlan_cm_roam {
2759 	bool pcl_vdev_cmd_active;
2760 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
2761 	struct wlan_cm_vendor_handoff_param vendor_handoff_param;
2762 #endif
2763 	struct sae_offload_params sae_offload;
2764 };
2765 
2766 /**
2767  * struct cm_roam_values_copy  - Structure for values copy buffer
2768  * @uint_value: Unsigned integer value to be copied
2769  * @int_value: Integer value
2770  * @bool_value: boolean value
2771  * @chan_info: chan info
2772  */
2773 struct cm_roam_values_copy {
2774 	uint32_t uint_value;
2775 	int32_t int_value;
2776 	bool bool_value;
2777 	struct rso_chan_info chan_info;
2778 };
2779 
2780 #ifdef FEATURE_LFR_SUBNET_DETECTION
2781 /* bit-4 and bit-5 indicate the subnet status */
2782 #define CM_GET_SUBNET_STATUS(roam_reason) (((roam_reason) & 0x30) >> 4)
2783 #else
2784 #define CM_GET_SUBNET_STATUS(roam_reason) (0)
2785 #endif
2786 
2787 /* This should not be greater than MAX_NUMBER_OF_CONC_CONNECTIONS */
2788 #define MAX_VDEV_SUPPORTED 4
2789 #define MAX_PN_LEN 8
2790 #define MAX_KEY_LEN 32
2791 
2792 /* MAX_FREQ_RANGE_NUM shouldn't exceed as only in case of SBS there will be 3
2793  * frequency ranges, For DBS, it will be 2. For SMM, it will be 1
2794  */
2795 #define MAX_FREQ_RANGE_NUM 3
2796 
2797 /**
2798  * struct cm_ho_fail_ind - ho fail indication to CM
2799  * @vdev_id: vdev id
2800  * @psoc: psoc object
2801  * @bssid: bssid addr
2802  */
2803 struct cm_ho_fail_ind {
2804 	uint8_t vdev_id;
2805 	struct wlan_objmgr_psoc *psoc;
2806 	struct qdf_mac_addr bssid;
2807 };
2808 
2809 /**
2810  * struct policy_mgr_vdev_mac_map - vdev id-mac id map
2811  * @vdev_id: VDEV id
2812  * @mac_id: MAC id
2813  */
2814 struct policy_mgr_vdev_mac_map {
2815 	uint32_t vdev_id;
2816 	uint32_t mac_id;
2817 };
2818 
2819 /**
2820  * struct policy_mgr_pdev_mac_freq_map - vdev id-mac id map
2821  * @mac_id: mac_id mapped to pdev id (macros starting with WMI_PDEV_ID_)
2822  * @start_freq: Start Frequency in Mhz
2823  * @end_freq: End Frequency in Mhz
2824  */
2825 struct policy_mgr_pdev_mac_freq_map {
2826 	uint32_t mac_id;
2827 	qdf_freq_t start_freq;
2828 	qdf_freq_t end_freq;
2829 };
2830 
2831 /**
2832  * struct cm_hw_mode_trans_ind - HW mode transition indication
2833  * @old_hw_mode_index: Index of old HW mode
2834  * @new_hw_mode_index: Index of new HW mode
2835  * @num_vdev_mac_entries: Number of vdev-mac id entries
2836  * @vdev_mac_map: vdev id-mac id map
2837  * @num_freq_map: Number of frequency map entries
2838  * @mac_freq_map: Frequency range map
2839  */
2840 struct cm_hw_mode_trans_ind {
2841 	uint32_t old_hw_mode_index;
2842 	uint32_t new_hw_mode_index;
2843 	uint32_t num_vdev_mac_entries;
2844 	struct policy_mgr_vdev_mac_map vdev_mac_map[MAX_VDEV_SUPPORTED];
2845 	uint32_t num_freq_map;
2846 	struct policy_mgr_pdev_mac_freq_map mac_freq_map[MAX_FREQ_RANGE_NUM];
2847 };
2848 
2849 /* If link is disabled, during roam sync */
2850 #define CM_ROAM_LINK_FLAG_DISABLE    0x1
2851 
2852 /**
2853  * struct ml_setup_link_param - MLO setup link param
2854  * @vdev_id: vdev id of the link
2855  * @link_id: link id of the link
2856  * @channel: wmi channel
2857  * @flags: link flags
2858  * @link_addr: link mac address
2859  * @self_link_addr: VDEV link mac address
2860  */
2861 struct ml_setup_link_param {
2862 	uint32_t vdev_id;
2863 	uint32_t link_id;
2864 	wmi_channel channel;
2865 	uint32_t flags;
2866 	struct qdf_mac_addr link_addr;
2867 	struct qdf_mac_addr self_link_addr;
2868 };
2869 
2870 /**
2871  * struct ml_key_material_param - MLO key material param
2872  * @link_id: key is for which link, when link_id is 0xf,
2873  * means the key is used for all links, like PTK
2874  * @key_idx: key idx
2875  * @key_cipher: key cipher
2876  * @pn: pn
2877  * @key_buff: key buffer
2878  */
2879 struct ml_key_material_param {
2880 	uint32_t link_id;
2881 	uint32_t key_idx;
2882 	uint32_t key_cipher;
2883 	uint8_t pn[MAX_PN_LEN];
2884 	uint8_t key_buff[MAX_KEY_LEN];
2885 };
2886 
2887 struct roam_offload_synch_ind {
2888 	uint16_t beacon_probe_resp_offset;
2889 	uint16_t beacon_probe_resp_length;
2890 	uint16_t reassoc_resp_offset;
2891 	uint16_t reassoc_resp_length;
2892 	uint16_t reassoc_req_offset;
2893 	uint16_t reassoc_req_length;
2894 	uint8_t is_beacon;
2895 	uint8_t roamed_vdev_id;
2896 	struct qdf_mac_addr bssid;
2897 	struct wlan_ssid ssid;
2898 	int8_t tx_mgmt_power;
2899 	uint32_t auth_status;
2900 	int8_t rssi;
2901 	uint8_t roam_reason;
2902 	uint32_t chan_freq;
2903 	uint8_t kck[MAX_KCK_LEN];
2904 	uint8_t kck_len;
2905 	uint32_t kek_len;
2906 	uint8_t kek[MAX_KEK_LENGTH];
2907 	uint32_t   pmk_len;
2908 	uint8_t    pmk[MAX_PMK_LEN];
2909 	uint8_t    pmkid[PMKID_LEN];
2910 	bool update_erp_next_seq_num;
2911 	uint16_t next_erp_seq_num;
2912 	uint8_t replay_ctr[REPLAY_CTR_LEN];
2913 	void *add_bss_params;
2914 	enum phy_ch_width chan_width;
2915 	uint32_t max_rate_flags;
2916 	uint32_t ric_data_len;
2917 #ifdef FEATURE_WLAN_ESE
2918 	uint32_t tspec_len;
2919 #endif
2920 	uint8_t *ric_tspec_data;
2921 	uint16_t aid;
2922 	bool hw_mode_trans_present;
2923 	struct cm_hw_mode_trans_ind hw_mode_trans_ind;
2924 	uint8_t nss;
2925 	struct qdf_mac_addr dst_mac;
2926 	struct qdf_mac_addr src_mac;
2927 	uint16_t hlp_data_len;
2928 	uint8_t hlp_data[FILS_MAX_HLP_DATA_LEN];
2929 	bool is_ft_im_roam;
2930 	uint8_t is_assoc;
2931 	enum wlan_phymode phy_mode; /*phy mode sent by fw */
2932 	wmi_channel chan;
2933 	uint16_t link_beacon_probe_resp_offset;
2934 	uint16_t link_beacon_probe_resp_length;
2935 	uint8_t is_link_beacon;
2936 #ifdef WLAN_FEATURE_11BE_MLO
2937 	uint8_t num_setup_links;
2938 	struct ml_setup_link_param ml_link[WLAN_MAX_ML_BSS_LINKS];
2939 	uint8_t num_ml_key_material;
2940 	struct ml_key_material_param ml_key[WLAN_MAX_ML_BSS_LINKS];
2941 #endif
2942 };
2943 
2944 /**
2945  * struct roam_scan_candidate_frame Roam candidate scan entry
2946  * @vdev_id : vdev id
2947  * @frame_length : Length of the beacon/probe rsp frame
2948  * @frame : Pointer to the frame
2949  * @rssi: RSSI of the received frame, 0 if not available
2950  * @roam_offload_candidate_frm: Is a roam offload candidate frame
2951  */
2952 struct roam_scan_candidate_frame {
2953 	uint8_t vdev_id;
2954 	uint32_t frame_length;
2955 	uint8_t *frame;
2956 	int32_t rssi;
2957 	bool roam_offload_candidate_frm;
2958 };
2959 
2960 /**
2961  * struct wlan_cm_roam_rx_ops  - structure of rx function pointers for
2962  * roaming related commands
2963  * @roam_sync_event: RX ops function pointer for roam sync event
2964  * @roam_sync_frame_event: Rx ops function pointer for roam sync frame event
2965  * @roam_sync_key_event: Rx ops function pointer for roam sych key event
2966  * @roam_event_rx: Rx ops function pointer for roam info event
2967  * @btm_denylist_event: Rx ops function pointer for btm denylist event
2968  * @vdev_disconnect_event: Rx ops function pointer for vdev disconnect event
2969  * @roam_scan_chan_list_event: Rx ops function pointer for roam scan ch event
2970  * @roam_stats_event_rx: Rx ops function pointer for roam stats event
2971  * @roam_auth_offload_event: Rx ops function pointer for auth offload event
2972  * @roam_pmkid_request_event_rx: Rx ops function pointer for roam pmkid event
2973  * @roam_candidate_frame_event : Rx ops function pointer for roam frame event
2974  * @roam_vendor_handoff_event: Rx ops function pointer for vendor handoff event
2975  */
2976 struct wlan_cm_roam_rx_ops {
2977 	QDF_STATUS (*roam_sync_event)(struct wlan_objmgr_psoc *psoc,
2978 				      uint8_t *event,
2979 				      uint32_t len,
2980 				      struct roam_offload_synch_ind *sync_ind);
2981 	QDF_STATUS (*roam_sync_frame_event)(struct wlan_objmgr_psoc *psoc,
2982 					    struct roam_synch_frame_ind *frm);
2983 	QDF_STATUS (*roam_sync_key_event)(struct wlan_objmgr_psoc *psoc,
2984 					  struct wlan_crypto_key_entry *keys,
2985 					  uint8_t num_keys);
2986 	QDF_STATUS (*roam_event_rx)(struct roam_offload_roam_event *roam_event);
2987 	QDF_STATUS (*btm_denylist_event)(struct wlan_objmgr_psoc *psoc,
2988 					 struct roam_denylist_event *list);
2989 	QDF_STATUS
2990 	(*vdev_disconnect_event)(struct vdev_disconnect_event_data *data);
2991 	QDF_STATUS
2992 	(*roam_scan_chan_list_event)(struct cm_roam_scan_ch_resp *data);
2993 	QDF_STATUS
2994 	(*roam_stats_event_rx)(struct wlan_objmgr_psoc *psoc,
2995 			       struct roam_stats_event *stats_info);
2996 	QDF_STATUS
2997 	(*roam_auth_offload_event)(struct auth_offload_event *auth_event);
2998 	QDF_STATUS
2999 	(*roam_pmkid_request_event_rx)(struct roam_pmkid_req_event *list);
3000 	QDF_STATUS
3001 	(*roam_candidate_frame_event)(struct wlan_objmgr_psoc *psoc,
3002 				      struct roam_scan_candidate_frame *frame);
3003 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
3004 	void
3005 	(*roam_vendor_handoff_event)(struct wlan_objmgr_psoc *psoc,
3006 				     struct roam_vendor_handoff_params *data);
3007 #endif
3008 };
3009 #endif
3010