1 /* 2 * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 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_api.h 20 * 21 * This file maintains declarations of public apis 22 */ 23 24 #ifndef __WLAN_CM_API_H 25 #define __WLAN_CM_API_H 26 27 #include "wlan_cm_public_struct.h" 28 #include "wlan_ext_mlme_obj_types.h" 29 30 /** 31 * wlan_cm_start_connect() - connect start request 32 * @vdev: vdev pointer 33 * @req: connect req 34 * 35 * Return: QDF_STATUS 36 */ 37 QDF_STATUS wlan_cm_start_connect(struct wlan_objmgr_vdev *vdev, 38 struct wlan_cm_connect_req *req); 39 40 /** 41 * wlan_cm_disconnect() - disconnect start request 42 * @vdev: vdev pointer 43 * @source: disconnect source 44 * @reason_code: disconnect reason 45 * @bssid: bssid of AP to disconnect, can be null if not known 46 * 47 * Context: can be called from any context 48 * 49 * Return: QDF_STATUS 50 */ 51 QDF_STATUS wlan_cm_disconnect(struct wlan_objmgr_vdev *vdev, 52 enum wlan_cm_source source, 53 enum wlan_reason_code reason_code, 54 struct qdf_mac_addr *bssid); 55 56 /** 57 * wlan_cm_disconnect_sync() - disconnect request with wait till 58 * completed 59 * @vdev: vdev pointer 60 * @source: disconnect source 61 * @reason_code: disconnect reason 62 * 63 * Context: Only call for north bound disconnect req, if wait till complete 64 * is required, e.g. during vdev delete. Do not call from scheduler context. 65 * 66 * Return: QDF_STATUS 67 */ 68 QDF_STATUS wlan_cm_disconnect_sync(struct wlan_objmgr_vdev *vdev, 69 enum wlan_cm_source source, 70 enum wlan_reason_code reason_code); 71 72 /** 73 * wlan_cm_bss_select_ind_rsp() - Connection manager resp for bss 74 * select indication 75 * @vdev: vdev pointer 76 * @status: Status 77 * 78 * Return: QDF_STATUS 79 */ 80 QDF_STATUS wlan_cm_bss_select_ind_rsp(struct wlan_objmgr_vdev *vdev, 81 QDF_STATUS status); 82 83 /** 84 * wlan_cm_bss_peer_create_rsp() - Connection manager bss peer create response 85 * @vdev: vdev pointer 86 * @status: Status 87 * @peer_mac: Peer mac address 88 * 89 * Return: QDF_STATUS 90 */ 91 QDF_STATUS wlan_cm_bss_peer_create_rsp(struct wlan_objmgr_vdev *vdev, 92 QDF_STATUS status, 93 struct qdf_mac_addr *peer_mac); 94 95 /** 96 * wlan_cm_connect_rsp() - Connection manager connect response 97 * @vdev: vdev pointer 98 * @resp: Connect response 99 * 100 * Return: QDF_STATUS 101 */ 102 QDF_STATUS wlan_cm_connect_rsp(struct wlan_objmgr_vdev *vdev, 103 struct wlan_cm_connect_resp *resp); 104 105 /** 106 * wlan_cm_bss_peer_delete_ind() - Connection manager peer delete indication 107 * @vdev: vdev pointer 108 * @peer_mac: Peer mac address 109 * 110 * Return: QDF_STATUS 111 */ 112 QDF_STATUS wlan_cm_bss_peer_delete_ind(struct wlan_objmgr_vdev *vdev, 113 struct qdf_mac_addr *peer_mac); 114 115 /** 116 * wlan_cm_bss_peer_delete_rsp() - Connection manager peer delete response 117 * @vdev: vdev pointer 118 * @status: status 119 * 120 * Return: QDF_STATUS 121 */ 122 QDF_STATUS wlan_cm_bss_peer_delete_rsp(struct wlan_objmgr_vdev *vdev, 123 uint32_t status); 124 125 /** 126 * wlan_cm_disconnect_rsp() - Connection manager disconnect response 127 * @vdev: vdev pointer 128 * @resp: disconnect response 129 * 130 * Return: QDF_STATUS 131 */ 132 QDF_STATUS wlan_cm_disconnect_rsp(struct wlan_objmgr_vdev *vdev, 133 struct wlan_cm_discon_rsp *resp); 134 135 /** 136 * wlan_cm_set_max_connect_attempts() - Set max connect attempts 137 * @vdev: vdev pointer 138 * @max_connect_attempts: max connect attempts to be set. 139 * 140 * Set max connect attempts. Max value is limited to CM_MAX_CONNECT_ATTEMPTS. 141 * 142 * Return: void 143 */ 144 void wlan_cm_set_max_connect_attempts(struct wlan_objmgr_vdev *vdev, 145 uint8_t max_connect_attempts); 146 147 /** 148 * wlan_cm_set_max_connect_timeout() - Set max connect timeout 149 * @vdev: vdev pointer 150 * @max_connect_timeout: max connect timeout to be set. 151 * 152 * Set max connect timeout. 153 * 154 * Return: void 155 */ 156 void wlan_cm_set_max_connect_timeout(struct wlan_objmgr_vdev *vdev, 157 uint32_t max_connect_timeout); 158 159 /** 160 * wlan_cm_is_vdev_connecting() - check if vdev is in connecting state 161 * @vdev: vdev pointer 162 * 163 * Return: bool 164 */ 165 bool wlan_cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev); 166 167 /** 168 * wlan_cm_is_vdev_connected() - check if vdev is in connected state 169 * @vdev: vdev pointer 170 * 171 * Return: bool 172 */ 173 bool wlan_cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev); 174 175 /** 176 * wlan_cm_is_vdev_active() - check if vdev is in active state ie connected or 177 * roaming state 178 * @vdev: vdev pointer 179 * 180 * Return: bool 181 */ 182 bool wlan_cm_is_vdev_active(struct wlan_objmgr_vdev *vdev); 183 184 /** 185 * wlan_cm_is_vdev_disconnecting() - check if vdev is in disconnecting state 186 * @vdev: vdev pointer 187 * 188 * Return: bool 189 */ 190 bool wlan_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev); 191 192 /** 193 * wlan_cm_is_vdev_disconnected() - check if vdev is disconnected/init state 194 * @vdev: vdev pointer 195 * 196 * Return: bool 197 */ 198 bool wlan_cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev); 199 200 /** 201 * wlan_cm_is_vdev_roaming() - check if vdev is in roaming state 202 * @vdev: vdev pointer 203 * 204 * Return: bool 205 */ 206 bool wlan_cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev); 207 208 #ifdef WLAN_FEATURE_ROAM_OFFLOAD 209 /** 210 * wlan_cm_is_vdev_roam_started() - check if vdev is in roaming state and 211 * roam started sub stated 212 * @vdev: vdev pointer 213 * 214 * Return: bool 215 */ 216 bool wlan_cm_is_vdev_roam_started(struct wlan_objmgr_vdev *vdev); 217 218 /** 219 * wlan_cm_is_vdev_roam_sync_inprogress() - check if vdev is in roaming state 220 * and roam sync substate 221 * @vdev: vdev pointer 222 * 223 * Return: bool 224 */ 225 bool wlan_cm_is_vdev_roam_sync_inprogress(struct wlan_objmgr_vdev *vdev); 226 #else 227 static inline bool wlan_cm_is_vdev_roam_started(struct wlan_objmgr_vdev *vdev) 228 { 229 return false; 230 } 231 232 static inline 233 bool wlan_cm_is_vdev_roam_sync_inprogress(struct wlan_objmgr_vdev *vdev) 234 { 235 return false; 236 } 237 #endif 238 239 #ifdef WLAN_FEATURE_HOST_ROAM 240 /** 241 * wlan_cm_is_vdev_roam_preauth_state() - check if vdev is in roaming state and 242 * preauth is in progress 243 * @vdev: vdev pointer 244 * 245 * Return: bool 246 */ 247 bool wlan_cm_is_vdev_roam_preauth_state(struct wlan_objmgr_vdev *vdev); 248 249 /** 250 * wlan_cm_is_vdev_roam_reassoc_state() - check if vdev is in roaming state 251 * and reassoc is in progress 252 * @vdev: vdev pointer 253 * 254 * Return: bool 255 */ 256 bool wlan_cm_is_vdev_roam_reassoc_state(struct wlan_objmgr_vdev *vdev); 257 #else 258 static inline 259 bool wlan_cm_is_vdev_roam_preauth_state(struct wlan_objmgr_vdev *vdev) 260 { 261 return false; 262 } 263 264 static inline 265 bool wlan_cm_is_vdev_roam_reassoc_state(struct wlan_objmgr_vdev *vdev) 266 { 267 return false; 268 } 269 #endif 270 271 /** 272 * wlan_cm_get_active_connect_req() - Get copy of active connect request 273 * @vdev: vdev pointer 274 * @req: pointer to the copy of the active connect request 275 * * 276 * Context: Should be called only in the context of the 277 * cm request activation 278 * 279 * Return: true and connect req if any request is active 280 */ 281 bool wlan_cm_get_active_connect_req(struct wlan_objmgr_vdev *vdev, 282 struct wlan_cm_vdev_connect_req *req); 283 284 #ifdef WLAN_FEATURE_HOST_ROAM 285 /** 286 * wlan_cm_get_active_reassoc_req() - Get copy of active reassoc request 287 * @vdev: vdev pointer 288 * @req: pointer to the copy of the active reassoc request 289 * * 290 * Context: Should be called only in the context of the 291 * cm request activation 292 * 293 * Return: true and reassoc req if any request is active 294 */ 295 bool wlan_cm_get_active_reassoc_req(struct wlan_objmgr_vdev *vdev, 296 struct wlan_cm_vdev_reassoc_req *req); 297 #else 298 static inline 299 bool wlan_cm_get_active_reassoc_req(struct wlan_objmgr_vdev *vdev, 300 struct wlan_cm_vdev_reassoc_req *req) 301 { 302 return false; 303 } 304 #endif 305 306 /** 307 * wlan_cm_get_active_disconnect_req() - Get copy of active disconnect request 308 * @vdev: vdev pointer 309 * @req: pointer to the copy of the active disconnect request 310 * * 311 * Context: Should be called only in the context of the 312 * cm request activation 313 * 314 * Return: true and disconnect req if any request is active 315 */ 316 bool wlan_cm_get_active_disconnect_req(struct wlan_objmgr_vdev *vdev, 317 struct wlan_cm_vdev_discon_req *req); 318 319 /** 320 * wlan_cm_reason_code_to_str() - return string conversion of reason code 321 * @reason: reason code. 322 * 323 * This utility function helps log string conversion of reason code. 324 * 325 * Return: string conversion of reason code, if match found; 326 * "Unknown" otherwise. 327 */ 328 const char *wlan_cm_reason_code_to_str(enum wlan_reason_code reason); 329 330 /** 331 * wlan_cm_get_active_req_type() - return cm active request type 332 * @vdev: vdev pointer 333 * 334 * This function returns the cm active request type 335 * 336 * Return: active request type if any, otherwise return 0 337 */ 338 enum wlan_cm_active_request_type 339 wlan_cm_get_active_req_type(struct wlan_objmgr_vdev *vdev); 340 341 /** 342 * wlan_cm_get_ext_hdl() - Get connection manager ext context from vdev 343 * @vdev: vdev pointer 344 * 345 * Return: pointer to connection manager ext context 346 */ 347 cm_ext_t *wlan_cm_get_ext_hdl(struct wlan_objmgr_vdev *vdev); 348 349 #ifdef WLAN_FEATURE_HOST_ROAM 350 /** 351 * wlan_cm_reassoc_rsp() - Connection manager reassoc response 352 * @vdev: vdev pointer 353 * @resp: Connect response 354 * 355 * Return: QDF_STATUS 356 */ 357 QDF_STATUS wlan_cm_reassoc_rsp(struct wlan_objmgr_vdev *vdev, 358 struct wlan_cm_connect_resp *resp); 359 #else 360 static inline 361 QDF_STATUS wlan_cm_reassoc_rsp(struct wlan_objmgr_vdev *vdev, 362 struct wlan_cm_connect_resp *resp) 363 { 364 return QDF_STATUS_SUCCESS; 365 } 366 #endif 367 368 /** 369 * wlan_cm_hw_mode_change_resp() - HW mode change response 370 * @pdev: pdev pointer 371 * @vdev_id: vdev id 372 * @cm_id: connection ID which gave the hw mode change request 373 * @status: status of the HW mode change. 374 * 375 * Return: void 376 */ 377 #ifdef WLAN_POLICY_MGR_ENABLE 378 void wlan_cm_hw_mode_change_resp(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, 379 wlan_cm_id cm_id, QDF_STATUS status); 380 #endif /* ifdef POLICY_MGR_ENABLE */ 381 382 #ifdef SM_ENG_HIST_ENABLE 383 /** 384 * wlan_cm_sm_history_print() - Prints SM history 385 * @vdev: Objmgr vdev 386 * 387 * API to print CM SM history 388 * 389 * Return: void 390 */ 391 void wlan_cm_sm_history_print(struct wlan_objmgr_vdev *vdev); 392 393 /** 394 * wlan_cm_req_history_print() - Prints CM request history 395 * @vdev: Objmgr vdev 396 * 397 * API to print CM request history 398 * 399 * Return: void 400 */ 401 void wlan_cm_req_history_print(struct wlan_objmgr_vdev *vdev); 402 #else 403 static inline void wlan_cm_sm_history_print(struct wlan_objmgr_vdev *vdev) 404 { 405 } 406 407 static inline void wlan_cm_req_history_print(struct wlan_objmgr_vdev *vdev) 408 {} 409 #endif 410 411 #ifdef CONN_MGR_ADV_FEATURE 412 /** 413 * wlan_cm_set_candidate_advance_filter_cb() - Set CM candidate advance 414 * filter cb 415 * @vdev: Objmgr vdev 416 * @filter_fun: CM candidate advance filter cb 417 * 418 * Return: void 419 */ 420 static inline 421 void wlan_cm_set_candidate_advance_filter_cb( 422 struct wlan_objmgr_vdev *vdev, 423 void (*filter_fun)(struct wlan_objmgr_vdev *vdev, 424 struct scan_filter *filter)) 425 { 426 } 427 428 /** 429 * wlan_cm_set_candidate_custom_sort_cb() - Set CM candidate custom sort cb 430 * @vdev: Objmgr vdev 431 * @sort_fun: CM candidate custom sort cb 432 * 433 * Return: void 434 */ 435 static inline 436 void wlan_cm_set_candidate_custom_sort_cb( 437 struct wlan_objmgr_vdev *vdev, 438 void (*sort_fun)(struct wlan_objmgr_vdev *vdev, 439 qdf_list_t *list)) 440 { 441 } 442 #else 443 void wlan_cm_set_candidate_advance_filter_cb( 444 struct wlan_objmgr_vdev *vdev, 445 void (*filter_fun)(struct wlan_objmgr_vdev *vdev, 446 struct scan_filter *filter)); 447 448 void wlan_cm_set_candidate_custom_sort_cb( 449 struct wlan_objmgr_vdev *vdev, 450 void (*sort_fun)(struct wlan_objmgr_vdev *vdev, 451 qdf_list_t *list)); 452 #endif 453 454 /** 455 * wlan_cm_get_rnr() - get rnr 456 * @vdev:vdev 457 * @cm_id: connect mgr id 458 * 459 * Return: rnr pointer 460 */ 461 struct reduced_neighbor_report *wlan_cm_get_rnr(struct wlan_objmgr_vdev *vdev, 462 wlan_cm_id cm_id); 463 464 /** 465 * wlan_cm_disc_cont_after_rso_stop() - Continue disconnect after RSO stop 466 * @vdev: Objmgr vdev 467 * @req: pointer to cm vdev disconnect req 468 * 469 * Continue disconnect after RSO stop response is receive from south bound. 470 * This is a wrapper to call core API cm_disconnect_continue_after_rso_stop 471 * by acquiring cm_lock through cm_sm_deliver_event. 472 * 473 * Return: QDF_STATUS 474 */ 475 QDF_STATUS 476 wlan_cm_disc_cont_after_rso_stop(struct wlan_objmgr_vdev *vdev, 477 struct wlan_cm_vdev_discon_req *req); 478 479 #ifdef WLAN_FEATURE_11BE 480 /** 481 * wlan_cm_sta_set_chan_param() - set channel parameters for 802.11be sta 482 * 483 * @vdev: vdev 484 * @ch_freq: operating channel frequency 485 * @ori_bw: bandwidth information according to EHT operation IE 486 * @ori_punc: original puncture bitmap from EHT operation IE 487 * @ccfs0: EHT channel center frequency segment0 information 488 * @ccfs1: EHT channel center frequency segment1 information 489 * @chan_param: chan_param to be set 490 * 491 * ori_bw, ori_punc, ccfs0, ccfs1 are information from AP EHT operation IE 492 * chan_param->ch_width is the intersected channel width based on STA's 493 * capability. Complete chan_param including puncture will be set if 494 * it returns success. 495 * 496 * Return: QDF_STATUS 497 */ 498 QDF_STATUS wlan_cm_sta_set_chan_param(struct wlan_objmgr_vdev *vdev, 499 qdf_freq_t ch_freq, 500 enum phy_ch_width ori_bw, 501 uint16_t ori_punc, 502 uint8_t ccfs0, uint8_t ccfs1, 503 struct ch_params *chan_param); 504 505 /** 506 * wlan_cm_sta_update_bw_puncture() - update puncture and channel width for sta 507 * @vdev: vdev 508 * @peer_mac: peer mac address 509 * @ori_punc: original puncture bitmap from EHT operation IE 510 * @ori_bw: bandwidth information according to EHT operation IE 511 * @ccfs0: EHT Channel Centre Frequency Segment0 information 512 * @ccfs1: EHT Channel Centre Frequency Segment1 information 513 * @new_bw: bandwidth to be set 514 */ 515 QDF_STATUS wlan_cm_sta_update_bw_puncture(struct wlan_objmgr_vdev *vdev, 516 uint8_t *peer_mac, 517 uint16_t ori_punc, 518 enum phy_ch_width ori_bw, 519 uint8_t ccfs0, uint8_t ccfs1, 520 enum phy_ch_width new_bw); 521 #endif /* WLAN_FEATURE_11BE */ 522 523 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_FEATURE_11BE_MLO_ADV_FEATURE) 524 525 /** 526 * wlan_cm_check_mlo_roam_auth_status - api to check roam auth status on link 527 * @vdev: vdev corresponds to given link 528 * 529 * This api will be called to check if roam auth status is connected 530 * 531 * Return: boolean true or false 532 */ 533 bool 534 wlan_cm_check_mlo_roam_auth_status(struct wlan_objmgr_vdev *vdev); 535 #else 536 static inline bool 537 wlan_cm_check_mlo_roam_auth_status(struct wlan_objmgr_vdev *vdev) 538 { 539 return false; 540 } 541 #endif 542 #endif /* __WLAN_CM_UCFG_API_H */ 543