1 /* 2 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /** 18 * DOC: Define Common MLME structure and APIs 19 */ 20 #ifndef _WLAN_MLME_CMN_H_ 21 #define _WLAN_MLME_CMN_H_ 22 23 #include <include/wlan_psoc_mlme.h> 24 #include <include/wlan_pdev_mlme.h> 25 #include <include/wlan_vdev_mlme.h> 26 #ifdef FEATURE_CM_ENABLE 27 #include "wlan_cm_public_struct.h" 28 #endif 29 30 /** 31 * struct vdev_mlme_ext_ops - VDEV MLME legacy callbacks structure 32 * @mlme_psoc_ext_hdl_create: callback to invoke creation of legacy 33 * psoc object 34 * @mlme_psoc_ext_hdl_destroy: callback to invoke destroy of legacy 35 * psoc object 36 * @mlme_pdev_ext_hdl_create: callback to invoke creation of legacy 37 * pdev object 38 * @mlme_pdev_ext_hdl_destroy: callback to invoke destroy of legacy 39 * pdev object 40 * @mlme_vdev_ext_hdl_create: callback to invoke creation of legacy 41 * vdev object 42 * @mlme_vdev_ext_hdl_post_create: callback to invoke post creation actions 43 * of legacy vdev object 44 * @mlme_vdev_ext_hdl_destroy: callback to invoke destroy of legacy 45 * vdev object 46 * @mlme_vdev_start_fw_send: callback to invoke vdev start command 47 * @mlme_vdev_stop_fw_send: callback to invoke vdev stop command 48 * @mlme_vdev_down_fw_send: callback to invoke vdev down command 49 * @mlme_multivdev_restart_fw_send: callback to invoke multivdev restart 50 * command 51 * @mlme_vdev_enqueue_exp_cmd: callback to enqueue exception command 52 * required by serialization 53 * @mlme_multi_vdev_restart_resp: callback to process multivdev restart 54 * response 55 * @mlme_cm_ext_connect_start: Callback to start connect request 56 * @mlme_cm_ext_connect_active: Callback to indicate connect active 57 * @mlme_cm_ext_bss_peer_create_req: Callback to bss peer create request 58 * @mlme_cm_ext_connect_req: Callback for connect request to LIM 59 * @mlme_cm_ext_connect_complete: Callback to indicate connect complete 60 * @mlme_cm_ext_disconnect_start : Callback to start disconnect request 61 * @mlme_cm_ext_disconnect_active: Callback to indicate disconnect active 62 * @mlme_cm_ext_bss_peer_delete_req: Callback to bss peer delete request 63 * @mlme_cm_ext_disconnect_complete: Callback to indicate disconnect 64 * complete 65 * @mlme_cm_ext_osif_connect: Callback to indicate connect complete 66 * @mlme_cm_ext_osif_disconnect: Callback to indicate disconnect complete 67 * @mlme_cm_ext_vdev_down: Callback to send vdev down to FW 68 */ 69 struct mlme_ext_ops { 70 QDF_STATUS (*mlme_psoc_ext_hdl_create)( 71 struct psoc_mlme_obj *psoc_mlme); 72 QDF_STATUS (*mlme_psoc_ext_hdl_destroy)( 73 struct psoc_mlme_obj *pdev_mlme); 74 QDF_STATUS (*mlme_pdev_ext_hdl_create)( 75 struct pdev_mlme_obj *pdev_mlme); 76 QDF_STATUS (*mlme_pdev_ext_hdl_destroy)( 77 struct pdev_mlme_obj *pdev_mlme); 78 QDF_STATUS (*mlme_vdev_ext_hdl_create)( 79 struct vdev_mlme_obj *vdev_mlme); 80 QDF_STATUS (*mlme_vdev_ext_hdl_post_create)( 81 struct vdev_mlme_obj *vdev_mlme); 82 QDF_STATUS (*mlme_vdev_ext_hdl_destroy)( 83 struct vdev_mlme_obj *vdev_mlme); 84 QDF_STATUS (*mlme_vdev_start_fw_send)( 85 struct wlan_objmgr_vdev *vdev, uint8_t restart); 86 QDF_STATUS (*mlme_vdev_stop_fw_send)(struct wlan_objmgr_vdev *vdev); 87 QDF_STATUS (*mlme_vdev_down_fw_send)(struct wlan_objmgr_vdev *vdev); 88 QDF_STATUS (*mlme_multivdev_restart_fw_send)( 89 struct wlan_objmgr_pdev *pdev); 90 QDF_STATUS (*mlme_vdev_enqueue_exp_cmd)( 91 struct vdev_mlme_obj *vdev_mlme, 92 uint8_t cmd_type); 93 QDF_STATUS (*mlme_vdev_ext_delete_rsp)( 94 struct wlan_objmgr_psoc *psoc, 95 struct vdev_delete_response *rsp); 96 QDF_STATUS (*mlme_multi_vdev_restart_resp)( 97 struct wlan_objmgr_psoc *psoc, 98 struct multi_vdev_restart_resp *resp); 99 #ifdef FEATURE_CM_ENABLE 100 QDF_STATUS (*mlme_cm_ext_connect_start)( 101 struct wlan_objmgr_vdev *vdev, 102 struct wlan_cm_connect_req *cm_conn_req); 103 QDF_STATUS (*mlme_cm_ext_connect_active)( 104 struct wlan_objmgr_vdev *vdev, 105 struct wlan_cm_vdev_connect_req *vdev_connect_req); 106 QDF_STATUS (*mlme_cm_ext_bss_peer_create_req)( 107 struct wlan_objmgr_vdev *vdev, 108 struct qdf_mac_addr *peer_mac); 109 QDF_STATUS (*mlme_cm_ext_connect_req)( 110 struct wlan_objmgr_vdev *vdev, 111 struct wlan_cm_vdev_connect_req *vdev_connect_req); 112 QDF_STATUS (*mlme_cm_ext_connect_complete)( 113 struct wlan_objmgr_vdev *vdev, 114 struct wlan_cm_connect_rsp *connect_rsp); 115 QDF_STATUS (*mlme_cm_ext_disconnect_start)( 116 struct wlan_objmgr_vdev *vdev, 117 struct wlan_cm_disconnect_req *cm_conn_req); 118 QDF_STATUS (*mlme_cm_ext_disconnect_active) 119 (struct wlan_objmgr_vdev *vdev, 120 struct wlan_cm_vdev_discon_req *vdev_disconnect_req); 121 QDF_STATUS (*mlme_cm_ext_bss_peer_delete_req)( 122 struct wlan_objmgr_vdev *vdev); 123 QDF_STATUS (*mlme_cm_ext_disconnect_complete)( 124 struct wlan_objmgr_vdev *vdev, 125 struct wlan_cm_discon_rsp *cm_disconnect_rsp); 126 QDF_STATUS (*mlme_cm_ext_osif_connect)( 127 struct wlan_objmgr_vdev *vdev, 128 struct wlan_cm_connect_rsp *cm_connect_rsp); 129 QDF_STATUS (*mlme_cm_ext_osif_disconnect)( 130 struct wlan_objmgr_vdev *vdev, 131 struct wlan_cm_discon_rsp *cm_disconnect_rsp); 132 QDF_STATUS (*mlme_cm_ext_vdev_down)( 133 struct wlan_objmgr_vdev *vdev); 134 #endif 135 }; 136 137 /** 138 * mlme_psoc_ops_ext_hdl_create() - Alloc PSOC mlme ext handle 139 * @psoc_mlme: PSOC MLME comp object 140 * 141 * API to allocate PSOC MLME ext handle 142 * 143 * Return: SUCCESS on successful allocation 144 * Else FAILURE 145 */ 146 QDF_STATUS mlme_psoc_ops_ext_hdl_create(struct psoc_mlme_obj *psoc_mlme); 147 148 /** 149 * mlme_psoc_ops_ext_hdl_destroy() - Destroy PSOC mlme ext handle 150 * @psoc_mlme: PSOC MLME comp object 151 * 152 * API to free psoc MLME ext handle 153 * 154 * Return: SUCCESS on successful free 155 * Else FAILURE 156 */ 157 QDF_STATUS mlme_psoc_ops_ext_hdl_destroy(struct psoc_mlme_obj *psoc_mlme); 158 159 /** 160 * mlme_pdev_ops_ext_hdl_create - Alloc PDEV mlme ext handle 161 * @pdev_mlme_obj: PDEV MLME comp object 162 * 163 * API to allocate PDEV MLME ext handle 164 * 165 * Return: SUCCESS on successful allocation 166 * Else FAILURE 167 */ 168 QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme); 169 170 /** 171 * mlme_pdev_ops_ext_hdl_destroy - Destroy PDEV mlme ext handle 172 * @pdev_mlme_obj: PDEV MLME comp object 173 * 174 * API to free pdev MLME ext handle 175 * 176 * Return: SUCCESS on successful free 177 * Else FAILURE 178 */ 179 QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme); 180 181 /** 182 * mlme_vdev_ops_ext_hdl_create - Alloc VDEV mlme ext handle 183 * @vdev_mlme_obj: VDEV MLME comp object 184 * 185 * API to allocate VDEV MLME ext handle 186 * 187 * Return: SUCCESS on successful allocation 188 * Else FAILURE 189 */ 190 QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme); 191 192 /** 193 * mlme_vdev_ops_ext_hdl_post_create - Perform post VDEV mlme ext handle alloc 194 * operations 195 * @vdev_mlme_obj: VDEV MLME comp object 196 * 197 * API to perform post vdev MLME ext handle allocation operations 198 * 199 * Return: SUCCESS on initialization successful 200 * Else FAILURE 201 */ 202 QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme); 203 204 /** 205 * mlme_vdev_ops_ext_hdl_destroy - Destroy VDEV mlme ext handle 206 * @vdev_mlme_obj: VDEV MLME comp object 207 * 208 * API to free vdev MLME ext handle 209 * 210 * Return: SUCCESS on successful free 211 * Else FAILURE 212 */ 213 QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme); 214 215 /** 216 * mlme_vdev_enqueue_exp_ser_cmd - Enqueue exception serialization cmd 217 * @vdev_mlme_obj: VDEV MLME comp object 218 * @cmd_type: Serialization command type 219 * 220 * API to enqueue the exception serialization command, used by 221 * mlme-serialization wrapper layer 222 * 223 * Return: SUCCESS on successful enqueuing the command 224 * Else FAILURE 225 */ 226 QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme, 227 uint8_t cmd_type); 228 229 /** 230 * mlme_vdev_ops_start_fw_send - Send WMI START/RESTART commmand to FW 231 * @vdev: VDEV object 232 * 233 * API to send WMI start/restart command to FW 234 * 235 * Return: SUCCESS on successful sending the command 236 * Else FAILURE 237 */ 238 QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev, 239 uint8_t restart); 240 241 /** 242 * mlme_vdev_ops_multivdev_restart_fw_cmd_send - Send WMI Multivdev restart 243 * commmand to FW 244 * @pdev: PDEV object 245 * 246 * API to send WMI multivdev restart command to FW 247 * 248 * Return: SUCCESS on successful sending the command 249 * Else FAILURE 250 */ 251 QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send( 252 struct wlan_objmgr_pdev *pdev); 253 254 /** 255 * mlme_vdev_ops_stop_fw_send - Send WMI STOP commmand to FW 256 * @vdev: VDEV object 257 * 258 * API to send WMI stop command to FW 259 * 260 * Return: SUCCESS on successful sending the command 261 * Else FAILURE 262 */ 263 QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev); 264 265 /** 266 * mlme_vdev_ops_down_fw_send - Send WMI Down commmand to FW 267 * @vdev: VDEV object 268 * 269 * API to send WMI down command to FW 270 * 271 * Return: SUCCESS on successful sending the command 272 * Else FAILURE 273 */ 274 QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev); 275 276 /* 277 * mlme_vdev_ops_ext_hdl_multivdev_restart_resp() - Handler multivdev restart 278 * response event 279 * @psoc: PSOC object manager handle 280 * @resp: Restart response event 281 * 282 * Return: Success on successful handling of the response event, 283 * Else failure 284 */ 285 QDF_STATUS mlme_vdev_ops_ext_hdl_multivdev_restart_resp( 286 struct wlan_objmgr_psoc *psoc, 287 struct multi_vdev_restart_resp *resp); 288 289 /** 290 * mlme_set_ops_register_cb - Sets ops registration callback 291 * @ops_cb: Function pointer 292 * 293 * API to set ops registration call back 294 * 295 * Return: void 296 */ 297 typedef struct mlme_ext_ops *(*mlme_get_global_ops_cb)(void); 298 void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb); 299 300 /** 301 * wlan_cmn_mlme_init - Initializes MLME component 302 * 303 * Registers callbacks with object manager for create/destroy 304 * 305 * Return: SUCCESS on successful registration 306 * FAILURE, if registration fails 307 */ 308 QDF_STATUS wlan_cmn_mlme_init(void); 309 310 /** 311 * wlan_cmn_mlme_deinit - Uninitializes MLME component 312 * 313 * Unregisters callbacks with object manager for create/destroy 314 * 315 * Return: SUCCESS on successful registration 316 * FAILURE, if registration fails 317 */ 318 QDF_STATUS wlan_cmn_mlme_deinit(void); 319 320 /** 321 * mlme_vdev_ops_ext_hdl_delete_rsp - Vdev Delete response ext handler 322 * @psoc: PSOC object 323 * @rsp: Vdev delete response received from the firmware 324 * 325 * API to invoke the legacy delete response handler for legacy cleanup 326 * 327 * Return: SUCCESS on successful deletion 328 * FAILURE, if deletion fails 329 */ 330 QDF_STATUS mlme_vdev_ops_ext_hdl_delete_rsp(struct wlan_objmgr_psoc *psoc, 331 struct vdev_delete_response *rsp); 332 333 #ifdef FEATURE_CM_ENABLE 334 /** 335 * mlme_cm_ops_ext_connect_start - Connection manager connect start 336 * handler 337 * @vdev: VDEV object 338 * @req: Connection manager connect request 339 * 340 * Return: QDF_STATUS 341 */ 342 QDF_STATUS mlme_cm_ops_ext_connect_start(struct wlan_objmgr_vdev *vdev, 343 struct wlan_cm_connect_req *req); 344 345 /** 346 * mlme_cm_ops_ext_connect_active - Connection manager indicate connect 347 * active handler 348 * @vdev: VDEV object 349 * @req: Vdev connect request 350 * 351 * Return: QDF_STATUS 352 */ 353 QDF_STATUS mlme_cm_ops_ext_connect_active(struct wlan_objmgr_vdev *vdev, 354 struct wlan_cm_vdev_connect_req *req); 355 356 /** 357 * mlme_cm_ops_ext_bss_peer_create_req - Connection manager bss peer 358 * create request handler 359 * @vdev: VDEV object 360 * @peer_mac: Peer mac address 361 * 362 * Return: QDF_STATUS 363 */ 364 QDF_STATUS mlme_cm_ops_ext_bss_peer_create_req(struct wlan_objmgr_vdev *vdev, 365 struct qdf_mac_addr *peer_mac); 366 367 /** 368 * mlme_cm_ops_ext_connect_req - Connection manager connect request handler 369 * @vdev: VDEV object 370 * @req: Vdev connect request 371 * 372 * Return: QDF_STATUS 373 */ 374 QDF_STATUS mlme_cm_ops_ext_connect_req(struct wlan_objmgr_vdev *vdev, 375 struct wlan_cm_vdev_connect_req *req); 376 377 /** 378 * mlme_cm_ops_ext_connect_complete - Connection manager connect complete 379 * handler 380 * @vdev: VDEV object 381 * @rsp: Connection manager connect response 382 * 383 * Return: QDF_STATUS 384 */ 385 QDF_STATUS mlme_cm_ops_ext_connect_complete(struct wlan_objmgr_vdev *vdev, 386 struct wlan_cm_connect_rsp *rsp); 387 388 /** 389 * mlme_cm_ops_ext_disconnect_start - Connection manager disconnect start 390 * handler 391 * @vdev: VDEV object 392 * @req: Connection manager disconnect request 393 * 394 * Return: QDF_STATUS 395 */ 396 QDF_STATUS mlme_cm_ops_ext_disconnect_start(struct wlan_objmgr_vdev *vdev, 397 struct wlan_cm_disconnect_req *req); 398 399 /** 400 * mlme_cm_ops_ext_disconnect_active - Connection manager disconnect 401 * active handler 402 * @vdev: VDEV object 403 * @req: vdev disconnect request 404 * 405 * Return: QDF_STATUS 406 */ 407 QDF_STATUS 408 mlme_cm_ops_ext_disconnect_active(struct wlan_objmgr_vdev *vdev, 409 struct wlan_cm_vdev_discon_req *req); 410 411 /** 412 * mlme_cm_ops_ext_bss_peer_delete_req - Connection manager bss peer delete 413 * request handler 414 * @vdev: VDEV object 415 * 416 * Return: QDF_STATUS 417 */ 418 QDF_STATUS 419 mlme_cm_ops_ext_bss_peer_delete_req(struct wlan_objmgr_vdev *vdev); 420 421 /** 422 * mlme_cm_ops_ext_disconnect_complete - Connection manager disconnect 423 * complete handler 424 * @vdev: VDEV object 425 * @rsp: Connection manager disconnect response 426 * 427 * Return: QDF_STATUS 428 */ 429 QDF_STATUS mlme_cm_ops_ext_disconnect_complete(struct wlan_objmgr_vdev *vdev, 430 struct wlan_cm_discon_rsp *rsp); 431 432 /** 433 * mlme_cm_ops_ext_osif_connect - Connection manager osif connect handler 434 * @vdev: VDEV object 435 * @rsp: Connection manager connect response 436 * 437 * Return: QDF_STATUS 438 */ 439 QDF_STATUS mlme_cm_ops_ext_osif_connect(struct wlan_objmgr_vdev *vdev, 440 struct wlan_cm_connect_rsp *rsp); 441 442 /** 443 * mlme_cm_ops_ext_osif_disconnect - Connection manager osif disconnect 444 * handler 445 * @vdev: VDEV object 446 * @rsp: Connection manager disconnect response 447 * 448 * Return: QDF_STATUS 449 */ 450 QDF_STATUS mlme_cm_ops_ext_osif_disconnect(struct wlan_objmgr_vdev *vdev, 451 struct wlan_cm_discon_rsp *rsp); 452 453 /** 454 * mlme_cm_ops_ext_osif_disconnect - Function to send vdev down to FW 455 * @vdev: VDEV object 456 * 457 * Return: QDF_STATUS 458 */ 459 QDF_STATUS mlme_cm_ext_vdev_down(struct wlan_objmgr_vdev *vdev); 460 461 #endif 462 463 #endif 464