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