1 /* 2 * Copyright (c) 2016-2019, 2021 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 /** 19 * DOC: Public APIs to perform operations on Global objects 20 */ 21 #ifndef _WLAN_OBJMGR_GLOBAL_OBJ_H_ 22 #define _WLAN_OBJMGR_GLOBAL_OBJ_H_ 23 24 /** 25 * wlan_objmgr_global_obj_init() - global object initialization 26 * 27 * Creates global object, intializes with default values 28 * 29 * Return: SUCCESS on successful creation, 30 * FAILURE on Mem alloc failure or allocated already 31 * 32 */ 33 QDF_STATUS wlan_objmgr_global_obj_init(void); 34 35 /** 36 * wlan_objmgr_global_obj_deinit() - global object deinitialization 37 * 38 * Deletes global object 39 * 40 * Return: SUCCESS on successful deletion, 41 * FAILURE on object is not found 42 * 43 */ 44 QDF_STATUS wlan_objmgr_global_obj_deinit(void); 45 46 /** 47 * wlan_objmgr_global_obj_can_destroyed() - Checks whether global object 48 * can be destroyed 49 * 50 * Checks the psoc table of global object, if psoc table is empty 51 * returns the SUCCESS 52 * 53 * Return: SUCCESS on can be destroyed, 54 * FAILURE on can't be destroyed 55 * 56 */ 57 QDF_STATUS wlan_objmgr_global_obj_can_destroyed(void); 58 59 /** 60 * wlan_objmgr_register_psoc_create_handler() - register psoc create handler 61 * @id: component id 62 * @handler: function pointer of the component 63 * @args: args, if component wants certain args to be passed on PSOC creation 64 * 65 * API, allows other UMAC components to register handler 66 * The registered handler would be invoked on PSOC creation 67 * 68 * Return: SUCCESS, 69 * Failure (if registration fails, each failure has different error 70 * code) 71 */ 72 QDF_STATUS wlan_objmgr_register_psoc_create_handler( 73 enum wlan_umac_comp_id id, 74 wlan_objmgr_psoc_create_handler handler, 75 void *args); 76 77 /** 78 * wlan_objmgr_unregister_psoc_create_handler() - unregister psoc create handler 79 * @id: component id 80 * @handler: function pointer of the component 81 * @args: args, if component wants certain args to be passed on PSOC creation 82 * 83 * API, allows other UMAC components to unregister handler 84 * 85 * Return: SUCCESS, 86 * Failure (if handler is not present, each failure has different error 87 * code) 88 */ 89 QDF_STATUS wlan_objmgr_unregister_psoc_create_handler( 90 enum wlan_umac_comp_id id, 91 wlan_objmgr_psoc_create_handler handler, 92 void *args); 93 94 /** 95 * wlan_objmgr_register_psoc_destroy_handler() - register destroy handler 96 * @id: component id 97 * @handler: function pointer of the component 98 * @args: args, if component wants certain args to be passed on PSOC deletion 99 * 100 * API, allows other UMAC components to register handler 101 * The registered handler would be invoked on PSOC deletion 102 * 103 * Return: SUCCESS, 104 * Failure (if registration fails, each failure has different error 105 * code) 106 */ 107 QDF_STATUS wlan_objmgr_register_psoc_destroy_handler( 108 enum wlan_umac_comp_id id, 109 wlan_objmgr_psoc_destroy_handler handler, 110 void *args); 111 112 /** 113 * wlan_objmgr_unregister_psoc_destroy_handler() - unregister destroy handler 114 * @id: component id 115 * @handler: function pointer of the component 116 * @args: args, if component wants certain args to be passed on PSOC deletion 117 * 118 * API, allows other UMAC components to unregister handler 119 * 120 * Return: SUCCESS, 121 * Failure (if handler is not present, each failure has different error 122 * code) 123 */ 124 QDF_STATUS wlan_objmgr_unregister_psoc_destroy_handler( 125 enum wlan_umac_comp_id id, 126 wlan_objmgr_psoc_destroy_handler handler, 127 void *args); 128 129 /** 130 * wlan_objmgr_register_psoc_status_handler() - register status handler 131 * @id: component id 132 * @handler: function pointer of the component 133 * @args: args, if component wants certain args to be passed on PSOC status 134 * change 135 * 136 * API, allows other UMAC components to register handler 137 * The registered handler would be invoked on PSOC object status change 138 * 139 * Return: SUCCESS, 140 * Failure (if registration fails, each failure has different error 141 * code) 142 */ 143 QDF_STATUS wlan_objmgr_register_psoc_status_handler( 144 enum wlan_umac_comp_id id, 145 wlan_objmgr_psoc_status_handler handler, 146 void *args); 147 148 /** 149 * wlan_objmgr_unregister_psoc_status_handler() - unregister status handler 150 * @id: component id 151 * @handler: function pointer of the component 152 * @args: args, if component wants certain args to be passed on PSOC status 153 * 154 * API, allows other UMAC components to unregister handler 155 * 156 * Return: SUCCESS, 157 * Failure (if handler is not present, each failure has different error 158 * code) 159 */ 160 QDF_STATUS wlan_objmgr_unregister_psoc_status_handler( 161 enum wlan_umac_comp_id id, 162 wlan_objmgr_psoc_status_handler handler, 163 void *args); 164 165 /** 166 * wlan_objmgr_register_pdev_create_handler() - register pdev create handler 167 * @id: component id 168 * @handler: function pointer of the component 169 * @args: args, if component wants certain args to be passed on PDEV creation 170 * 171 * API, allows other UMAC components to register handler 172 * The registered handler would be invoked on PDEV creation 173 * 174 * Return: SUCCESS, 175 * Failure (if registration fails, each failure has different error 176 * code) 177 */ 178 QDF_STATUS wlan_objmgr_register_pdev_create_handler( 179 enum wlan_umac_comp_id id, 180 wlan_objmgr_pdev_create_handler handler, 181 void *args); 182 183 /** 184 * wlan_objmgr_unregister_pdev_create_handler() - unregister pdev create handler 185 * @id: component id 186 * @handler: function pointer of the component 187 * @args: args, if component wants certain args to be passed on PDEV creation 188 * 189 * API, allows other UMAC components to unregister handler 190 * 191 * Return: SUCCESS, 192 * Failure (if handler is not present, each failure has different error 193 * code) 194 */ 195 QDF_STATUS wlan_objmgr_unregister_pdev_create_handler( 196 enum wlan_umac_comp_id id, 197 wlan_objmgr_pdev_create_handler handler, 198 void *args); 199 200 /** 201 * wlan_objmgr_register_pdev_destroy_handler() - register pdev destroy handler 202 * @id: component id 203 * @handler: function pointer of the component 204 * @args: args, if component wants certain args to be passed on PDEV deletion 205 * 206 * API, allows other UMAC components to register handler 207 * The registered handler would be invoked on PDEV deletion 208 * 209 * Return: SUCCESS, 210 * Failure (if registration fails, each failure has different error 211 * code) 212 */ 213 QDF_STATUS wlan_objmgr_register_pdev_destroy_handler( 214 enum wlan_umac_comp_id id, 215 wlan_objmgr_pdev_destroy_handler handler, 216 void *args); 217 218 /** 219 * wlan_objmgr_unregister_pdev_destroy_handler() - unregister pdev destroy handler 220 * @id: component id 221 * @handler: function pointer of the component 222 * @args: args, if component wants certain args to be passed on PDEV deletion 223 * 224 * API, allows other UMAC components to unregister handler 225 * 226 * Return: SUCCESS, 227 * Failure (if handler is not present, each failure has different error 228 * code) 229 */ 230 QDF_STATUS wlan_objmgr_unregister_pdev_destroy_handler( 231 enum wlan_umac_comp_id id, 232 wlan_objmgr_pdev_destroy_handler handler, 233 void *args); 234 235 /** 236 * wlan_objmgr_register_pdev_status_handler() - register pdev status handler 237 * @id: component id 238 * @handler: function pointer of the component 239 * @args: args, if component wants certain args to be passed on PDEV status 240 * change 241 * 242 * API, allows other UMAC components to register handler 243 * The registered handler would be invoked on PDEV object status change 244 * 245 * Return: SUCCESS, 246 * Failure (if registration fails, each failure has different error 247 * code) 248 */ 249 QDF_STATUS wlan_objmgr_register_pdev_status_handler( 250 enum wlan_umac_comp_id id, 251 wlan_objmgr_pdev_status_handler handler, 252 void *args); 253 254 /** 255 * wlan_objmgr_unregister_pdev_status_handler() - unregister pdev status handler 256 * @id: component id 257 * @handler: function pointer of the component 258 * @args: args, if component wants certain args to be passed on PDEV status 259 * 260 * API, allows other UMAC components to unregister handler 261 * 262 * Return: SUCCESS, 263 * Failure (if handler is not present, each failure has different error 264 * code) 265 */ 266 QDF_STATUS wlan_objmgr_unregister_pdev_status_handler( 267 enum wlan_umac_comp_id id, 268 wlan_objmgr_pdev_status_handler handler, 269 void *args); 270 271 /** 272 * wlan_objmgr_register_vdev_create_handler() - register vdev create handler 273 * @id: component id 274 * @handler: function pointer of the component 275 * @args: args, if component wants certain args to be passed on VDEV creation 276 * 277 * API, allows other UMAC components to register handler 278 * The registered handler would be invoked on VDEV creation 279 * 280 * Return: SUCCESS, 281 * Failure (if registration fails, each failure has different error 282 * code) 283 */ 284 QDF_STATUS wlan_objmgr_register_vdev_create_handler( 285 enum wlan_umac_comp_id id, 286 wlan_objmgr_vdev_create_handler handler, 287 void *args); 288 289 /** 290 * wlan_objmgr_unregister_vdev_create_handler() - unregister vdev create handler 291 * @id: component id 292 * @handler: function pointer of the component 293 * @args: args, if component wants certain args to be passed on VDEV creation 294 * 295 * API, allows other UMAC components to unregister handler 296 * 297 * Return: SUCCESS, 298 * Failure (if handler is not present, each failure has different error 299 * code) 300 */ 301 QDF_STATUS wlan_objmgr_unregister_vdev_create_handler( 302 enum wlan_umac_comp_id id, 303 wlan_objmgr_vdev_create_handler handler, 304 void *args); 305 306 /** 307 * wlan_objmgr_register_vdev_destroy_handler() - register vdev destroy handler 308 * @id: component id 309 * @handler: function pointer of the component 310 * @args: args, if component wants certain args to be passed on VDEV deletion 311 * 312 * API, allows other UMAC components to register handler 313 * The registered handler would be invoked on VDEV deletion 314 * 315 * Return: SUCCESS, 316 * Failure (if registration fails, each failure has different error 317 * code) 318 */ 319 QDF_STATUS wlan_objmgr_register_vdev_destroy_handler( 320 enum wlan_umac_comp_id id, 321 wlan_objmgr_vdev_destroy_handler handler, 322 void *args); 323 324 /** 325 * wlan_objmgr_unregister_vdev_destroy_handler() - unregister vdev destroy handler 326 * @id: component id 327 * @handler: function pointer of the component 328 * @args: args, if component wants certain args to be passed on VDEV deletion 329 * 330 * API, allows other UMAC components to unregister handler 331 * 332 * Return: SUCCESS, 333 * Failure (if handler is not present, each failure has different error 334 * code) 335 */ 336 QDF_STATUS wlan_objmgr_unregister_vdev_destroy_handler( 337 enum wlan_umac_comp_id id, 338 wlan_objmgr_vdev_destroy_handler handler, 339 void *args); 340 341 /** 342 * wlan_objmgr_register_vdev_status_handler() - register vdev status handler 343 * @id: component id 344 * @handler: function pointer of the component 345 * @args: args, if component wants certain args to be passed on VDEV status 346 * change 347 * 348 * API, allows other UMAC components to register handler 349 * The registered handler would be invoked on VDEV object status change 350 * 351 * Return: SUCCESS, 352 * Failure (if registration fails, each failure has different error 353 * code) 354 */ 355 QDF_STATUS wlan_objmgr_register_vdev_status_handler( 356 enum wlan_umac_comp_id id, 357 wlan_objmgr_vdev_status_handler handler, 358 void *args); 359 360 /** 361 * wlan_objmgr_unregister_vdev_status_handler() - unregister vdev status handler 362 * @id: component id 363 * @handler: function pointer of the component 364 * @args: args, if component wants certain args to be passed on VDEV status 365 * 366 * API, allows other UMAC components to unregister handler 367 * 368 * Return: SUCCESS, 369 * Failure (if handler is not present, each failure has different error 370 * code) 371 */ 372 QDF_STATUS wlan_objmgr_unregister_vdev_status_handler( 373 enum wlan_umac_comp_id id, 374 wlan_objmgr_vdev_status_handler handler, 375 void *args); 376 377 /** 378 * wlan_objmgr_register_vdev_peer_free_notify_handler() - register vdev peer 379 * free handler 380 * @id: component id 381 * @handler: function pointer of the component 382 * 383 * API, allows other UMAC components to register handler 384 * The registered handler would be invoked on VDEV Peer gets freed 385 * 386 * Return: SUCCESS, 387 * Failure (if registration fails, each failure has different error 388 * code) 389 */ 390 QDF_STATUS wlan_objmgr_register_vdev_peer_free_notify_handler( 391 enum wlan_umac_comp_id id, 392 wlan_objmgr_vdev_peer_free_notify_handler handler); 393 394 /** 395 * wlan_objmgr_unregister_vdev_peer_free_notify_handler() - unregister vdev 396 * peer free handler 397 * @id: component id 398 * @handler: function pointer of the component 399 * 400 * API, allows other UMAC components to unregister handler 401 * 402 * Return: SUCCESS, 403 * Failure (if handler is not present, each failure has different error 404 * code) 405 */ 406 QDF_STATUS wlan_objmgr_unregister_vdev_peer_free_notify_handler( 407 enum wlan_umac_comp_id id, 408 wlan_objmgr_vdev_peer_free_notify_handler handler); 409 410 /** 411 * wlan_objmgr_register_peer_create_handler() - register peer create handler 412 * @id: component id 413 * @handler: function pointer of the component 414 * @args: args, if component wants certain args to be passed on PEER creation 415 * 416 * API, allows other UMAC components to register handler 417 * The registered handler would be invoked on PEER creation 418 * 419 * Return: SUCCESS, 420 * Failure (if registration fails, each failure has different error 421 * code) 422 */ 423 QDF_STATUS wlan_objmgr_register_peer_create_handler( 424 enum wlan_umac_comp_id id, 425 wlan_objmgr_peer_create_handler handler, 426 void *args); 427 428 /** 429 * wlan_objmgr_unregister_peer_create_handler() - unregister peer create handler 430 * @id: component id 431 * @handler: function pointer of the component 432 * @args: args, if component wants certain args to be passed on PEER creation 433 * 434 * API, allows other UMAC components to unregister handler 435 * 436 * Return: SUCCESS, 437 * Failure (if handler is not present, each failure has different error 438 * code) 439 */ 440 QDF_STATUS wlan_objmgr_unregister_peer_create_handler( 441 enum wlan_umac_comp_id id, 442 wlan_objmgr_peer_create_handler handler, 443 void *args); 444 445 /** 446 * wlan_objmgr_register_peer_destroy_handler() - register peer destroy handler 447 * @id: component id 448 * @handler: function pointer of the component 449 * @args: args, if component wants certain args to be passed on PEER deletion 450 * 451 * API, allows other UMAC components to register handler 452 * The registered handler would be invoked on PEER deletion 453 * 454 * Return: SUCCESS, 455 * Failure (if registration fails, each failure has different error 456 * code) 457 */ 458 QDF_STATUS wlan_objmgr_register_peer_destroy_handler( 459 enum wlan_umac_comp_id id, 460 wlan_objmgr_peer_destroy_handler handler, 461 void *args); 462 463 /** 464 * wlan_objmgr_unregister_peer_destroy_handler() - unregister peer destroy handler 465 * @id: component id 466 * @handler: function pointer of the component 467 * @args: args, if component wants certain args to be passed on PEER deletion 468 * 469 * API, allows other UMAC components to unregister handler 470 * 471 * Return: SUCCESS, 472 * Failure (if handler is not present, each failure has different error 473 * code) 474 */ 475 QDF_STATUS wlan_objmgr_unregister_peer_destroy_handler( 476 enum wlan_umac_comp_id id, 477 wlan_objmgr_peer_destroy_handler handler, 478 void *args); 479 480 /** 481 * wlan_objmgr_register_peer_status_handler() - register peer status handler 482 * @id: component id 483 * @handler: function pointer of the component 484 * @args: args, if component wants certain args to be passed on PEER status 485 * change 486 * 487 * API, allows other UMAC components to register handler 488 * The registered handler would be invoked on PEER object status change 489 * 490 * Return: SUCCESS, 491 * Failure (if registration fails, each failure has different error 492 * code) 493 */ 494 QDF_STATUS wlan_objmgr_register_peer_status_handler( 495 enum wlan_umac_comp_id id, 496 wlan_objmgr_peer_status_handler handler, 497 void *args); 498 499 /** 500 * wlan_objmgr_unregister_peer_status_handler() - unregister peer status handler 501 * @id: component id 502 * @handler: function pointer of the component 503 * @args: args, if component wants certain args to be passed on PEER status 504 * 505 * API, allows other UMAC components to unregister handler 506 * 507 * Return: SUCCESS, 508 * Failure (if handler is not present, each failure has different error 509 * code) 510 */ 511 QDF_STATUS wlan_objmgr_unregister_peer_status_handler( 512 enum wlan_umac_comp_id id, 513 wlan_objmgr_peer_status_handler handler, 514 void *args); 515 516 /** 517 * APIs to operations on psoc 518 */ 519 typedef void (*wlan_objmgr_psoc_handler)(struct wlan_objmgr_psoc *psoc, 520 void *arg, 521 uint8_t index); 522 523 /** 524 * wlan_objmgr_iterate_psoc_list() - iterate through all psocs 525 * 526 * @handler: the handler will be called for each psoc 527 * the handler should be implemented to perform required operation 528 * @arg: agruments passed by caller 529 * @dbg_id: id of the caller 530 * 531 * API to be used for performing the operations on all psoc 532 * The "handler" here shouldn't take g_umac_glb_obj->global_lock lock when 533 * processing 534 * 535 * Return: SUCCESS/FAILURE 536 */ 537 QDF_STATUS wlan_objmgr_iterate_psoc_list( 538 wlan_objmgr_psoc_handler handler, 539 void *arg, wlan_objmgr_ref_dbgid dbg_id); 540 541 #ifdef WLAN_FEATURE_11BE_MLO 542 /** 543 * wlan_objmgr_get_mlo_ctx() - Get MLO context from global umac object 544 * 545 * This API is used to get MLO context object from the global umac object 546 * 547 * Return: Pointer to the mlo context 548 */ 549 struct mlo_mgr_context *wlan_objmgr_get_mlo_ctx(void); 550 551 /** 552 * wlan_objmgr_set_mlo_ctx() - Set MLO context at global umac object 553 * 554 * This API is used to set MLO context object at the global umac object 555 * 556 * Return: None 557 */ 558 void wlan_objmgr_set_mlo_ctx(struct mlo_mgr_context *ctx); 559 #else 560 static inline struct mlo_mgr_context *wlan_objmgr_get_mlo_ctx(void) 561 { 562 return NULL; 563 } 564 565 static inline void wlan_objmgr_set_mlo_ctx(struct mlo_mgr_context *ctx) 566 {} 567 #endif /* WLAN_FEATURE_11BE_MLO */ 568 569 #endif /* _WLAN_OBJMGR_GLOBAL_OBJ_H_*/ 570