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