1  /*
2   * Copyright (c) 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: wlan_cm_roam_logging.c
20   *
21   * Implementation for the Connect/roaming logging.
22   */
23  
24  #ifndef _WLAN_CONNECTIVITY_LOGGING_H_
25  #define _WLAN_CONNECTIVITY_LOGGING_H_
26  
27  #include "wlan_logging_sock_svc.h"
28  #include "wlan_cm_roam_public_struct.h"
29  #include "wlan_mlo_mgr_public_structs.h"
30  
31  #define WLAN_MAX_LOGGING_FREQ 120
32  
33  /**
34   * enum wlan_main_tag  - Main Tag used in logging
35   * @WLAN_CONNECTING: Connecting
36   * @WLAN_CONNECTING_FAIL: Connection failure
37   * @WLAN_AUTH_REQ: Authentication request frame
38   * @WLAN_AUTH_RESP: Authentication response frame
39   * @WLAN_ASSOC_REQ: Association request frame
40   * @WLAN_ASSOC_RSP: Association response frame
41   * @WLAN_REASSOC_REQ: Reassociation request frame
42   * @WLAN_REASSOC_RSP: Reassociation response frame
43   * @WLAN_DEAUTH_RX: Deauthentication frame received
44   * @WLAN_DEAUTH_TX: Deauthentication frame sent
45   * @WLAN_DISASSOC_RX: Disassociation frame received
46   * @WLAN_DISASSOC_TX: Disassociation frame sent
47   * @WLAN_DISCONN_BMISS: Disconnection due to beacon miss
48   * @WLAN_ROAM_SCAN_START: ROAM scan start
49   * @WLAN_ROAM_SCAN_DONE: Roam scan done
50   * @WLAN_ROAM_SCORE_CURR_AP: Roam score current AP
51   * @WLAN_ROAM_SCORE_CAND_AP: Roam Score Candidate AP
52   * @WLAN_ROAM_RESULT: Roam Result
53   * @WLAN_ROAM_CANCEL: Roam Cancel
54   * @WLAN_BTM_REQ:  BTM request
55   * @WLAN_BTM_QUERY: BTM Query frame
56   * @WLAN_BTM_RESP: BTM response frame
57   * @WLAN_BTM_REQ_CANDI: BTM request candidate info
58   * @WLAN_ROAM_WTC: ROAM WTC trigger logs
59   * @WLAN_DHCP_DISCOVER: DHCP discover frame
60   * @WLAN_DHCP_OFFER: DHCP offer frame
61   * @WLAN_DHCP_REQUEST: DHCP Request frame
62   * @WLAN_DHCP_ACK: DHCP ACK
63   * @WLAN_DHCP_NACK: DHCP NACK
64   * @WLAN_EAPOL_M1: EAPOL M1
65   * @WLAN_EAPOL_M2: EAPOL M2
66   * @WLAN_EAPOL_M3: EAPOL M3
67   * @WLAN_EAPOL_M4: EAPOL M4
68   * @WLAN_GTK_M1: GTK rekey M1 frame
69   * @WLAN_GTK_M2: GTK Rekey M2 frame
70   * @WLAN_EAP_REQUEST: EAP request frame
71   * @WLAN_EAP_RESPONSE: EAP response frame
72   * @WLAN_EAP_SUCCESS: EAP success
73   * @WLAN_EAP_FAILURE: EAP failure
74   * @WLAN_CUSTOM_LOG: Additional WLAN logs
75   * @WLAN_TAG_MAX: MAX tag
76   */
77  enum wlan_main_tag {
78  	WLAN_CONNECTING,
79  	WLAN_CONNECTING_FAIL,
80  	WLAN_AUTH_REQ,
81  	WLAN_AUTH_RESP,
82  	WLAN_ASSOC_REQ,
83  	WLAN_ASSOC_RSP,
84  	WLAN_REASSOC_REQ,
85  	WLAN_REASSOC_RSP,
86  	WLAN_DEAUTH_RX,
87  	WLAN_DEAUTH_TX,
88  	WLAN_DISASSOC_RX,
89  	WLAN_DISASSOC_TX,
90  	WLAN_DISCONN_BMISS,
91  	WLAN_ROAM_SCAN_START,
92  	WLAN_ROAM_SCAN_DONE,
93  	WLAN_ROAM_SCORE_CURR_AP,
94  	WLAN_ROAM_SCORE_CAND_AP,
95  	WLAN_ROAM_RESULT,
96  	WLAN_ROAM_CANCEL,
97  	WLAN_BTM_REQ,
98  	WLAN_BTM_QUERY,
99  	WLAN_BTM_RESP,
100  	WLAN_BTM_REQ_CANDI,
101  	WLAN_ROAM_WTC,
102  	WLAN_DHCP_DISCOVER,
103  	WLAN_DHCP_OFFER,
104  	WLAN_DHCP_REQUEST,
105  	WLAN_DHCP_ACK,
106  	WLAN_DHCP_NACK,
107  	WLAN_EAPOL_M1,
108  	WLAN_EAPOL_M2,
109  	WLAN_EAPOL_M3,
110  	WLAN_EAPOL_M4,
111  	WLAN_GTK_M1,
112  	WLAN_GTK_M2,
113  	WLAN_EAP_REQUEST,
114  	WLAN_EAP_RESPONSE,
115  	WLAN_EAP_SUCCESS,
116  	WLAN_EAP_FAILURE,
117  	WLAN_CUSTOM_LOG,
118  	/* Keep at last */
119  	WLAN_TAG_MAX,
120  };
121  
122  /**
123   * enum qca_conn_diag_log_event_type  - Diag Event subtype used in logging
124   * @WLAN_CONN_DIAG_CONNECTING_EVENT: Connecting
125   * @WLAN_CONN_DIAG_CONNECT_FAIL_EVENT: Connection failure
126   * @WLAN_CONN_DIAG_AUTH_REQ_EVENT: Authentication request frame
127   * @WLAN_CONN_DIAG_AUTH_RESP_EVENT: Authentication response frame
128   * @WLAN_CONN_DIAG_ASSOC_REQ_EVENT: Association request frame
129   * @WLAN_CONN_DIAG_ASSOC_RESP_EVENT: Association response frame
130   * @WLAN_CONN_DIAG_REASSOC_REQ_EVENT: Reassociation request frame
131   * @WLAN_CONN_DIAG_REASSOC_RESP_EVENT: Reassociation response frame
132   * @WLAN_CONN_DIAG_DEAUTH_RX_EVENT: Deauthentication frame received
133   * @WLAN_CONN_DIAG_DEAUTH_TX_EVENT: Deauthentication frame sent
134   * @WLAN_CONN_DIAG_DISASSOC_RX_EVENT: Disassociation frame received
135   * @WLAN_CONN_DIAG_DISASSOC_TX_EVENT: Disassociation frame sent
136   * @WLAN_CONN_DIAG_BMISS_EVENT: Disconnection due to beacon miss
137   * @WLAN_CONN_DIAG_ROAM_SCAN_START_EVENT: ROAM scan start
138   * @WLAN_CONN_DIAG_ROAM_SCAN_DONE_EVENT: Roam scan done
139   * @WLAN_CONN_DIAG_ROAM_SCORE_CUR_AP_EVENT: Roam score current AP
140   * @WLAN_CONN_DIAG_ROAM_SCORE_CAND_AP_EVENT: Roam Score Candidate AP
141   * @WLAN_CONN_DIAG_ROAM_RESULT_EVENT: Roam Result
142   * @WLAN_CONN_DIAG_ROAM_CANCEL_EVENT: Roam Cancel
143   * @WLAN_CONN_DIAG_BTM_REQ_EVENT:  BTM request
144   * @WLAN_CONN_DIAG_BTM_QUERY_EVENT: BTM Query frame
145   * @WLAN_CONN_DIAG_BTM_RESP_EVENT: BTM response frame
146   * @WLAN_CONN_DIAG_BTM_REQ_CAND_EVENT: BTM request candidate info
147   * @WLAN_CONN_DIAG_BTM_WTC_EVENT: ROAM WTC trigger logs
148   * @WLAN_CONN_DIAG_DHCP_DISC_EVENT: DHCP discover frame
149   * @WLAN_CONN_DIAG_DHCP_OFFER_EVENT: DHCP offer frame
150   * @WLAN_CONN_DIAG_DHCP_REQUEST_EVENT: DHCP Request frame
151   * @WLAN_CONN_DIAG_DHCP_ACK_EVENT: DHCP ACK
152   * @WLAN_CONN_DIAG_DHCP_NACK_EVENT: DHCP NACK
153   * @WLAN_CONN_DIAG_EAPOL_M1_EVENT: EAPOL M1
154   * @WLAN_CONN_DIAG_EAPOL_M2_EVENT: EAPOL M2
155   * @WLAN_CONN_DIAG_EAPOL_M3_EVENT: EAPOL M3
156   * @WLAN_CONN_DIAG_EAPOL_M4_EVENT: EAPOL M4
157   * @WLAN_CONN_DIAG_GTK_M1_EVENT: GTK rekey M1 frame
158   * @WLAN_CONN_DIAG_GTK_M2_EVENT: GTK Rekey M2 frame
159   * @WLAN_CONN_DIAG_EAP_REQ_EVENT: EAP request frame
160   * @WLAN_CONN_DIAG_EAP_RESP_EVENT: EAP response frame
161   * @WLAN_CONN_DIAG_EAP_SUCC_EVENT: EAP success
162   * @WLAN_CONN_DIAG_EAP_FAIL_EVENT: EAP failure
163   * @WLAN_CONN_DIAG_CUSTOM_EVENT: Additional WLAN logs
164   * @WLAN_CONN_DIAG_EAP_START_EVENT: EAPOL start frame
165   * @WLAN_CONN_DIAG_NBR_RPT_REQ_EVENT: Neighbor report request
166   * @WLAN_CONN_DIAG_NBR_RPT_RESP_EVENT: Neighbor report response
167   * @WLAN_CONN_DIAG_BCN_RPT_REQ_EVENT: Beacon report request
168   * @WLAN_CONN_DIAG_BCN_RPT_RESP_EVENT: Beacon report response
169   * @WLAN_CONN_DIAG_MLO_T2LM_REQ_EVENT: MLO T2LM request
170   * @WLAN_CONN_DIAG_MLO_T2LM_RESP_EVENT: MLO T2LM response
171   * @WLAN_CONN_DIAG_BTM_BLOCK_EVENT: BTM-drop indication
172   * @WLAN_CONN_DIAG_MAX: MAX tag
173   */
174  enum qca_conn_diag_log_event_type {
175  	WLAN_CONN_DIAG_CONNECTING_EVENT = 0,
176  	WLAN_CONN_DIAG_CONNECT_FAIL_EVENT,
177  	WLAN_CONN_DIAG_AUTH_REQ_EVENT,
178  	WLAN_CONN_DIAG_AUTH_RESP_EVENT,
179  	WLAN_CONN_DIAG_ASSOC_REQ_EVENT,
180  	WLAN_CONN_DIAG_ASSOC_RESP_EVENT,
181  	WLAN_CONN_DIAG_REASSOC_REQ_EVENT,
182  	WLAN_CONN_DIAG_REASSOC_RESP_EVENT,
183  	WLAN_CONN_DIAG_DEAUTH_RX_EVENT,
184  	WLAN_CONN_DIAG_DEAUTH_TX_EVENT,
185  	WLAN_CONN_DIAG_DISASSOC_RX_EVENT,
186  	WLAN_CONN_DIAG_DISASSOC_TX_EVENT,
187  	WLAN_CONN_DIAG_BMISS_EVENT,
188  	WLAN_CONN_DIAG_ROAM_SCAN_START_EVENT,
189  	WLAN_CONN_DIAG_ROAM_SCAN_DONE_EVENT,
190  	WLAN_CONN_DIAG_ROAM_SCORE_CUR_AP_EVENT,
191  	WLAN_CONN_DIAG_ROAM_SCORE_CAND_AP_EVENT,
192  	WLAN_CONN_DIAG_ROAM_RESULT_EVENT,
193  	WLAN_CONN_DIAG_ROAM_CANCEL_EVENT,
194  	WLAN_CONN_DIAG_BTM_REQ_EVENT,
195  	WLAN_CONN_DIAG_BTM_QUERY_EVENT,
196  	WLAN_CONN_DIAG_BTM_RESP_EVENT,
197  	WLAN_CONN_DIAG_BTM_REQ_CAND_EVENT,
198  	WLAN_CONN_DIAG_BTM_WTC_EVENT,
199  	WLAN_CONN_DIAG_DHCP_DISC_EVENT,
200  	WLAN_CONN_DIAG_DHCP_OFFER_EVENT,
201  	WLAN_CONN_DIAG_DHCP_REQUEST_EVENT,
202  	WLAN_CONN_DIAG_DHCP_ACK_EVENT,
203  	WLAN_CONN_DIAG_DHCP_NACK_EVENT,
204  	WLAN_CONN_DIAG_EAPOL_M1_EVENT,
205  	WLAN_CONN_DIAG_EAPOL_M2_EVENT,
206  	WLAN_CONN_DIAG_EAPOL_M3_EVENT,
207  	WLAN_CONN_DIAG_EAPOL_M4_EVENT,
208  	WLAN_CONN_DIAG_GTK_M1_EVENT,
209  	WLAN_CONN_DIAG_GTK_M2_EVENT,
210  	WLAN_CONN_DIAG_EAP_REQ_EVENT,
211  	WLAN_CONN_DIAG_EAP_RESP_EVENT,
212  	WLAN_CONN_DIAG_EAP_SUCC_EVENT,
213  	WLAN_CONN_DIAG_EAP_FAIL_EVENT,
214  	WLAN_CONN_DIAG_CUSTOM_EVENT,
215  	WLAN_CONN_DIAG_EAP_START_EVENT,
216  	WLAN_CONN_DIAG_NBR_RPT_REQ_EVENT,
217  	WLAN_CONN_DIAG_NBR_RPT_RESP_EVENT,
218  	WLAN_CONN_DIAG_BCN_RPT_REQ_EVENT,
219  	WLAN_CONN_DIAG_BCN_RPT_RESP_EVENT,
220  	WLAN_CONN_DIAG_MLO_T2LM_REQ_EVENT,
221  	WLAN_CONN_DIAG_MLO_T2LM_RESP_EVENT,
222  	WLAN_CONN_DIAG_BTM_BLOCK_EVENT,
223  	WLAN_CONN_DIAG_MAX
224  };
225  
226  /*
227   * enum wlan_diag_wifi_band - Enum describing wifi band
228   * @WLAN_INVALID_BAND: invalid band
229   * @WLAN_24GHZ_BAND: 2.4 GHz band
230   * @WLAN_5GHZ_BAND: 5 GHz band
231   * @WLAN_6GHZ_BAND: 6 GHz band
232   */
233  enum wlan_diag_wifi_band {
234  	WLAN_INVALID_BAND = 0,
235  	WLAN_24GHZ_BAND,
236  	WLAN_5GHZ_BAND,
237  	WLAN_6GHZ_BAND,
238  };
239  
240  /**
241   * enum wlan_diag_mlo_link_switch_reason - MLO link switch reason enumeration
242   * @LINK_STATE_SWITCH_REASON_VDEV_READY: Link switch when vdev is ready
243   * @LINK_STATE_SWITCH_REASON_ULL_MODE: Link switch due to ULL mode configuration
244   * @LINK_STATE_SWITCH_REASON_T2LM_ENABLE: Link switch due to T2LM enable
245   * @LINK_STATE_SWITCH_REASON_T2LM_DISABLE: Link switch due T2LM disable
246   * @LINK_STATE_SWITCH_REASON_FORCE_ENABLED: Link switch when link is
247   * forcibly enable
248   * @LINK_STATE_SWITCH_REASON_FORCE_DISABLED: Link switch when link is
249   * forcibly disable
250   * @LINK_STATE_SWITCH_REASON_LINK_QUALITY: Link switch due to
251   * poor link quality
252   * @LINK_STATE_SWITCH_REASON_LINK_CAPACITY: Link switch due to link capacity
253   * @LINK_STATE_SWITCH_REASON_RSSI: Link switch due to changes in rssi
254   * @LINK_STATE_SWITCH_REASON_BMISS: Link switch due to BMISS
255   * @LINK_STATE_SWITCH_REASON_BT_STATUS: Link switch due to BT status
256   * @LINK_STATE_SWITCH_REASON_MAX: Max value
257   */
258  enum wlan_diag_mlo_link_switch_reason {
259  	LINK_STATE_SWITCH_REASON_VDEV_READY = 0,
260  	LINK_STATE_SWITCH_REASON_ULL_MODE = 1,
261  	LINK_STATE_SWITCH_REASON_T2LM_ENABLE = 2,
262  	LINK_STATE_SWITCH_REASON_T2LM_DISABLE = 3,
263  	LINK_STATE_SWITCH_REASON_FORCE_ENABLED = 4,
264  	LINK_STATE_SWITCH_REASON_FORCE_DISABLED = 5,
265  	LINK_STATE_SWITCH_REASON_LINK_QUALITY = 6,
266  	LINK_STATE_SWITCH_REASON_LINK_CAPACITY = 7,
267  	LINK_STATE_SWITCH_REASON_RSSI = 8,
268  	LINK_STATE_SWITCH_REASON_BMISS = 9,
269  	LINK_STATE_SWITCH_REASON_BT_STATUS = 10,
270  	LINK_STATE_SWITCH_REASON_MAX,
271  };
272  
273  /**
274   * enum wlan_bcn_rpt_measurement_mode - Measurement mode enum.
275   * Defined in IEEE Std 802.11‐2020 Table 9-103.
276   * @MEASURE_MODE_PASSIVE: Passive measurement mode
277   * @MEASURE_MODE_ACTIVE: Active measurement mode
278   * @MEASURE_MODE_BCN_TABLE: Beacon table measurement mode
279   * @MEASURE_MODE_RESERVED: Reserved
280   */
281  enum wlan_bcn_rpt_measurement_mode {
282  	MEASURE_MODE_PASSIVE = 0,
283  	MEASURE_MODE_ACTIVE,
284  	MEASURE_MODE_BCN_TABLE,
285  	MEASURE_MODE_RESERVED = 0xFF
286  };
287  
288  /**
289   * enum wlan_diag_connect_fail_reason - WLAN diag connect fail reason code
290   * @WLAN_DIAG_UNSPECIFIC_REASON: Unspecific reason
291   * @WLAN_DIAG_NO_CANDIDATE_FOUND: No candidate found
292   * @WLAN_DIAG_ABORT_DUE_TO_NEW_REQ_RECVD: Aborted as new command is
293   * received.
294   * @WLAN_DIAG_BSS_SELECT_IND_FAILED: Failed BSS select indication
295   * @WLAN_DIAG_PEER_CREATE_FAILED: peer create failed
296   * @WLAN_DIAG_JOIN_FAILED: Failed in joining state
297   * @WLAN_DIAG_JOIN_TIMEOUT: Did not receive beacon or probe response after
298   * unicast probe request
299   * @WLAN_DIAG_AUTH_FAILED: Auth rejected by AP
300   * @WLAN_DIAG_AUTH_TIMEOUT: No Auth resp from AP
301   * @WLAN_DIAG_ASSOC_FAILED: Assoc rejected by AP
302   * @WLAN_DIAG_ASSOC_TIMEOUT: No Assoc resp from AP
303   * @WLAN_DIAG_HW_MODE_FAILURE: failed to change HW mode
304   * @WLAN_DIAG_SER_FAILURE: Failed to serialize command
305   * @WLAN_DIAG_SER_TIMEOUT: Serialization cmd timeout
306   * @WLAN_DIAG_GENERIC_FAILURE: Generic failure apart from above
307   * @WLAN_DIAG_VALID_CANDIDATE_CHECK_FAIL: Valid Candidate Check fail
308   */
309  enum wlan_diag_connect_fail_reason {
310  	WLAN_DIAG_UNSPECIFIC_REASON = 0,
311  	WLAN_DIAG_NO_CANDIDATE_FOUND = 1,
312  	WLAN_DIAG_ABORT_DUE_TO_NEW_REQ_RECVD,
313  	WLAN_DIAG_BSS_SELECT_IND_FAILED,
314  	WLAN_DIAG_PEER_CREATE_FAILED,
315  	WLAN_DIAG_JOIN_FAILED,
316  	WLAN_DIAG_JOIN_TIMEOUT,
317  	WLAN_DIAG_AUTH_FAILED,
318  	WLAN_DIAG_AUTH_TIMEOUT,
319  	WLAN_DIAG_ASSOC_FAILED,
320  	WLAN_DIAG_ASSOC_TIMEOUT,
321  	WLAN_DIAG_HW_MODE_FAILURE,
322  	WLAN_DIAG_SER_FAILURE,
323  	WLAN_DIAG_SER_TIMEOUT,
324  	WLAN_DIAG_GENERIC_FAILURE,
325  	WLAN_DIAG_VALID_CANDIDATE_CHECK_FAIL,
326  };
327  
328  /**
329   * enum wlan_diag_btm_block_reason - BTM drop/ignore reason code
330   * @WLAN_DIAG_BTM_BLOCK_MBO_WO_PMF: Connected to MBO without PMF capable AP
331   * @WLAN_DIAG_BTM_BLOCK_UNSUPPORTED_P2P_CONC: p2p go/cli is present which
332   *  restricts BTM roaming
333   */
334  enum wlan_diag_btm_block_reason {
335  	WLAN_DIAG_BTM_BLOCK_MBO_WO_PMF = 1,
336  	WLAN_DIAG_BTM_BLOCK_UNSUPPORTED_P2P_CONC = 2,
337  };
338  
339  /**
340   * struct wlan_connectivity_log_diag_cmn - Structure for diag event
341   * @bssid: bssid
342   * @vdev_id: Vdev id
343   * @timestamp_us: Timestamp(time of the day) in microseconds
344   * @fw_timestamp: FW timestamp in microseconds
345   * @ktime_us: Kernel Timestamp in microseconds
346   */
347  struct wlan_connectivity_log_diag_cmn {
348  	uint8_t bssid[QDF_MAC_ADDR_SIZE];
349  	uint16_t vdev_id;
350  	uint64_t timestamp_us;
351  	uint64_t fw_timestamp;
352  	uint64_t ktime_us;
353  } qdf_packed;
354  
355  #define DIAG_STA_INFO_VERSION 1
356  
357  /**
358   * struct wlan_diag_sta_info - STA info structure
359   * @diag_cmn: Common diag info
360   * @version: structure version
361   * @is_mlo: MLO connection bit
362   * @mac_2g: 2.4 GHz link station mac address
363   * @mac_5g: 5 GHz link station mac address
364   * @mac_6g: 6 GHz link station mac address
365   */
366  struct wlan_diag_sta_info {
367  	struct wlan_connectivity_log_diag_cmn diag_cmn;
368  	uint8_t version;
369  	uint8_t is_mlo;
370  	uint8_t mac_2g[QDF_MAC_ADDR_SIZE];
371  	uint8_t mac_5g[QDF_MAC_ADDR_SIZE];
372  	uint8_t mac_6g[QDF_MAC_ADDR_SIZE];
373  } qdf_packed;
374  
375  /*
376   * struct wlan_diag_mlo_cmn_info - MLO common info
377   * @band: Indicates link on which mlo setup is initiated.
378   * Refer enum enum wlan_diag_wifi_band.
379   * @link_id: Link id of the link when link is accepted
380   * @vdev_id: vdev id associated with the link
381   * @tid_ul: TID-to-link mapping information on the uplink
382   * @tid_dl: TID-to-link mapping information on the downlink
383   * @status: MLO setup status. 0 - Success, 1 - failure
384   * @link_addr: Link address of the link.
385   */
386  struct wlan_diag_mlo_cmn_info {
387  	uint8_t band;
388  	uint8_t link_id;
389  	uint8_t vdev_id;
390  	uint8_t tid_ul;
391  	uint8_t tid_dl;
392  	uint8_t status;
393  	uint8_t link_addr[QDF_MAC_ADDR_SIZE];
394  } qdf_packed;
395  
396  #define DIAG_MLO_SETUP_VERSION 1
397  #define DIAG_MLO_SETUP_VERSION_V2 2
398  
399  #define MAX_NUM_LINKS_PER_EVENT 3
400  /**
401   * struct wlan_diag_mlo_setup - MLO setup structure
402   * @diag_cmn: Common diag info
403   * @version: structure version
404   * @num_links: Number of links associated for MLO setup
405   * @reserved: Reserved field
406   * @status: status code of the link. Non-zero value when link is rejected
407   * @mlo_cmn_info: MLO common info
408   */
409  struct wlan_diag_mlo_setup {
410  	struct wlan_connectivity_log_diag_cmn diag_cmn;
411  	uint8_t version;
412  	uint8_t num_links;
413  	uint16_t reserved;
414  	struct wlan_diag_mlo_cmn_info mlo_cmn_info[MAX_NUM_LINKS_PER_EVENT];
415  } qdf_packed;
416  
417  #define DIAG_MLO_RECONFIG_VERSION 1
418  
419  /**
420   * struct wlan_diag_mlo_reconfig - MLO reconfig diag event structure
421   * @diag_cmn: Common diag info
422   * @version: structure version
423   * @reserved: Reserved field
424   * @mlo_cmn_info: MLO common info
425   */
426  struct wlan_diag_mlo_reconfig {
427  	struct wlan_connectivity_log_diag_cmn diag_cmn;
428  	uint32_t version:8;
429  	uint32_t reserved:24;
430  	struct wlan_diag_mlo_cmn_info mlo_cmn_info;
431  } qdf_packed;
432  
433  #define DIAG_MLO_T2LM_STATUS_VERSION 1
434  #define DIAG_MLO_T2LM_STATUS_VERSION_V2 2
435  
436  /**
437   * struct wlan_diag_mlo_t2lm_status - MLO T2LM status diag event structure
438   * @diag_cmn: Common diag info
439   * @version: structure version
440   * @num_links: Number of links associated for T2LM status
441   * @reserved: Reserved field
442   * @mlo_cmn_info: MLO common info
443   */
444  struct wlan_diag_mlo_t2lm_status {
445  	struct wlan_connectivity_log_diag_cmn diag_cmn;
446  	uint8_t version;
447  	uint8_t num_links;
448  	uint16_t reserved;
449  	struct wlan_diag_mlo_cmn_info mlo_cmn_info[MAX_NUM_LINKS_PER_EVENT];
450  } qdf_packed;
451  
452  #define DIAG_MLO_T2LM_REQ_RESP_VERSION 1
453  
454  /**
455   * struct wlan_diag_mlo_t2lm_req_resp - MLO T2LM Req/Resp diag event structure
456   * @diag_cmn: Common diag info
457   * @version: Structure version
458   * @band: Indicates the band of the link
459   * @status: status code of TID-to-Link mapping response frame
460   * @token: Dialog Token field of TID-To-Link Mapping Request/Response frame
461   * @is_rx: Indicates the direction of packet. 0 - TX and 1 - RX
462   * @tx_status: tx status of transmitted packet. Refer enum qdf_dp_tx_rx_status
463   * @subtype: Subtype of the event
464   * @reserved: Reserved field
465   */
466  struct wlan_diag_mlo_t2lm_req_resp {
467  	struct wlan_connectivity_log_diag_cmn diag_cmn;
468  	uint8_t version;
469  	uint8_t band;
470  	uint8_t status;
471  	uint8_t token;
472  	uint8_t is_rx:1;
473  	uint8_t tx_status:7;
474  	uint8_t subtype;
475  	uint16_t reserved;
476  } qdf_packed;
477  
478  #define DIAG_MLO_T2LM_TEARDOWN_VERSION 1
479  
480  /**
481   * struct wlan_diag_mlo_t2lm_teardown - MLO T2LM Teardown diag event structure
482   * @diag_cmn: Common diag info
483   * @version: structure version
484   * @band: Indicates the band of the link. Refer enum wlan_diag_wifi_band
485   * @tx_status: tx status of transmitted packet. Refer enum qdf_dp_tx_rx_status
486   * @reserved: Reserved field
487   */
488  struct wlan_diag_mlo_t2lm_teardown {
489  	struct wlan_connectivity_log_diag_cmn diag_cmn;
490  	uint8_t version;
491  	uint8_t band;
492  	uint8_t tx_status;
493  	uint8_t reserved;
494  } qdf_packed;
495  
496  #define DIAG_MLO_LINK_STATUS_VERSION 1
497  #define DIAG_MLO_LINK_STATUS_VERSION_2 2
498  /**
499   * struct wlan_diag_mlo_link_status - MLO Link status diag event structure
500   * @diag_cmn: Common diag info
501   * @version: structure version
502   * @active_link: List of current active links. BIT 0: 2.4 GHz BIT 1: 5 GHz
503   * BIT 2: 6 GHz
504   * @prev_active_link: List of previous active links. BIT 0: 2.4 G Hz
505   * BIT 1: 5 GHz BIT 2: 6 GHz
506   * @associated_links: Links associated in the current connection.
507   * BIT 0: 2.4 GHz BIT 1: 5 GHz BIT 2: 6 GHz
508   * @reserved: Reserved field
509   * @reason: Reason for changed link status. Refer
510   * enum wlan_diag_mlo_link_switch_reason
511   */
512  struct wlan_diag_mlo_link_status {
513  	struct wlan_connectivity_log_diag_cmn diag_cmn;
514  	uint8_t version;
515  	uint8_t active_link:5;
516  	uint8_t prev_active_link:5;
517  	uint8_t associated_links:5;
518  	uint8_t reserved:1;
519  	uint8_t reason;
520  } qdf_packed;
521  
522  #define DIAG_NBR_RPT_VERSION 1
523  #define DIAG_NBR_RPT_VERSION_2 2
524  
525  /**
526   * struct wlan_diag_nbr_rpt - Neighbor report structure
527   * @diag_cmn: Common diag info
528   * @version: structure version
529   * @num_rpt: the number of neighbor report elements in response frame.
530   * @subtype: Event Subtype
531   * @token: dialog token. Dialog Token is a nonzero value chosen by the STA
532   * @num_freq: Number of frequency in response frame
533   * @ssid_len: SSID length
534   * @seq_num: Sequence number
535   * @ssid: SSID
536   * @freq: Frequency list in response frame
537   * @band: Band on which packet was received or transmitted.
538   * Refer enum enum wlan_diag_wifi_band
539   * @reserved: Reserved field
540   */
541  struct wlan_diag_nbr_rpt {
542  	struct wlan_connectivity_log_diag_cmn diag_cmn;
543  	uint8_t version;
544  	uint8_t num_rpt;
545  	uint8_t subtype;
546  	uint8_t token;
547  	uint16_t num_freq;
548  	uint16_t ssid_len;
549  	uint32_t seq_num;
550  	char ssid[WLAN_SSID_MAX_LEN];
551  	uint32_t freq[WLAN_MAX_LOGGING_FREQ];
552  	uint32_t band:8;
553  	uint32_t reserved:24;
554  } qdf_packed;
555  
556  #define DIAG_BCN_RPT_VERSION 1
557  #define DIAG_BCN_RPT_VERSION_2 2
558  
559  /**
560   * struct wlan_diag_bcn_rpt - Beacon report structure
561   * @diag_cmn: Common diag info
562   * @version: structure version
563   * @subtype: Event Subtype
564   * @diag_token: Dialog token
565   * @op_class: Operating classes that include primary channels
566   * @chan: The channel number field in the beacon report request.
567   * @req_mode: hex value defines Duration mandatory, parallel, enable,
568   * request, and report bits.
569   * @num_rpt: the number of neighbor report elements in response frame.
570   * @meas_token: A nonzero number that is unique among the Measurement Request
571   * elements
572   * @mode: Mode used for measurement.Values defined in IEEE
573   * Std 802.11‐2020 Table 9-103.
574   * @duration: The duration over which the Beacon report was measured.(in ms)
575   * @seq_num: Sequence number.
576   * @band: Band on which packet was received or transmitted.
577   * Refer enum enum wlan_diag_wifi_band
578   * @reserved: Reserved field
579   */
580  struct wlan_diag_bcn_rpt {
581  	struct wlan_connectivity_log_diag_cmn diag_cmn;
582  	uint8_t version;
583  	uint8_t subtype;
584  	uint8_t diag_token;
585  	uint8_t op_class;
586  	uint8_t chan;
587  	uint8_t req_mode;
588  	uint8_t num_rpt;
589  	uint8_t meas_token;
590  	uint16_t mode;
591  	uint16_t duration;
592  	uint32_t seq_num;
593  	uint32_t band:8;
594  	uint32_t reserved:24;
595  } qdf_packed;
596  
597  #define DIAG_ROAM_CAND_VERSION 1
598  #define DIAG_ROAM_CAND_VERSION_V2 2
599  
600  /**
601   * struct wlan_diag_roam_candidate_info  - Roam candidate information for
602   * logging
603   * @diag_cmn: Common diag info
604   * @version: Structure Version
605   * @is_current_ap: Is the entry candidate AP or connected AP
606   * @is_mlo: MLO connection indicator
607   * @reserved: Reserved
608   * @idx: Entry index
609   * @cu_load: Channel utilization load of the AP in percentage
610   * @subtype: diag event subtype defined in enum qca_conn_diag_log_event_type
611   * @total_score: Total candidate AP score
612   * @freq: Candidate AP channel frequency in MHz
613   * @rssi: Candidate AP RSSI in dBm
614   * @etp: Estimated throughput value of the AP in Kbps
615   */
616  struct wlan_diag_roam_candidate_info {
617  	struct wlan_connectivity_log_diag_cmn diag_cmn;
618  	uint8_t version;
619  	uint8_t is_current_ap:1;
620  	uint8_t is_mlo:1;
621  	uint8_t reserved:6;
622  	uint16_t idx;
623  	uint16_t cu_load;
624  	uint16_t subtype;
625  	uint32_t total_score;
626  	uint32_t freq;
627  	int32_t rssi;
628  	uint32_t etp;
629  } qdf_packed;
630  
631  #define DIAG_SCAN_DONE_VERSION 1
632  
633  /**
634   * struct wlan_diag_roam_scan_done - Roam scan related information
635   * @diag_cmn: Common diag info
636   * @version: Structure Version
637   * @btcoex_active: Is there active bluetooth connection
638   * @reserved: Reserved field
639   * @cand_ap_count: Roam candidate AP count
640   * @num_scanned_freq: Number of scanned frequencies
641   * @scan_freq: Array of scanned frequencies value in MHz
642   */
643  struct wlan_diag_roam_scan_done {
644  	struct wlan_connectivity_log_diag_cmn diag_cmn;
645  	uint8_t version;
646  	uint8_t btcoex_active:1;
647  	uint8_t reserved:7;
648  	uint16_t cand_ap_count;
649  	uint16_t num_scanned_freq;
650  	uint32_t scan_freq[WLAN_MAX_LOGGING_FREQ];
651  } qdf_packed;
652  
653  #define DIAG_ROAM_RESULT_VERSION 1
654  
655  /**
656   * struct wlan_diag_roam_result - Roam result data
657   * @diag_cmn: Common diag info
658   * @version: Structure Version
659   * @is_roam_successful: True if roamed successfully or false if roaming failed
660   * @is_mlo: Indicates whether the current connection is a MLO connection
661   * @reserved: Reserved
662   * @roam_fail_reason: Roam failure reason code defined in enum
663   * wlan_roam_failure_reason_code
664   */
665  struct wlan_diag_roam_result {
666  	struct wlan_connectivity_log_diag_cmn diag_cmn;
667  	uint8_t version;
668  	uint8_t is_roam_successful:1;
669  	uint8_t is_mlo:1;
670  	uint8_t reserved:6;
671  	uint16_t roam_fail_reason;
672  } qdf_packed;
673  
674  #define DIAG_ROAM_SCAN_START_VERSION 1
675  #define DIAG_ROAM_SCAN_START_VERSION_V2 2
676  
677  /**
678   * struct wlan_diag_roam_scan_start - Structure to store roam scan trigger
679   * related data.
680   * @diag_cmn: Common diag info
681   * @version: Structure Version
682   * @is_full_scan: True if the scan is Full scan. False if the roam scan is
683   * partial channel map scan
684   * @band: Band involved in the roaming during a MLO connection.
685   * Refer enum enum wlan_diag_wifi_band
686   * @cu:  Current connected channel load in percentage
687   * @trigger_reason: Roam trigger reason defined by enum roam_trigger_reason
688   * @trigger_sub_reason: Roam scan trigger sub reason indicating if
689   * periodic/inactivity scan timer initiated roam. Defined by enum
690   * roam_trigger_sub_reason
691   * @rssi: Connected AP RSSI in dBm
692   * @rssi_thresh: Roam scan trigger threshold in dBm
693   */
694  struct wlan_diag_roam_scan_start {
695  	struct wlan_connectivity_log_diag_cmn diag_cmn;
696  	uint8_t version;
697  	uint8_t is_full_scan:1;
698  	uint8_t band:7;
699  	uint16_t cu;
700  	uint32_t trigger_reason;
701  	uint32_t trigger_sub_reason;
702  	int32_t rssi;
703  	int32_t rssi_thresh;
704  } qdf_packed;
705  
706  #define DIAG_BTM_CAND_VERSION 1
707  
708  /**
709   * struct wlan_diag_btm_cand_info  - BTM candidate information
710   * @diag_cmn: Common diag info
711   * @version: Structure Version
712   * @pad: Padded field
713   * @idx: Candidate index
714   * @preference: Candidate preference
715   */
716  struct wlan_diag_btm_cand_info {
717  	struct wlan_connectivity_log_diag_cmn diag_cmn;
718  	uint8_t version;
719  	uint8_t pad;
720  	uint16_t idx;
721  	uint32_t preference;
722  } qdf_packed;
723  
724  #define DIAG_BTM_VERSION 1
725  #define DIAG_BTM_VERSION_2 2
726  
727  /**
728   * struct wlan_diag_btm_info - BTM frame related logging data
729   * @diag_cmn: Common diag info
730   * @version: Structure Version
731   * @reason: Query Reason field. Contains one of the values defined in IEEE
732   * Std 802.11‐2020 Table 9-198—Transition and Transition Query reasons
733   * @mode: BTM Request Mode field
734   * @sub_reason: WTC sub reason code field in the BTM WTC vendor specific IE
735   * @cand_lst_cnt: Candidates list in the BTM frame
736   * @status: BSS Transition management status codes defined in
737   * 802.11‐2020 Table 9-428—BTM status code definitions
738   * @delay: BSS Termination Delay field
739   * @is_disassoc_imminent: Disassociation imminent bit
740   * @band: indicates the link involved in MLO conenection.
741   * Refer enum enum wlan_diag_wifi_band
742   * @token: dialog token. Dialog Token is a nonzero value chosen by the STA
743   * @wtc_duration: WTC duration field in minutes
744   * while sending the BTM frame to identify the query/request/response
745   * transaction
746   * @subtype: Event Subtype
747   * @validity_timer: Validity interval in TBTT
748   * @disassoc_tim: Time after which the AP disassociates the STA, defined
749   * in TBTT.
750   */
751  struct wlan_diag_btm_info {
752  	struct wlan_connectivity_log_diag_cmn diag_cmn;
753  	uint8_t version;
754  	uint8_t reason;
755  	uint8_t mode;
756  	uint8_t sub_reason;
757  	uint8_t cand_lst_cnt;
758  	uint8_t status;
759  	uint8_t delay;
760  	uint8_t is_disassoc_imminent:1;
761  	uint8_t band:7;
762  	uint8_t token;
763  	uint8_t subtype;
764  	uint16_t wtc_duration;
765  	uint32_t validity_timer;
766  	uint32_t disassoc_tim;
767  } qdf_packed;
768  
769  #define DIAG_MGMT_VERSION 1
770  #define DIAG_MGMT_VERSION_V2 2
771  #define MAX_VSIE_LEN 255
772  
773  /**
774   * struct wlan_diag_packet_info - Data packets related info
775   * @diag_cmn: Common diag info
776   * @version: Structure Version
777   * @auth_algo: authentication algorithm number defined in IEEE Std 802.11‐2020
778   * @auth_frame_type: Authentication frame sub-type for SAE authentication
779   * defined in Section 9.4.1.1 Authentication Algorithm Number field in
780   * IEEE Std 802.11‐2020.
781   * @auth_seq_num: Authentication frame transaction sequence number
782   * @status: Frame status code as defined in IEEE Std
783   * 802.11‐2020 Table 9-50—Status codes.
784   * @tx_status: Frame TX status defined by enum qdf_dp_tx_rx_status
785   * @reason: reason code defined in Table 9-49 Reason codes field’ from the
786   * IEEE 802.11 standard document.
787   * @is_retry_frame: Retry frame indicator
788   * @is_tx: Packet direction indicator. 0 - RX, 1 - TX
789   * @supported_links: link id bitmap indicates the links involved
790   * in MLO connection.
791   * @reserved: Reserved field
792   * @subtype: Diag event defined in  enum qca_conn_diag_log_event_type
793   * @assoc_id: Association ID
794   * @eap_len: EAP data length
795   * @eap_type: EAP type. Values defined by IANA at:
796   * https://www.iana.org/assignments/eap-numbers
797   * @sn: Frame sequence number
798   * @rssi: Peer RSSI in dBm
799   * @tx_fail_reason: tx failure reason printed on TX_FAIL status.
800   * Refer enum qdf_dp_tx_rx_status
801   * @mld_addr: MLD mac address
802   * @vsie_len: VSIE length
803   * @vsie: VSIE
804   */
805  struct wlan_diag_packet_info {
806  	struct wlan_connectivity_log_diag_cmn diag_cmn;
807  	uint8_t version;
808  	uint8_t auth_algo;
809  	uint8_t auth_frame_type;
810  	uint8_t auth_seq_num;
811  	uint8_t status;
812  	uint8_t tx_status;
813  	uint8_t reason;
814  	uint8_t is_retry_frame:1;
815  	uint8_t is_tx:1;
816  	uint8_t supported_links:6;
817  	uint16_t subtype;
818  	uint16_t assoc_id;
819  	uint16_t eap_len;
820  	uint16_t eap_type;
821  	uint32_t sn;
822  	int32_t rssi;
823  	uint8_t tx_fail_reason;
824  	uint8_t mld_addr[QDF_MAC_ADDR_SIZE];
825  	uint8_t vsie_len;
826  	uint8_t vsie[MAX_VSIE_LEN];
827  } qdf_packed;
828  
829  #define DIAG_CONN_VERSION 1
830  
831  /**
832   * struct wlan_diag_connect - Connection related info
833   * @diag_cmn: Common diag info
834   * @version: Version number
835   * @auth_algo: Authentication algorithm number field as defined in
836   * IEEE 802.11 - 2020 standard section 9.4.1.1
837   * @bt_coex: Is there active bluetooth connection
838   * @reserved: Reserved field
839   * @ssid_len: Length of SSID
840   * @ssid: SSID
841   * @bssid_hint: BSSID hint provided in the connect request
842   * @reason: failure reason. Refer enum wlan_cm_connect_fail_reason
843   * @akm: Auth key management suite defined in IEEE Std 802.11‐2020
844   * Table 9-151—AKM suite selectors.
845   * @subtype: Event subtype defined in enum qca_conn_diag_log_event_type.
846   * @freq: Frequency in MHz
847   * @freq_hint: Frequency Hint in MHz
848   * @pairwise_cipher: Pairwise suite value as defined in IEEE 802.11 2020
849   * Table 12-10—Integrity and key wrap algorithms.
850   * @grp_cipher: Group cipher suite value as defined in
851   * Table 12-10—Integrity and key wrap algorithm in IEEE 802.11 2020.
852   * @grp_mgmt: Group management cipher suite as defined in
853   * Table 12-10—Integrity and key wrap algorithms in IEEE 802.11 2020.
854   */
855  struct wlan_diag_connect {
856  	struct wlan_connectivity_log_diag_cmn diag_cmn;
857  	uint8_t version;
858  	uint8_t auth_algo;
859  	uint8_t bt_coex:1;
860  	uint8_t reserved:7;
861  	uint8_t ssid_len;
862  	char ssid[WLAN_SSID_MAX_LEN];
863  	uint8_t bssid_hint[6];
864  	uint16_t reason;
865  	uint32_t akm;
866  	uint32_t subtype;
867  	uint32_t freq;
868  	uint32_t freq_hint;
869  	uint32_t pairwise_cipher;
870  	uint32_t grp_cipher;
871  	uint32_t grp_mgmt;
872  } qdf_packed;
873  
874  /**
875   * struct wlan_roam_candidate_info  - Roam candidate information for logging
876   * @cand_bssid: BSSID of the candidate AP
877   * @is_current_ap: Is the entry candidate AP or connected AP
878   * @idx: Entry index
879   * @cu_load: Channel utilization load of the AP in percentage
880   * @freq: Candidate AP channel frequency in MHz
881   * @total_score: Total candidate AP score
882   * @rssi: Candidate AP RSSI in dBm
883   * @etp: Estimated throughput value of the AP in Kbps
884   */
885  struct wlan_roam_candidate_info {
886  	struct qdf_mac_addr cand_bssid;
887  	bool is_current_ap;
888  	uint8_t idx;
889  	uint8_t cu_load;
890  	qdf_freq_t freq;
891  	uint16_t total_score;
892  	int32_t rssi;
893  	uint32_t etp;
894  };
895  
896  /**
897   * struct wlan_roam_scan_info  - Roam scan related information
898   * @cand_ap_count: Roam candidate AP count
899   * @num_scanned_freq: Number of scanned frequencies
900   * @is_btcoex_active: Is bluetooth coex active
901   * @scan_freq: Array of scanned frequencies value in MHz
902   */
903  struct wlan_roam_scan_info {
904  	uint8_t cand_ap_count;
905  	uint16_t num_scanned_freq;
906  	bool is_btcoex_active;
907  	qdf_freq_t scan_freq[NUM_CHANNELS];
908  };
909  
910  /**
911   * struct wlan_roam_result_info  - Roam result data
912   * @roam_fail_reason: Roam failure reason code defined in enum
913   * wlan_roam_failure_reason_code
914   * @is_roam_successful: True if roamed successfully or false if roaming failed
915   */
916  struct wlan_roam_result_info {
917  	enum wlan_roam_failure_reason_code roam_fail_reason;
918  	bool is_roam_successful;
919  };
920  
921  /**
922   * struct wlan_roam_trigger_info - Structure to store roam trigger related data.
923   * @is_full_scan: True if the scan is Full scan. False if the roam scan is
924   * partial channel map scan
925   * @trigger_reason: Roam trigger reason defined by enum roam_trigger_reason
926   * @trigger_sub_reason: Roam scan trigger sub reason indicating if
927   * periodic/inactivity scan timer initiated roam. Defined by enum
928   * roam_trigger_sub_reason
929   * @cu_load:  Current connected channel load in percentage
930   * @current_rssi: Connected AP RSSI in dBm
931   * @rssi_threshold: Roam scan trigger threshold in dBm
932   */
933  struct wlan_roam_trigger_info {
934  	bool is_full_scan;
935  	enum roam_trigger_reason trigger_reason;
936  	enum roam_trigger_sub_reason trigger_sub_reason;
937  	uint8_t cu_load;
938  	int32_t current_rssi;
939  	int32_t rssi_threshold;
940  };
941  
942  /**
943   * struct wlan_btm_cand_info  - BTM candidate information
944   * @idx: Candidate index
945   * @preference: Candidate preference
946   * @bssid: candidate bssid
947   */
948  struct wlan_btm_cand_info {
949  	uint8_t idx;
950  	uint8_t preference;
951  	struct qdf_mac_addr bssid;
952  };
953  
954  /**
955   * struct wlan_roam_btm_info - BTM frame related logging data
956   * @reason: Query Reason field. Contains one of the values defined in IEEE
957   * Std 802.11‐2020 Table 9-198—Transition and Transition Query reasons
958   * @mode: BTM Request Mode field
959   * @sub_reason: WTC sub reason code field in the BTM WTC vendor specific IE
960   * @candidate_list_count: Candidates list in the BTM frame
961   * @btm_status_code: BSS Transition management status codes defined in
962   * 802.11‐2020 Table 9-428—BTM status code definitions
963   * @btm_delay: BSS Termination Delay field
964   * @is_disassoc_imminent: Disassociation imminent bit
965   * @token: dialog token. Dialog Token is a nonzero value chosen by the STA
966   * while sending the BTM frame to identify the query/request/response
967   * transaction
968   * @validity_timer: Validity interval in TBTT
969   * @disassoc_timer: Time after which the AP disassociates the STA, defined
970   * in TBTT.
971   * @wtc_duration: WTC duration field in minutes
972   * @target_bssid: BTM response target bssid field
973   */
974  struct wlan_roam_btm_info {
975  	uint8_t reason;
976  	uint8_t mode;
977  	uint8_t sub_reason;
978  	uint8_t candidate_list_count;
979  	uint8_t btm_status_code;
980  	uint8_t btm_delay;
981  	bool is_disassoc_imminent;
982  	uint8_t token;
983  	uint8_t validity_timer;
984  	uint16_t disassoc_timer;
985  	uint32_t wtc_duration;
986  	struct qdf_mac_addr target_bssid;
987  };
988  
989  /**
990   * struct wlan_packet_info  - Data packets related info
991   * @tx_status: Frame TX status defined by enum qdf_dp_tx_rx_status
992   * @eap_type: EAP type. Values defined by IANA at:
993   * https://www.iana.org/assignments/eap-numbers
994   * @eap_len: EAP data length
995   * @auth_algo: authentication algorithm number defined in IEEE Std 802.11‐2020
996   * Section 9.4.1.1 Authentication Algorithm Number field.
997   * @auth_seq_num: Authentication frame transaction sequence number
998   * @auth_type: Authentication frame sub-type for SAE authentication. Possible
999   * values:
1000   * 1 - SAE commit frame
1001   * 2 - SAE confirm frame
1002   * @assoc_id: Association ID received in association response frame as
1003   * defined in IEEE Std 802.11-2020 Figure 9-91-AID field format.
1004   * @frame_status_code: Frame status code as defined in IEEE Std
1005   * 802.11 2020 Table 9-50—Status codes.
1006   * @seq_num: Frame sequence number
1007   * @rssi: Peer RSSI in dBm
1008   * @is_retry_frame: is frame retried
1009   */
1010  struct wlan_packet_info {
1011  	uint8_t tx_status;
1012  	uint8_t eap_type;
1013  	uint16_t eap_len;
1014  	uint8_t auth_algo;
1015  	uint8_t auth_seq_num;
1016  	uint8_t auth_type;
1017  	uint16_t assoc_id;
1018  	uint16_t frame_status_code;
1019  	uint16_t seq_num;
1020  	int32_t rssi;
1021  	bool is_retry_frame;
1022  };
1023  
1024  /**
1025   * struct wlan_connect_info  - Connection related info
1026   * @ssid: SSID
1027   * @ssid_len: Length of the SSID
1028   * @bssid_hint: BSSID hint provided in the connect request
1029   * @freq: Frequency in MHz
1030   * @freq_hint: Frequency Hint in MHz
1031   * @akm: Auth key management suite defined in IEEE Std 802.11‐2020
1032   * Table 9-151—AKM suite selectors.
1033   * @pairwise: Pairwise suite value as defined in IEEE 802.11 2020
1034   * Table 12-10—Integrity and key wrap algorithms.
1035   * @group: Group cipher suite value as defined in
1036   * Table 12-10—Integrity and key wrap algorithms.
1037   * @group_mgmt: Group management cipher suite as defined in
1038   * Table 12-10—Integrity and key wrap algorithms.
1039   * @auth_type: Authentication algorithm number field as defined in
1040   * IEEE 802.11 - 2020 standard section 9.4.1.1
1041   * @conn_status: Connection failure status defined by enum
1042   * wlan_cm_connect_fail_reason
1043   * @is_bt_coex_active: Is there active bluetooth connection
1044   */
1045  struct wlan_connect_info {
1046  	char ssid[WLAN_SSID_MAX_LEN];
1047  	uint8_t ssid_len;
1048  	struct qdf_mac_addr bssid_hint;
1049  	qdf_freq_t freq;
1050  	qdf_freq_t freq_hint;
1051  	uint32_t akm;
1052  	uint32_t pairwise;
1053  	uint32_t group;
1054  	uint32_t group_mgmt;
1055  	uint8_t auth_type;
1056  	enum wlan_cm_connect_fail_reason conn_status;
1057  	bool is_bt_coex_active;
1058  };
1059  
1060  #define WLAN_MAX_LOG_RECORDS 45
1061  #define WLAN_MAX_LOG_LEN     256
1062  #define WLAN_RECORDS_PER_SEC 20
1063  #define MAX_RECORD_IN_SINGLE_EVT 5
1064  
1065  /**
1066   * struct wlan_log_record  - Structure for individual records in the ring
1067   * buffer
1068   * @timestamp_us: Timestamp(time of the day) in microseconds
1069   * @fw_timestamp_us: timestamp at which roam scan was triggered
1070   * @ktime_us: kernel timestamp (time of the day) in microseconds
1071   * @vdev_id: VDEV id
1072   * @log_subtype: Tag of the log
1073   * @bssid: AP bssid
1074   * @is_record_filled: indicates if the current record is empty or not
1075   * @conn_info: Connection info
1076   * @pkt_info: Packet info
1077   * @roam_scan: Roam scan
1078   * @ap: Roam candidate AP info
1079   * @roam_result: Roam result
1080   * @roam_trig: Roam trigger related info
1081   * @btm_info: BTM info
1082   * @btm_cand: BTM response candidate info
1083   */
1084  struct wlan_log_record {
1085  	uint64_t timestamp_us;
1086  	uint64_t fw_timestamp_us;
1087  	uint64_t ktime_us;
1088  	uint8_t vdev_id;
1089  	uint32_t log_subtype;
1090  	struct qdf_mac_addr bssid;
1091  	bool is_record_filled;
1092  	union {
1093  		struct wlan_connect_info conn_info;
1094  		struct wlan_packet_info pkt_info;
1095  		struct wlan_roam_scan_info roam_scan;
1096  		struct wlan_roam_candidate_info ap;
1097  		struct wlan_roam_result_info roam_result;
1098  		struct wlan_roam_trigger_info roam_trig;
1099  		struct wlan_roam_btm_info btm_info;
1100  		struct wlan_btm_cand_info btm_cand;
1101  	};
1102  };
1103  
1104  /**
1105   * struct wlan_cl_osif_cbks  - OSIF callbacks to be invoked for connectivity
1106   * logging
1107   * @wlan_connectivity_log_send_to_usr: Send the log buffer to user space
1108   */
1109  struct wlan_cl_osif_cbks {
1110  	QDF_STATUS
1111  	(*wlan_connectivity_log_send_to_usr) (struct wlan_log_record *rec,
1112  					      void *context,
1113  					      uint8_t num_records);
1114  };
1115  
1116  /**
1117   * struct wlan_connectivity_log_buf_data  - Master structure to hold the
1118   * pointers to the ring buffers.
1119   * @psoc: Global psoc pointer
1120   * @osif_cbks: OSIF callbacks
1121   * @osif_cb_context: Pointer to the context to be passed to OSIF
1122   * callback
1123   * @first_record_timestamp_in_last_sec: First record timestamp
1124   * @sent_msgs_count: Total sent messages counter in the last 1 sec
1125   * @head: Pointer to the 1st record allocated in the ring buffer.
1126   * @read_ptr: Pointer to the next record that can be read.
1127   * @write_ptr: Pointer to the next empty record to be written.
1128   * @write_ptr_lock: Spinlock to protect the write_ptr from multiple producers.
1129   * @max_records: Maximum records in the ring buffer.
1130   * @read_idx: Read index
1131   * @write_idx: Write index
1132   * @dropped_msgs: Dropped logs counter
1133   * @is_active: If the global buffer is initialized or not
1134   */
1135  struct wlan_connectivity_log_buf_data {
1136  	struct wlan_objmgr_psoc *psoc;
1137  	struct wlan_cl_osif_cbks osif_cbks;
1138  	void *osif_cb_context;
1139  	uint64_t first_record_timestamp_in_last_sec;
1140  	uint64_t sent_msgs_count;
1141  	struct wlan_log_record *head;
1142  	struct wlan_log_record *read_ptr;
1143  	struct wlan_log_record *write_ptr;
1144  	qdf_spinlock_t write_ptr_lock;
1145  	uint8_t max_records;
1146  	uint8_t read_idx;
1147  	uint8_t write_idx;
1148  	qdf_atomic_t dropped_msgs;
1149  	qdf_atomic_t is_active;
1150  };
1151  
1152  #define logging_err_rl(params...) \
1153  	QDF_TRACE_ERROR_RL(QDF_MODULE_ID_MLME, ## params)
1154  #define logging_warn_rl(params...) \
1155  	QDF_TRACE_WARN_RL(QDF_MODULE_ID_MLME, ## params)
1156  #define logging_info_rl(params...) \
1157  	QDF_TRACE_INFO_RL(QDF_MODULE_ID_MLME, ## params)
1158  
1159  #define logging_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_QDF, ## params)
1160  #define logging_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_QDF, ## params)
1161  #define logging_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_QDF, ## params)
1162  
1163  #if (defined(CONNECTIVITY_DIAG_EVENT) && \
1164  	defined(WLAN_FEATURE_ROAM_OFFLOAD))
1165  /**
1166   * wlan_print_cached_sae_auth_logs() - Enqueue SAE authentication frame logs
1167   * @psoc: Global psoc pointer
1168   * @bssid:  BSSID
1169   * @vdev_id: Vdev id
1170   *
1171   * Return: QDF_STATUS
1172   */
1173  QDF_STATUS wlan_print_cached_sae_auth_logs(struct wlan_objmgr_psoc *psoc,
1174  					   struct qdf_mac_addr *bssid,
1175  					   uint8_t vdev_id);
1176  
1177  /**
1178   * wlan_is_log_record_present_for_bssid() - Check if there is existing log
1179   * record for the given bssid
1180   * @psoc: Global psoc pointer
1181   * @bssid: BSSID
1182   * @vdev_id: vdev id
1183   *
1184   * Return: true if record is present else false
1185   */
1186  bool wlan_is_log_record_present_for_bssid(struct wlan_objmgr_psoc *psoc,
1187  					  struct qdf_mac_addr *bssid,
1188  					  uint8_t vdev_id);
1189  
1190  /**
1191   * wlan_is_sae_auth_log_present_for_bssid() - Is cached SAE auth log record
1192   * present for the given bssid. This API checks on all the link vdev if the
1193   * given vdev_id is an MLO vdev and updates the vdev_id to caller in which
1194   * the auth frame was cached.
1195   * @psoc: Global psoc pointer
1196   * @bssid: BSSID
1197   * @vdev_id: vdev id
1198   *
1199   * Return: True if an entry is found
1200   */
1201  bool
1202  wlan_is_sae_auth_log_present_for_bssid(struct wlan_objmgr_psoc *psoc,
1203  				       struct qdf_mac_addr *bssid,
1204  				       uint8_t *vdev_id);
1205  
1206  /**
1207   * wlan_clear_sae_auth_logs_cache() - Clear the cached auth related logs
1208   * @psoc: Pointer to global psoc object
1209   * @vdev_id: vdev id
1210   *
1211   * Return: None
1212   */
1213  void wlan_clear_sae_auth_logs_cache(struct wlan_objmgr_psoc *psoc,
1214  				    uint8_t vdev_id);
1215  #else
1216  static inline
wlan_print_cached_sae_auth_logs(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * bssid,uint8_t vdev_id)1217  QDF_STATUS wlan_print_cached_sae_auth_logs(struct wlan_objmgr_psoc *psoc,
1218  					   struct qdf_mac_addr *bssid,
1219  					   uint8_t vdev_id)
1220  {
1221  	return QDF_STATUS_SUCCESS;
1222  }
1223  
1224  static inline
wlan_is_log_record_present_for_bssid(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * bssid,uint8_t vdev_id)1225  bool wlan_is_log_record_present_for_bssid(struct wlan_objmgr_psoc *psoc,
1226  					  struct qdf_mac_addr *bssid,
1227  					  uint8_t vdev_id)
1228  {
1229  	return false;
1230  }
1231  
1232  static inline bool
wlan_is_sae_auth_log_present_for_bssid(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * bssid,uint8_t * vdev_id)1233  wlan_is_sae_auth_log_present_for_bssid(struct wlan_objmgr_psoc *psoc,
1234  				       struct qdf_mac_addr *bssid,
1235  				       uint8_t *vdev_id)
1236  {
1237  	return false;
1238  }
1239  
1240  static inline
wlan_clear_sae_auth_logs_cache(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)1241  void wlan_clear_sae_auth_logs_cache(struct wlan_objmgr_psoc *psoc,
1242  				    uint8_t vdev_id)
1243  {}
1244  #endif
1245  
1246  #if defined(CONNECTIVITY_DIAG_EVENT)
1247  /**
1248   * wlan_connectivity_mgmt_event()  - Fill and enqueue a new record
1249   * for management frame information.
1250   * @psoc: Pointer to global psoc object
1251   * @mac_hdr: 802.11 management frame header
1252   * @vdev_id: Vdev id
1253   * @status_code: Frame status code as defined in IEEE 802.11 - 2020 standard
1254   * section 9.4.1.9
1255   * @tx_status: Frame TX status defined by enum qdf_dp_tx_rx_status
1256   * @peer_rssi: Peer RSSI in dBm
1257   * @auth_algo: Authentication algorithm number field as defined in IEEE 802.11 -
1258   * 2020 standard section 9.4.1.1
1259   * @auth_type: indicates SAE authentication frame type. Possible values are:
1260   * 1 - SAE commit frame
1261   * 2 - SAE confirm frame
1262   * @auth_seq: Authentication frame transaction sequence number as defined in
1263   * IEEE 802.11 - 2020 standard section 9.4.1.2
1264   * @aid: Association ID
1265   * @tag: Record type main tag
1266   *
1267   * Return: QDF_STATUS
1268   */
1269  void
1270  wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
1271  			     struct wlan_frame_hdr *mac_hdr,
1272  			     uint8_t vdev_id, uint16_t status_code,
1273  			     enum qdf_dp_tx_rx_status tx_status,
1274  			     int8_t peer_rssi,
1275  			     uint8_t auth_algo, uint8_t auth_type,
1276  			     uint8_t auth_seq, uint16_t aid,
1277  			     enum wlan_main_tag tag);
1278  
1279  /**
1280   * wlan_populate_vsie() - Populate VSIE field for logging
1281   * @vdev: vdev pointer
1282   * @data: Diag packet info data
1283   * @is_tx: flag to indicate whether packet transmitted or received
1284   *
1285   * Return: None
1286   */
1287  void
1288  wlan_populate_vsie(struct wlan_objmgr_vdev *vdev,
1289  		   struct wlan_diag_packet_info *data, bool is_tx);
1290  
1291  /**
1292   * wlan_cdp_set_peer_freq() - API to set frequency to dp peer
1293   * @psoc: psoc pointer
1294   * @peer_mac: Bssid of peer
1295   * @freq: frequency(in MHz)
1296   * @vdev_id: vdev id
1297   *
1298   * Return: None
1299   */
1300  void
1301  wlan_cdp_set_peer_freq(struct wlan_objmgr_psoc *psoc, uint8_t *peer_mac,
1302  		       uint32_t freq, uint8_t vdev_id);
1303  
1304  #ifdef WLAN_FEATURE_11BE_MLO
1305  
1306  /**
1307   * wlan_connectivity_mlo_reconfig_event() -API to log MLO reconfig event
1308   * @vdev: vdev pointer
1309   *
1310   * Return: None
1311   */
1312  void
1313  wlan_connectivity_mlo_reconfig_event(struct wlan_objmgr_vdev *vdev);
1314  
1315  /**
1316   * wlan_connectivity_mlo_setup_event() - Fill and send MLO setup data
1317   * @vdev: vdev pointer
1318   *
1319   * Return: None
1320   */
1321  void wlan_connectivity_mlo_setup_event(struct wlan_objmgr_vdev *vdev);
1322  
1323  /**
1324   * wlan_connectivity_t2lm_req_resp_event - API to send t2lm Req/resp
1325   * event logs to userspace
1326   * @vdev: vdev pointer
1327   * @token: dialog Token
1328   * @t2lm_status: T2LM response status code. Refer enum wlan_t2lm_resp_frm_type
1329   * @tx_status: TX status
1330   * @freq: frequency on which frame was transmitted/received
1331   * @is_rx: Flag to inidcate packet being received
1332   * @subtype: Determine whether the evnt sent is for t2lm request
1333   * or t2lm response
1334   *
1335   * Return: None
1336   */
1337  void
1338  wlan_connectivity_t2lm_req_resp_event(struct wlan_objmgr_vdev *vdev,
1339  				      uint8_t token,
1340  				      enum wlan_t2lm_resp_frm_type t2lm_status,
1341  				      enum qdf_dp_tx_rx_status tx_status,
1342  				      qdf_freq_t freq,
1343  				      bool is_rx, uint8_t subtype);
1344  /**
1345   * wlan_connectivity_t2lm_status_event() - Fill and send T2LM data
1346   * @vdev: vdev pointer
1347   *
1348   * Return: None
1349   */
1350  void wlan_connectivity_t2lm_status_event(struct wlan_objmgr_vdev *vdev);
1351  
1352  /**
1353   * wlan_populate_mlo_mgmt_event_param() - API to populate MLO management frame
1354   * parameter
1355   * @vdev: vdev pointer
1356   * @data: Buffer to be filled with MLO parameter
1357   * @tag: WLAN event tag. Refer enum wlan_main_tag
1358   *
1359   * Return: QDF_STATUS
1360   */
1361  QDF_STATUS
1362  wlan_populate_mlo_mgmt_event_param(struct wlan_objmgr_vdev *vdev,
1363  				   struct wlan_diag_packet_info *data,
1364  				   enum wlan_main_tag tag);
1365  
1366  /**
1367   * wlan_populate_roam_mld_log_param() - Populate roam MLO log parameters
1368   * @vdev: Pointer to vdev object
1369   * @data: Diag event packet info
1370   * @tag: Main Tag
1371   *
1372   * Return: QDF_STATUS
1373   */
1374  QDF_STATUS
1375  wlan_populate_roam_mld_log_param(struct wlan_objmgr_vdev *vdev,
1376  				 struct wlan_diag_packet_info *data,
1377  				 enum wlan_main_tag tag);
1378  #else
1379  static inline void
wlan_connectivity_mlo_reconfig_event(struct wlan_objmgr_vdev * vdev)1380  wlan_connectivity_mlo_reconfig_event(struct wlan_objmgr_vdev *vdev)
1381  {
1382  }
1383  
1384  static inline void
wlan_connectivity_mlo_setup_event(struct wlan_objmgr_vdev * vdev)1385  wlan_connectivity_mlo_setup_event(struct wlan_objmgr_vdev *vdev)
1386  {
1387  }
1388  
1389  static inline void
wlan_connectivity_t2lm_req_resp_event(struct wlan_objmgr_vdev * vdev,uint8_t token,enum wlan_t2lm_resp_frm_type status,enum qdf_dp_tx_rx_status tx_status,qdf_freq_t freq,bool is_rx,uint8_t subtype)1390  wlan_connectivity_t2lm_req_resp_event(struct wlan_objmgr_vdev *vdev,
1391  				      uint8_t token,
1392  				      enum wlan_t2lm_resp_frm_type status,
1393  				      enum qdf_dp_tx_rx_status tx_status,
1394  				      qdf_freq_t freq,
1395  				      bool is_rx, uint8_t subtype)
1396  {}
1397  
1398  static inline void
wlan_connectivity_t2lm_status_event(struct wlan_objmgr_vdev * vdev)1399  wlan_connectivity_t2lm_status_event(struct wlan_objmgr_vdev *vdev)
1400  {
1401  }
1402  
1403  static inline QDF_STATUS
wlan_populate_mlo_mgmt_event_param(struct wlan_objmgr_vdev * vdev,struct wlan_diag_packet_info * data,enum wlan_main_tag tag)1404  wlan_populate_mlo_mgmt_event_param(struct wlan_objmgr_vdev *vdev,
1405  				   struct wlan_diag_packet_info *data,
1406  				   enum wlan_main_tag tag)
1407  {
1408  	return QDF_STATUS_SUCCESS;
1409  }
1410  
1411  static inline QDF_STATUS
wlan_populate_roam_mld_log_param(struct wlan_objmgr_vdev * vdev,struct wlan_diag_packet_info * data,enum wlan_main_tag tag)1412  wlan_populate_roam_mld_log_param(struct wlan_objmgr_vdev *vdev,
1413  				 struct wlan_diag_packet_info *data,
1414  				 enum wlan_main_tag tag)
1415  {
1416  	return QDF_STATUS_SUCCESS;
1417  }
1418  #endif
1419  
1420  /**
1421   * wlan_populate_vsie() - Populate VSIE field for logging
1422   * @vdev: vdev pointer
1423   * @data: Diag packet info data
1424   * @is_tx: flag to indicate whether packet transmitted or received
1425   *
1426   * Return: None
1427   */
1428  void
1429  wlan_populate_vsie(struct wlan_objmgr_vdev *vdev,
1430  		   struct wlan_diag_packet_info *data, bool is_tx);
1431  /**
1432   * wlan_convert_freq_to_diag_band() - API to convert frequency to band value
1433   * mentioned in enum wlan_diag_wifi_band
1434   * @ch_freq: Frequency(in MHz)
1435   *
1436   * Return: Band specified in enum wlan_diag_wifi_band
1437   */
1438  enum wlan_diag_wifi_band
1439  wlan_convert_freq_to_diag_band(uint16_t ch_freq);
1440  
wlan_connectivity_logging_stop(void)1441  static inline void wlan_connectivity_logging_stop(void)
1442  {}
1443  
1444  /**
1445   * wlan_connectivity_sta_info_event() - APi to send STA info event
1446   * @psoc: Pointer to global psoc object
1447   * @vdev_id: Vdev id
1448   * @is_roam: Is sta info event for roaming stats
1449   *
1450   * Return: None
1451   */
1452  void
1453  wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc *psoc,
1454  				 uint8_t vdev_id, bool is_roam);
1455  
1456  /**
1457   * wlan_connectivity_connecting_event() - API to log connecting event
1458   * @vdev: vdev pointer
1459   * @con_req: Connection request parameter
1460   *
1461   * Return: None
1462   */
1463  void
1464  wlan_connectivity_connecting_event(struct wlan_objmgr_vdev *vdev,
1465  				   struct wlan_cm_connect_req *con_req);
1466  
1467  #elif defined(WLAN_FEATURE_CONNECTIVITY_LOGGING)
1468  /**
1469   * wlan_connectivity_logging_start()  - Initialize the connectivity/roaming
1470   * logging buffer
1471   * @psoc: Global psoc pointer
1472   * @osif_cbks: OSIF callbacks
1473   * @osif_cb_context: OSIF callback context argument
1474   *
1475   * Return: None
1476   */
1477  void wlan_connectivity_logging_start(struct wlan_objmgr_psoc *psoc,
1478  				     struct wlan_cl_osif_cbks *osif_cbks,
1479  				     void *osif_cb_context);
1480  
1481  /**
1482   * wlan_connectivity_logging_stop() - Deinitialize the connectivity logging
1483   * buffers and spinlocks.
1484   *
1485   * Return: None
1486   */
1487  void wlan_connectivity_logging_stop(void);
1488  
1489  /**
1490   * wlan_connectivity_log_dequeue() - Send the connectivity logs to userspace
1491   *
1492   * Return: QDF_STATUS
1493   */
1494  QDF_STATUS wlan_connectivity_log_dequeue(void);
1495  
1496  /**
1497   * wlan_connectivity_log_enqueue() - Add new record to the logging buffer
1498   * @new_record: Pointer to the new record to be added
1499   *
1500   * Return: QDF_STATUS
1501   */
1502  QDF_STATUS wlan_connectivity_log_enqueue(struct wlan_log_record *new_record);
1503  
1504  /**
1505   * wlan_connectivity_mgmt_event()  - Fill and enqueue a new record
1506   * for management frame information.
1507   * @psoc: Pointer to global psoc object
1508   * @mac_hdr: 802.11 management frame header
1509   * @vdev_id: Vdev id
1510   * @status_code: Frame status code as defined in IEEE 802.11 - 2020 standard
1511   * section 9.4.1.9
1512   * @tx_status: Frame TX status defined by enum qdf_dp_tx_rx_status
1513   * @peer_rssi: Peer RSSI in dBm
1514   * @auth_algo: Authentication algorithm number field as defined in IEEE 802.11 -
1515   * 2020 standard section 9.4.1.1
1516   * @auth_type: indicates SAE authentication frame type. Possible values are:
1517   * 1 - SAE commit frame
1518   * 2 - SAE confirm frame
1519   * @auth_seq: Authentication frame transaction sequence number as defined in
1520   * IEEE 802.11 - 2020 standard section 9.4.1.2
1521   * @aid: Association ID
1522   * @tag: Record type main tag
1523   *
1524   * Return: QDF_STATUS
1525   */
1526  void
1527  wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
1528  			     struct wlan_frame_hdr *mac_hdr,
1529  			     uint8_t vdev_id, uint16_t status_code,
1530  			     enum qdf_dp_tx_rx_status tx_status,
1531  			     int8_t peer_rssi,
1532  			     uint8_t auth_algo, uint8_t auth_type,
1533  			     uint8_t auth_seq, uint16_t aid,
1534  			     enum wlan_main_tag tag);
1535  
1536  /**
1537   * wlan_connectivity_connecting_event() - API to log connecting event
1538   * @vdev: vdev pointer
1539   * @con_req: Connection request parameter
1540   *
1541   * Return: None
1542   */
1543  void
1544  wlan_connectivity_connecting_event(struct wlan_objmgr_vdev *vdev,
1545  				   struct wlan_cm_connect_req *con_req);
1546  
1547  /**
1548   * wlan_populate_vsie() - Populate VSIE field for logging
1549   * @vdev: vdev pointer
1550   * @data: Diag packet info data
1551   * @is_tx: Flag to indicate whether the packet is transmitted or received
1552   *
1553   * Return: None
1554   */
1555  void
1556  wlan_populate_vsie(struct wlan_objmgr_vdev *vdev,
1557  		   struct wlan_diag_packet_info *data, bool is_tx);
1558  
1559  /**
1560   * wlan_connectivity_sta_info_event() - APi to send STA info event
1561   * @psoc: Pointer to global psoc object
1562   * @vdev_id: Vdev id
1563   * @is_roam: Is sta info event for roaming stats
1564   */
1565  void
1566  wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc *psoc,
1567  				 uint8_t vdev_id, bool is_roam);
1568  
1569  /**
1570   * wlan_convert_freq_to_diag_band() - API to convert frequency to band value
1571   * mentioned in enum wlan_diag_wifi_band
1572   * @ch_freq: Frequency(in MHz)
1573   *
1574   * Return: Band specified in enum wlan_diag_wifi_band
1575   */
1576  enum wlan_diag_wifi_band
1577  wlan_convert_freq_to_diag_band(uint16_t ch_freq);
1578  
1579  /**
1580   * wlan_populate_vsie() - Populate VSIE field for logging
1581   * @vdev: vdev pointer
1582   * @data: Diag packet info data
1583   * @is_tx: flag to indicate whether packet transmitted or received
1584   *
1585   * Return: None
1586   */
1587  void
1588  wlan_populate_vsie(struct wlan_objmgr_vdev *vdev,
1589  		   struct wlan_diag_packet_info *data, bool is_tx);
1590  
1591  /**
1592   * wlan_cdp_set_peer_freq() - API to set frequency to dp peer
1593   * @psoc: psoc pointer
1594   * @peer_mac: Bssid of peer
1595   * @freq: frequency(in MHz)
1596   * @vdev_id: vdev id
1597   *
1598   * Return: None
1599   */
1600  void
1601  wlan_cdp_set_peer_freq(struct wlan_objmgr_psoc *psoc, uint8_t *peer_mac,
1602  		       uint32_t freq, uint8_t vdev_id);
1603  
1604  #else
1605  static inline
wlan_connectivity_logging_start(struct wlan_objmgr_psoc * psoc,struct wlan_cl_osif_cbks * osif_cbks,void * osif_cb_context)1606  void wlan_connectivity_logging_start(struct wlan_objmgr_psoc *psoc,
1607  				     struct wlan_cl_osif_cbks *osif_cbks,
1608  				     void *osif_cb_context)
1609  {}
1610  
wlan_connectivity_logging_stop(void)1611  static inline void wlan_connectivity_logging_stop(void)
1612  {}
1613  
wlan_connectivity_log_dequeue(void)1614  static inline QDF_STATUS wlan_connectivity_log_dequeue(void)
1615  {
1616  	return QDF_STATUS_E_NOSUPPORT;
1617  }
1618  
1619  static inline
wlan_connectivity_log_enqueue(struct wlan_log_record * new_record)1620  QDF_STATUS wlan_connectivity_log_enqueue(struct wlan_log_record *new_record)
1621  {
1622  	return QDF_STATUS_E_NOSUPPORT;
1623  }
1624  
1625  static inline void
wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc * psoc,struct wlan_frame_hdr * mac_hdr,uint8_t vdev_id,uint16_t status_code,enum qdf_dp_tx_rx_status tx_status,int8_t peer_rssi,uint8_t auth_algo,uint8_t auth_type,uint8_t auth_seq,uint16_t aid,enum wlan_main_tag tag)1626  wlan_connectivity_mgmt_event(struct wlan_objmgr_psoc *psoc,
1627  			     struct wlan_frame_hdr *mac_hdr,
1628  			     uint8_t vdev_id, uint16_t status_code,
1629  			     enum qdf_dp_tx_rx_status tx_status,
1630  			     int8_t peer_rssi,
1631  			     uint8_t auth_algo, uint8_t auth_type,
1632  			     uint8_t auth_seq, uint16_t aid,
1633  			     enum wlan_main_tag tag)
1634  {}
1635  
1636  static inline void
wlan_populate_vsie(struct wlan_objmgr_vdev * vdev,struct wlan_diag_packet_info * data,bool is_tx)1637  wlan_populate_vsie(struct wlan_objmgr_vdev *vdev,
1638  		   struct wlan_diag_packet_info *data, bool is_tx)
1639  {
1640  }
1641  
1642  static inline enum wlan_diag_wifi_band
wlan_convert_freq_to_diag_band(uint16_t ch_freq)1643  wlan_convert_freq_to_diag_band(uint16_t ch_freq)
1644  {
1645  	return WLAN_INVALID_BAND;
1646  }
1647  
1648  static inline QDF_STATUS
wlan_populate_mlo_mgmt_event_param(struct wlan_objmgr_vdev * vdev,struct wlan_diag_packet_info * data,enum wlan_main_tag tag)1649  wlan_populate_mlo_mgmt_event_param(struct wlan_objmgr_vdev *vdev,
1650  				   struct wlan_diag_packet_info *data,
1651  				   enum wlan_main_tag tag)
1652  {
1653  	return QDF_STATUS_SUCCESS;
1654  }
1655  
1656  static inline void
wlan_cdp_set_peer_freq(struct wlan_objmgr_psoc * psoc,uint8_t * peer_mac,uint32_t freq,uint8_t vdev_id)1657  wlan_cdp_set_peer_freq(struct wlan_objmgr_psoc *psoc, uint8_t *peer_mac,
1658  		       uint32_t freq, uint8_t vdev_id)
1659  {}
1660  
1661  static inline void
wlan_connectivity_mlo_reconfig_event(struct wlan_objmgr_vdev * vdev)1662  wlan_connectivity_mlo_reconfig_event(struct wlan_objmgr_vdev *vdev)
1663  {
1664  }
1665  
1666  static inline void
wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,bool is_roam)1667  wlan_connectivity_sta_info_event(struct wlan_objmgr_psoc *psoc,
1668  				 uint8_t vdev_id, bool is_roam)
1669  {}
1670  
1671  static inline void
wlan_connectivity_t2lm_req_resp_event(struct wlan_objmgr_vdev * vdev,uint8_t token,enum wlan_t2lm_resp_frm_type status,enum qdf_dp_tx_rx_status tx_status,qdf_freq_t freq,bool is_rx,uint8_t subtype)1672  wlan_connectivity_t2lm_req_resp_event(struct wlan_objmgr_vdev *vdev,
1673  				      uint8_t token,
1674  				      enum wlan_t2lm_resp_frm_type status,
1675  				      enum qdf_dp_tx_rx_status tx_status,
1676  				      qdf_freq_t freq,
1677  				      bool is_rx, uint8_t subtype)
1678  {}
1679  
1680  static inline void
wlan_connectivity_t2lm_status_event(struct wlan_objmgr_vdev * vdev)1681  wlan_connectivity_t2lm_status_event(struct wlan_objmgr_vdev *vdev)
1682  {
1683  }
1684  
1685  static inline void
wlan_connectivity_connecting_event(struct wlan_objmgr_vdev * vdev,struct wlan_cm_connect_req * con_req)1686  wlan_connectivity_connecting_event(struct wlan_objmgr_vdev *vdev,
1687  				   struct wlan_cm_connect_req *con_req)
1688  {
1689  }
1690  #endif
1691  
1692  #if defined(CONNECTIVITY_DIAG_EVENT) && defined(WLAN_FEATURE_11BE_MLO)
1693  /**
1694   * wlan_connectivity_mld_link_status_event() - Send connectivity logging
1695   * ML Link Status event
1696   * @psoc: Pointer to global PSOC object
1697   * @src: Src parameters to be sent
1698   *
1699   * Return: None
1700   */
1701  void
1702  wlan_connectivity_mld_link_status_event(struct wlan_objmgr_psoc *psoc,
1703  					struct mlo_link_switch_params *src);
1704  #else
1705  static inline
wlan_connectivity_mld_link_status_event(struct wlan_objmgr_psoc * psoc,struct mlo_link_switch_params * src)1706  void wlan_connectivity_mld_link_status_event(struct wlan_objmgr_psoc *psoc,
1707  					     struct mlo_link_switch_params *src)
1708  {}
1709  #endif /* CONNECTIVITY_DIAG_EVENT && WLAN_FEATURE_11BE_MLO */
1710  #endif /* _WLAN_CONNECTIVITY_LOGGING_H_ */
1711