1 /* 2 * Copyright (c) 2017-2020 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 /** 20 * DOC: wlan_serialization_api.h 21 * This file provides prototypes of the routines needed for the 22 * external components to utilize the services provided by the 23 * serialization component. 24 */ 25 26 /* Include files */ 27 #ifndef __WLAN_SERIALIZATION_API_H 28 #define __WLAN_SERIALIZATION_API_H 29 30 #include <qdf_status.h> 31 #include <wlan_objmgr_cmn.h> 32 33 /* Preprocessor Definitions and Constants */ 34 35 /** 36 * enum ser_queue_reason- reason for changes to serialization queue 37 * @: SER_REQUEST: queue updated for serialization request 38 * @: SER_REMOVE : queue updated for serialization remove request 39 * @: SER_CANCEL : queue updated for serialization cancel request 40 * @: SER_TIMEOUT : queue updated for command timeout 41 * @: SER_ACTIVATION_FAILED : queue updated since command activation failed 42 * @: SER_PENDING_TO_ACTIVE : queue updated for pending to active movement 43 */ 44 enum ser_queue_reason { 45 SER_REQUEST, 46 SER_REMOVE, 47 SER_CANCEL, 48 SER_TIMEOUT, 49 SER_ACTIVATION_FAILED, 50 SER_PENDING_TO_ACTIVE, 51 SER_QUEUE_ACTION_MAX, 52 }; 53 54 /* 55 * struct wlan_serialization_queued_cmd_info member queue_type specifies the 56 * below values to cancel the commands in these queues. Setting both the 57 * bits will cancel the commands in both the queues. 58 */ 59 #define WLAN_SERIALIZATION_ACTIVE_QUEUE 0x1 60 #define WLAN_SERIALIZATION_PENDING_QUEUE 0x2 61 62 /** 63 * enum wlan_serialization_cb_reason - reason for calling the callback 64 * @WLAN_SERIALIZATION_REASON_ACTIVATE_CMD: activate the cmd by sending it to FW 65 * @WLAN_SERIALIZATION_REASON_CANCEL_CMD: Cancel the cmd in the pending list 66 * @WLAN_SERIALIZATION_REASON_RELEASE_MEM_CMD:cmd execution complete. Release 67 * the memory allocated while 68 * building the command 69 * @WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: active cmd has been timeout. 70 */ 71 enum wlan_serialization_cb_reason { 72 WLAN_SER_CB_ACTIVATE_CMD, 73 WLAN_SER_CB_CANCEL_CMD, 74 WLAN_SER_CB_RELEASE_MEM_CMD, 75 WLAN_SER_CB_ACTIVE_CMD_TIMEOUT, 76 }; 77 78 /** 79 * struct wlan_serialization_scan_info - Information needed for scan cmd 80 * @is_cac_in_progress: boolean to check the cac status 81 * @is_tdls_in_progress: boolean to check the tdls status 82 * @is_mlme_op_in_progress: boolean to check the mlme op status 83 * 84 * This information is needed for scan command from other components 85 * to apply the rules and check whether the cmd is allowed or not 86 */ 87 struct wlan_serialization_scan_info { 88 bool is_cac_in_progress; 89 bool is_tdls_in_progress; 90 bool is_mlme_op_in_progress; 91 }; 92 93 /** 94 * union wlan_serialization_rules_info - union of all rules info structures 95 * @scan_info: information needed to apply rules on scan command 96 */ 97 union wlan_serialization_rules_info { 98 struct wlan_serialization_scan_info scan_info; 99 }; 100 101 struct wlan_serialization_command; 102 103 /** 104 * wlan_serialization_cmd_callback() - Callback registered by the component 105 * @wlan_cmd: Command passed by the component for serialization 106 * @reason: Reason code for which the callback is being called 107 * 108 * Reason specifies the reason for which the callback is being called. callback 109 * should return success or failure based up on overall success of callback. 110 * if callback returns failure then serialization will remove the command from 111 * active queue and proceed for next pending command. 112 * 113 * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE 114 */ 115 typedef QDF_STATUS 116 (*wlan_serialization_cmd_callback)(struct wlan_serialization_command *wlan_cmd, 117 enum wlan_serialization_cb_reason reason); 118 119 /** 120 * wlan_serialization_comp_info_cb() - callback to fill the rules information 121 * @vdev: VDEV object for which the command has been received 122 * @comp_info: Information filled by the component 123 * 124 * This callback is registered dynamically by the component with the 125 * serialization component. Serialization component invokes the callback 126 * while applying the rules for a particular command and the component 127 * fills in the required information to apply the rules 128 * 129 * Return: None 130 */ 131 typedef void (*wlan_serialization_comp_info_cb)(struct wlan_objmgr_vdev *vdev, 132 union wlan_serialization_rules_info *comp_info); 133 134 /** 135 * wlan_serialization_apply_rules_cb() - callback per command to apply rules 136 * @comp_info: information needed to apply the rules 137 * 138 * The rules are applied using this callback and decided whether to 139 * allow or deny the command 140 * 141 * Return: true, if rules are successful and cmd can be queued 142 * false, if rules failed and cmd should not be queued 143 */ 144 typedef bool (*wlan_serialization_apply_rules_cb)( 145 union wlan_serialization_rules_info *comp_info, 146 uint8_t comp_id); 147 148 /** 149 * wlan_ser_umac_cmd_cb() - callback to validate umac_cmd 150 * @umac_cmd: umac data associated with the serialization cmd 151 * 152 * This callback can be called at run time for a command in active queue to 153 * fetch the required information from the umac cmd data stored in serialization 154 * command buffer. 155 * 156 * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE 157 */ 158 typedef QDF_STATUS (*wlan_ser_umac_cmd_cb)(void *umac_cmd); 159 160 /** 161 * enum wlan_umac_cmd_id - Command Type 162 * @WLAN_SER_CMD_SCAN: Scan command 163 * @WLAN_SER_CMD_NONSCAN: Non-scan command 164 * @WLAN_SER_CMD_HDD_ISSUE_REASSOC_SAME_AP: HDD Reassoc cmd 165 * @WLAN_SER_CMD_SME_ISSUE_REASSOC_SAME_AP: SME Reassoc cmd 166 * @WLAN_SER_CMD_SME_ISSUE_DISASSOC_FOR_HANDOFF: SME Disassoc cmd 167 * @WLAN_SER_CMD_SME_ISSUE_ASSOC_TO_SIMILAR_AP: SME Assoc cmd 168 * @WLAN_SER_CMD_FORCE_IBSS_LEAVE: IBSS leave AP cmd 169 * @WLAN_SER_CMD_SME_ISSUE_FT_REASSOC: SME reassoc cmd 170 * @WLAN_SER_CMD_FORCE_DISASSOC_STA: Force diassoc for STA vap 171 * @WLAN_SER_CMD_FORCE_DEAUTH_STA: Force deauth for STA vap 172 * @WLAN_SER_CMD_PERFORM_PRE_AUTH: Pre auth ops cmd 173 * @WLAN_SER_CMD_WM_STATUS_CHANGE: WM status modification cmd 174 * @WLAN_SER_CMD_NDP_INIT_REQ: NDP init request cmd 175 * @WLAN_SER_CMD_NDP_RESP_REQ: NDP response to request cmd 176 * @WLAN_SER_CMD_NDP_DATA_END_INIT_REQ: NDP data end init request 177 * @WLAN_SER_CMD_NDP_END_ALL_REQ: NDP close all request 178 * @WLAN_SER_CMD_ADDTS: ADD Ts cmd 179 * @WLAN_SER_CMD_DELTS: Del Ts cmd 180 * @WLAN_SER_CMD_TDLS_SEND_MGMT: TDLS mgmt send cmd 181 * @WLAN_SER_CMD_TDLS_ADD_PEER: TDLS cmd to add peer 182 * @WLAN_SER_CMD_TDLS_DEL_PEER: TDLS cmd to del peer 183 * @WLAN_SER_CMD_SET_HW_MODE: Cmd to set hardware mode change 184 * @WLAN_SER_CMD_NSS_UPDATE: Cmd to update NSS config 185 * @WLAN_SER_CMD_SET_DUAL_MAC_CONFIG: Cmd to set dual mac 186 * @WLAN_SER_CMD_SET_ANTENNA_MODE: Set antenna mode 187 * @WLAN_SER_CMD_VDEV_DELETE: Cmd to del vdev 188 * @WLAN_SER_CMD_VDEV_START_BSS: Cmd to start a AP VDEV 189 * @WLAN_SER_CMD_VDEV_STOP_BSS: Cmd to stop a AP VDEV 190 * @WLAN_SER_CMD_VDEV_CONNECT: Cmd to start a STA VDEV 191 * @WLAN_SER_CMD_VDEV_DISCONNECT: Cmd to stop a STA VDEV 192 * @WLAN_SER_CMD_VDEV_RESTART: Cmd to restart a VDEV 193 * @WLAN_SER_CMD_PDEV_RESTART: Cmd to restart all VDEVs of a PDEV 194 * @WLAN_SER_CMD_PDEV_CSA_RESTART: Cmd to CSA restart all AP VDEVs of a PDEV 195 * @WLAN_SER_CMD_GET_DISCONNECT_STATS: Cmd to get peer stats on disconnection 196 */ 197 enum wlan_serialization_cmd_type { 198 /* all scan command before non-scan */ 199 WLAN_SER_CMD_SCAN, 200 /* all non-scan command below */ 201 WLAN_SER_CMD_NONSCAN, 202 WLAN_SER_CMD_HDD_ISSUE_REASSOC_SAME_AP, 203 WLAN_SER_CMD_SME_ISSUE_REASSOC_SAME_AP, 204 WLAN_SER_CMD_SME_ISSUE_DISASSOC_FOR_HANDOFF, 205 WLAN_SER_CMD_SME_ISSUE_ASSOC_TO_SIMILAR_AP, 206 WLAN_SER_CMD_FORCE_IBSS_LEAVE, 207 WLAN_SER_CMD_SME_ISSUE_FT_REASSOC, 208 WLAN_SER_CMD_FORCE_DISASSOC_STA, 209 WLAN_SER_CMD_FORCE_DEAUTH_STA, 210 WLAN_SER_CMD_PERFORM_PRE_AUTH, 211 WLAN_SER_CMD_WM_STATUS_CHANGE, 212 WLAN_SER_CMD_NDP_INIT_REQ, 213 WLAN_SER_CMD_NDP_RESP_REQ, 214 WLAN_SER_CMD_NDP_DATA_END_INIT_REQ, 215 WLAN_SER_CMD_NDP_END_ALL_REQ, 216 WLAN_SER_CMD_ADDTS, 217 WLAN_SER_CMD_DELTS, 218 WLAN_SER_CMD_TDLS_SEND_MGMT, 219 WLAN_SER_CMD_TDLS_ADD_PEER, 220 WLAN_SER_CMD_TDLS_DEL_PEER, 221 WLAN_SER_CMD_SET_HW_MODE, 222 WLAN_SER_CMD_NSS_UPDATE, 223 WLAN_SER_CMD_SET_DUAL_MAC_CONFIG, 224 WLAN_SER_CMD_SET_ANTENNA_MODE, 225 WLAN_SER_CMD_VDEV_DELETE, 226 WLAN_SER_CMD_VDEV_START_BSS, 227 WLAN_SER_CMD_VDEV_STOP_BSS, 228 WLAN_SER_CMD_VDEV_CONNECT, 229 WLAN_SER_CMD_VDEV_DISCONNECT, 230 WLAN_SER_CMD_VDEV_RESTART, 231 WLAN_SER_CMD_PDEV_RESTART, 232 WLAN_SER_CMD_PDEV_CSA_RESTART, 233 WLAN_SER_CMD_GET_DISCONNECT_STATS, 234 WLAN_SER_CMD_MAX 235 }; 236 237 /** 238 * enum wlan_serialization_cancel_type - Type of commands to be cancelled 239 * @WLAN_SER_CANCEL_SINGLE_SCAN: Cancel a single scan with a given ID 240 * @WLAN_SER_CANCEL_PDEV_SCANS: Cancel all the scans on a given pdev 241 * @WLAN_SER_CANCEL_VDEV_SCANS: Cancel all the scans on given vdev 242 * @WLAN_SER_CANCEL_VDEV_HOST_SCANS: Cancel all host scans on given vdev 243 * @WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD: Cancel all non scans on a given pdev 244 * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD: Cancel all non scans on a given vdev 245 * @WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE: Cancel all non scans on a given vdev 246 * and matching cmd type 247 * @WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD: Cancel all non-blocking, 248 * non-scan commands of a given vdev 249 * @WLAN_SER_CANCEL_NON_SCAN_CMD: Cancel the given non scan command 250 */ 251 enum wlan_serialization_cancel_type { 252 WLAN_SER_CANCEL_SINGLE_SCAN, 253 WLAN_SER_CANCEL_PDEV_SCANS, 254 WLAN_SER_CANCEL_VDEV_SCANS, 255 WLAN_SER_CANCEL_VDEV_HOST_SCANS, 256 WLAN_SER_CANCEL_PDEV_NON_SCAN_CMD, 257 WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD, 258 WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE, 259 WLAN_SER_CANCEL_VDEV_NON_SCAN_NB_CMD, 260 WLAN_SER_CANCEL_NON_SCAN_CMD, 261 WLAN_SER_CANCEL_MAX, 262 }; 263 264 /** 265 * enum wlan_serialization_status - Return status of cmd serialization request 266 * @WLAN_SER_CMD_PENDING: Command is put into the pending queue 267 * @WLAN_SER_CMD_ACTIVE: Command is activated and put in active queue 268 * @WLAN_SER_CMD_DENIED_RULES_FAILED: Command denied as the rules fail 269 * @WLAN_SER_CMD_DENIED_LIST_FULL: Command denied as the pending list is full 270 * @WLAN_SER_CMD_QUEUE_DISABLED: Command denied as the queue is disabled 271 * @WLAN_SER_CMD_ALREADY_EXISTS: Command already exists in the queue 272 * @WLAN_SER_CMD_DENIED_UNSPECIFIED: Command denied due to unknown reason 273 */ 274 enum wlan_serialization_status { 275 WLAN_SER_CMD_PENDING, 276 WLAN_SER_CMD_ACTIVE, 277 WLAN_SER_CMD_DENIED_RULES_FAILED, 278 WLAN_SER_CMD_DENIED_LIST_FULL, 279 WLAN_SER_CMD_QUEUE_DISABLED, 280 WLAN_SER_CMD_ALREADY_EXISTS, 281 WLAN_SER_CMD_DENIED_UNSPECIFIED, 282 }; 283 284 /** 285 * enum wlan_serialization_cmd_status - Return status for a cancel request 286 * @WLAN_SER_CMD_IN_PENDING_LIST: Command cancelled from pending list 287 * @WLAN_SER_CMD_IN_ACTIVE_LIST: Command cancelled from active list 288 * @WLAN_SER_CMDS_IN_ALL_LISTS: Command cancelled from all lists 289 * @WLAN_SER_CMD_NOT_FOUND: Specified command to be cancelled 290 * not found in the lists 291 */ 292 enum wlan_serialization_cmd_status { 293 WLAN_SER_CMD_IN_PENDING_LIST, 294 WLAN_SER_CMD_IN_ACTIVE_LIST, 295 WLAN_SER_CMDS_IN_ALL_LISTS, 296 WLAN_SER_CMD_MARKED_FOR_ACTIVATION, 297 WLAN_SER_CMD_NOT_FOUND, 298 }; 299 300 /** 301 * enum wlan_ser_cmd_attr - Serialization cmd attribute 302 * @WLAN_SER_CMD_ATTR_NONE - No attribuate associated 303 * @WLAN_SER_CMD_ATTR_BLOCK - Blocking attribute 304 * @WLAN_SER_CMD_ATTR_NONBLOCK - Non-blocking attribute 305 */ 306 enum wlan_ser_cmd_attr { 307 WLAN_SER_CMD_ATTR_NONE, 308 WLAN_SER_CMD_ATTR_BLOCK, 309 WLAN_SER_CMD_ATTR_NONBLOCK, 310 }; 311 312 /** 313 * struct wlan_serialization_command - Command to be serialized 314 * @wlan_serialization_cmd_type: Type of command 315 * @cmd_id: Command Identifier 316 * @cmd_cb: Command callback 317 * @source: component ID of the source of the command 318 * @is_high_priority: Normal/High Priority at which the cmd has to be queued 319 * @is_blocking: Is the command blocking 320 * @queue_disable: Should the command disable the queues 321 * @activation_reason: reason the activation cb was called 322 * @cmd_timeout_cb: Command timeout callback 323 * @cmd_timeout_duration: Timeout duration in milliseconds 324 * @vdev: VDEV object associated to the command 325 * @umac_cmd: Actual command that needs to be sent to WMI/firmware 326 * 327 * Note: Unnamed union has been used in this structure, so that in future if 328 * somebody wants to add pdev or psoc structure then that person can add without 329 * modifying existing code. 330 */ 331 struct wlan_serialization_command { 332 enum wlan_serialization_cmd_type cmd_type; 333 uint32_t cmd_id; 334 wlan_serialization_cmd_callback cmd_cb; 335 enum wlan_umac_comp_id source; 336 uint8_t is_high_priority:1, 337 is_blocking:1, 338 queue_disable:1, 339 activation_reason:3; 340 uint32_t cmd_timeout_duration; 341 union { 342 struct wlan_objmgr_vdev *vdev; 343 }; 344 void *umac_cmd; 345 }; 346 347 /** 348 * struct wlan_serialization_queued_cmd_info - cmd that has to be cancelled 349 * @requestor: component ID of the source requesting this action 350 * @cmd_type: Command type 351 * @cmd_id: Command ID 352 * @req_type: Commands that need to be cancelled 353 * @vdev: VDEV object associated to the command 354 * @queue_type: Queues from which the command to be cancelled 355 */ 356 struct wlan_serialization_queued_cmd_info { 357 enum wlan_umac_comp_id requestor; 358 enum wlan_serialization_cmd_type cmd_type; 359 uint32_t cmd_id; 360 enum wlan_serialization_cancel_type req_type; 361 union { 362 struct wlan_objmgr_vdev *vdev; 363 }; 364 uint8_t queue_type; 365 }; 366 367 /** 368 * wlan_serialization_cancel_request() - Request to cancel a command 369 * @req: Request information 370 * 371 * This API is used by external components to cancel a command 372 * that is either in the pending or active queue. Based on the 373 * req_type, it is decided whether to use pdev or vdev 374 * object. For all non-scan commands, it will be pdev. 375 * 376 * Return: Status specifying the removal of a command from a certain queue 377 */ 378 enum wlan_serialization_cmd_status 379 wlan_serialization_cancel_request( 380 struct wlan_serialization_queued_cmd_info *req); 381 382 /** 383 * wlan_serialization_remove_cmd() - Request to release a command 384 * @cmd: Command information 385 * 386 * This API is used to release a command sitting in the active 387 * queue upon successful completion of the command 388 * 389 * Return: None 390 */ 391 void wlan_serialization_remove_cmd( 392 struct wlan_serialization_queued_cmd_info *cmd); 393 394 /** 395 * wlan_serialization_update_timer() -Update timer for an active command 396 * @cmd: Command information 397 * 398 * Return: Status of the timer update 399 */ 400 QDF_STATUS 401 wlan_serialization_update_timer(struct wlan_serialization_command *cmd); 402 403 /** 404 * wlan_serialization_request() - Request to serialize a command 405 * @cmd: Command information 406 * 407 * Return: Status of the serialization request 408 */ 409 enum wlan_serialization_status 410 wlan_serialization_request(struct wlan_serialization_command *cmd); 411 412 /** 413 * wlan_serialization_register_comp_info_cb() - Register component's info cb 414 * @psoc: PSOC object information 415 * @comp_id: Component ID 416 * @cmd_type: Command Type 417 * @cb: Callback 418 * 419 * This is called from component during its initialization.It initializes 420 * callback handler for given comp_id/cmd_id in a 2-D array. 421 * 422 * Return: QDF Status 423 */ 424 QDF_STATUS 425 wlan_serialization_register_comp_info_cb( 426 struct wlan_objmgr_psoc *psoc, 427 enum wlan_umac_comp_id comp_id, 428 enum wlan_serialization_cmd_type cmd_type, 429 wlan_serialization_comp_info_cb cb); 430 431 /** 432 * wlan_serialization_deregister_comp_info_cb() - Deregister component's info 433 * callback 434 * @psoc: PSOC object information 435 * @comp_id: Component ID 436 * @cmd_type: Command Type 437 * 438 * This routine is called from other component during its de-initialization. 439 * 440 * Return: QDF Status 441 */ 442 QDF_STATUS 443 wlan_serialization_deregister_comp_info_cb( 444 struct wlan_objmgr_psoc *psoc, 445 enum wlan_umac_comp_id comp_id, 446 enum wlan_serialization_cmd_type cmd_type); 447 448 /** 449 * wlan_serialization_register_apply_rules_cb() - Register component's rules 450 * callback 451 * @psoc: PSOC object information 452 * @cmd_type: Command Type 453 * @cb: Callback 454 * 455 * This is called from component during its initialization.It initializes 456 * callback handler for given cmd_type in a 1-D array. 457 * 458 * Return: QDF Status 459 */ 460 QDF_STATUS 461 wlan_serialization_register_apply_rules_cb( 462 struct wlan_objmgr_psoc *psoc, 463 enum wlan_serialization_cmd_type cmd_type, 464 wlan_serialization_apply_rules_cb apply_rules_cb); 465 466 /** 467 * wlan_serialization_deregister_apply_rules_cb() - Deregister component's rules 468 * callback 469 * @psoc: PSOC object information 470 * @cmd_type: Command Type 471 * 472 * This routine is called from other component during its de-initialization. 473 * 474 * Return: QDF Status 475 */ 476 QDF_STATUS 477 wlan_serialization_deregister_apply_rules_cb( 478 struct wlan_objmgr_psoc *psoc, 479 enum wlan_serialization_cmd_type cmd_type); 480 481 /** 482 * @wlan_serialization_init() - Serialization component initialization routine 483 * 484 * Return - QDF Status 485 */ 486 QDF_STATUS wlan_serialization_init(void); 487 488 /** 489 * @wlan_serialization_deinit() - Serialization component de-init routine 490 * 491 * Return - QDF Status 492 */ 493 QDF_STATUS wlan_serialization_deinit(void); 494 495 /** 496 * @wlan_serialization_psoc_enable() - Serialization component enable routine 497 * 498 * Return - QDF Status 499 */ 500 QDF_STATUS wlan_serialization_psoc_enable(struct wlan_objmgr_psoc *psoc); 501 502 /** 503 * @wlan_serialization_psoc_disable() - Serialization component disable routine 504 * 505 * Return - QDF Status 506 */ 507 QDF_STATUS wlan_serialization_psoc_disable(struct wlan_objmgr_psoc *psoc); 508 509 /** 510 * wlan_serialization_vdev_scan_status() - Return the status of the vdev scan 511 * @vdev: VDEV Object 512 * 513 * Return: Status of the scans for the corresponding vdev 514 */ 515 enum wlan_serialization_cmd_status 516 wlan_serialization_vdev_scan_status(struct wlan_objmgr_vdev *vdev); 517 518 /** 519 * wlan_serialization_pdev_scan_status() - Return the status of the pdev scan 520 * @pdev: PDEV Object 521 * 522 * Return: Status of the scans for the corresponding pdev 523 */ 524 enum wlan_serialization_cmd_status 525 wlan_serialization_pdev_scan_status(struct wlan_objmgr_pdev *pdev); 526 527 /** 528 * wlan_serialization_non_scan_cmd_status() - Return status of pdev non-scan cmd 529 * @pdev: PDEV Object 530 * @cmd_id: ID of the command for which the status has to be checked 531 * 532 * Return: Status of the command for the corresponding pdev 533 */ 534 enum wlan_serialization_cmd_status 535 wlan_serialization_non_scan_cmd_status(struct wlan_objmgr_pdev *pdev, 536 enum wlan_serialization_cmd_type cmd_id); 537 538 /** 539 * wlan_serialization_is_cmd_present_in_pending_queue() - Return if the command 540 * is already present in pending queue 541 * @cmd: pointer to serialization command to check 542 * 543 * This API will check if command is present in pending queue. If present 544 * then return true, so use know that it is duplicated command 545 * 546 * Return: true or false 547 */ 548 bool wlan_serialization_is_cmd_present_in_pending_queue( 549 struct wlan_objmgr_psoc *psoc, 550 struct wlan_serialization_command *cmd); 551 /** 552 * wlan_serialization_is_cmd_present_in_active_queue() - Return if the command 553 * is already present in active queue 554 * @cmd: pointer to serialization command to check 555 * 556 * This API will check if command is present in active queue. If present 557 * then return true, so use know that it is duplicated command 558 * 559 * Return: true or false 560 */ 561 bool wlan_serialization_is_cmd_present_in_active_queue( 562 struct wlan_objmgr_psoc *psoc, 563 struct wlan_serialization_command *cmd); 564 565 /** 566 * wlan_serialization_get_scan_cmd_using_scan_id() - Return command which 567 * matches vdev_id and scan_id 568 * @psoc: pointer to soc 569 * @vdev_id: vdev id to pull vdev object 570 * @scan_id: scan id to match 571 * @is_scan_cmd_from_active_queue: to indicate active or pending queue 572 * 573 * This API fetches vdev/pdev object based on vdev_id, loops through scan 574 * command queue and find the command which matches scan id as well as vdev 575 * object. 576 * 577 * Return: pointer to serialization command 578 */ 579 struct wlan_serialization_command* 580 wlan_serialization_get_scan_cmd_using_scan_id( 581 struct wlan_objmgr_psoc *psoc, 582 uint8_t vdev_id, uint16_t scan_id, 583 uint8_t is_scan_cmd_from_active_queue); 584 /** 585 * wlan_serialization_get_active_cmd() - Return active umac command which 586 * matches vdev and cmd type 587 * @psoc: pointer to soc 588 * @vdev_id: vdev id to pull vdev object 589 * @cmd_type: cmd type to match 590 * 591 * This API fetches vdev/pdev object based on vdev_id, loops through active 592 * command queue and find the active command which matches cmd_type as well 593 * as vdev object. 594 * 595 * Return: Pointer to umac command. NULL is returned if active command of given 596 * type is not found. 597 */ 598 void *wlan_serialization_get_active_cmd( 599 struct wlan_objmgr_psoc *psoc, 600 uint8_t vdev_id, 601 enum wlan_serialization_cmd_type cmd_type); 602 603 /** 604 * wlan_serialization_get_vdev_active_cmd_type() - Return cmd type of the 605 * active command for the given vdev 606 * @vdev: vdev object 607 * 608 * This API fetches command type of the command in the vdev active queue 609 * 610 * Return: command type of the command in the vdev active queue 611 */ 612 613 enum wlan_serialization_cmd_type 614 wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev); 615 616 /** 617 * wlan_ser_get_cmd_activation_status() - Return active command status 618 * @vdev: vdev object 619 * 620 * This API fetches active command state in the vdev active queue 621 * 622 * Return: success if CMD_MARKED_FOR_ACTIVATION bit is set, else fail 623 */ 624 625 QDF_STATUS 626 wlan_ser_get_cmd_activation_status(struct wlan_objmgr_vdev *vdev); 627 628 /** 629 * wlan_ser_is_vdev_queue_enabled() - Return vdev queue status 630 * @vdev: vdev object 631 * 632 * This API return vdev queue enable status 633 * 634 * Return: true if vdev queue is enabled 635 */ 636 bool wlan_ser_is_vdev_queue_enabled(struct wlan_objmgr_vdev *vdev); 637 638 /** 639 * wlan_ser_validate_umac_cmd() - validate umac cmd data 640 * @vdev: objmgr vdev pointer 641 * @cmd_type: cmd type to match 642 * @umac_cmd_cb: Callback to be called to validate the data 643 * 644 * This API returns the validation status of the umac cmd cb. 645 * The umac_cmd_cb callback is called with serialization lock held, and hence 646 * only atomic operations are allowed in the callback. 647 * 648 * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE 649 */ 650 QDF_STATUS 651 wlan_ser_validate_umac_cmd(struct wlan_objmgr_vdev *vdev, 652 enum wlan_serialization_cmd_type cmd_type, 653 wlan_ser_umac_cmd_cb umac_cmd_cb); 654 655 /** 656 * wlan_serialization_purge_all_pdev_cmd() - purge all command for given pdev 657 * @pdev: objmgr pdev pointer 658 * 659 * Return: void 660 */ 661 void wlan_serialization_purge_all_pdev_cmd(struct wlan_objmgr_pdev *pdev); 662 663 /** 664 * wlan_serialization_purge_all_cmd() - purge all command for psoc 665 * @psoc: objmgr psoc pointer 666 * 667 * Return: void 668 */ 669 void wlan_serialization_purge_all_cmd(struct wlan_objmgr_psoc *psoc); 670 671 /** 672 * wlan_serialization_purge_all_pending_cmd_by_vdev_id() - Purge all pending 673 * scan and non scan commands for vdev id 674 * @pdev: pointer to pdev 675 * @vdev_id: vdev_id variable 676 * 677 * Return: none 678 */ 679 void wlan_serialization_purge_all_pending_cmd_by_vdev_id( 680 struct wlan_objmgr_pdev *pdev, 681 uint8_t vdev_id); 682 683 /** 684 * wlan_serialization_purge_all_cmd_by_vdev_id() - Purge all scan and non scan 685 * commands for vdev id 686 * @pdev: pointer to pdev 687 * @vdev_id: vdev_id variable 688 * 689 * Return: none 690 */ 691 void wlan_serialization_purge_all_cmd_by_vdev_id(struct wlan_objmgr_pdev *pdev, 692 uint8_t vdev_id); 693 694 /** 695 * wlan_serialization_purge_all_scan_cmd_by_vdev_id() - Purge all pending/active 696 * scan commands for vdev id 697 * @pdev: pointer to pdev 698 * @vdev_id: vdev_id variable 699 * 700 * Return: none 701 */ 702 void wlan_serialization_purge_all_scan_cmd_by_vdev_id( 703 struct wlan_objmgr_pdev *pdev, 704 uint8_t vdev_id); 705 706 /** 707 * wlan_ser_vdev_queue_disable -Disable vdev specific serialization queue 708 * @vdev: Vdev Object 709 * 710 * This function disables the serialization for the vdev queue 711 * 712 * Return: QDF_STATUS 713 */ 714 QDF_STATUS wlan_ser_vdev_queue_disable(struct wlan_objmgr_vdev *vdev); 715 #endif 716