1 /* 2 * Copyright (c) 2017-2019 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: wlan_serialization_non_scan.c 20 * This file defines the functions which deals with 21 * serialization non scan commands. 22 */ 23 24 #include <wlan_objmgr_psoc_obj.h> 25 #include <wlan_objmgr_pdev_obj.h> 26 #include <wlan_objmgr_vdev_obj.h> 27 #include "wlan_serialization_main_i.h" 28 #include "wlan_serialization_utils_i.h" 29 #include "wlan_serialization_non_scan_i.h" 30 31 bool 32 wlan_serialization_is_non_scan_pending_queue_empty( 33 struct wlan_serialization_command *cmd) 34 { 35 struct wlan_objmgr_vdev *vdev = NULL; 36 struct wlan_ser_vdev_obj *ser_vdev_obj = NULL; 37 struct wlan_serialization_vdev_queue *vdev_q; 38 bool status = false; 39 40 vdev = wlan_serialization_get_vdev_from_cmd(cmd); 41 42 if (!vdev) { 43 ser_err("vdev object is invalid"); 44 goto error; 45 } 46 47 ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev); 48 vdev_q = &ser_vdev_obj->vdev_q[SER_VDEV_QUEUE_COMP_NON_SCAN]; 49 50 if (qdf_list_empty(&vdev_q->pending_list)) 51 status = true; 52 53 error: 54 return status; 55 } 56 57 /** 58 * wlan_serialization_is_active_nonscan_cmd_allowed() - find if cmd allowed 59 * @pdev: pointer to pdev object 60 * 61 * This API will be called to find out if non scan cmd is allowed. 62 * 63 * Return: true or false 64 */ 65 66 bool 67 wlan_serialization_is_active_non_scan_cmd_allowed( 68 struct wlan_serialization_command *cmd) 69 { 70 struct wlan_serialization_pdev_queue *pdev_queue; 71 struct wlan_ser_pdev_obj *ser_pdev_obj; 72 uint32_t vdev_active_cmd_bitmap; 73 bool blocking_cmd_active = 0; 74 uint8_t blocking_cmd_waiting = 0; 75 bool status = false; 76 uint32_t vdev_id; 77 78 ser_pdev_obj = wlan_serialization_get_pdev_obj( 79 wlan_serialization_get_pdev_from_cmd(cmd)); 80 81 pdev_queue = wlan_serialization_get_pdev_queue_obj(ser_pdev_obj, 82 cmd->cmd_type); 83 84 vdev_active_cmd_bitmap = pdev_queue->vdev_active_cmd_bitmap; 85 blocking_cmd_active = pdev_queue->blocking_cmd_active; 86 blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting; 87 88 /* 89 * Command is blocking 90 */ 91 if (cmd->is_blocking) { 92 /* 93 * For blocking commands, no other 94 * commands from any vdev should be active 95 */ 96 if (vdev_active_cmd_bitmap) { 97 status = false; 98 pdev_queue->blocking_cmd_waiting++; 99 } else { 100 status = true; 101 } 102 } else { 103 /* 104 * Command is non blocking 105 * For activating non blocking commands, if there any blocking 106 * commands, waiting or active, put it to pending queue 107 */ 108 if (blocking_cmd_active || blocking_cmd_waiting) { 109 status = false; 110 } else { 111 /* 112 * For non blocking command, and no blocking commands 113 * waiting or active, check if a cmd for that vdev is active 114 * If not active, put to active else pending queue 115 */ 116 vdev_id = wlan_vdev_get_id(cmd->vdev); 117 status = vdev_active_cmd_bitmap & (1 << vdev_id) 118 ? false : true; 119 } 120 } 121 return status; 122 } 123 124 enum wlan_serialization_status wlan_ser_add_non_scan_cmd( 125 struct wlan_ser_pdev_obj *ser_pdev_obj, 126 struct wlan_serialization_command_list *cmd_list, 127 uint8_t is_cmd_for_active_queue) 128 { 129 enum wlan_serialization_status pdev_status, vdev_status; 130 enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED; 131 struct wlan_serialization_command_list *pcmd_list; 132 uint8_t vdev_id; 133 struct wlan_serialization_pdev_queue *pdev_queue; 134 135 ser_debug("add non scan cmd: type[%d] id[%d] prio[%d] blocking[%d]", 136 cmd_list->cmd.cmd_type, 137 cmd_list->cmd.cmd_id, 138 cmd_list->cmd.is_high_priority, 139 cmd_list->cmd.is_blocking); 140 141 vdev_status = wlan_serialization_add_cmd_to_vdev_queue( 142 ser_pdev_obj, cmd_list, is_cmd_for_active_queue); 143 144 if (vdev_status == WLAN_SER_CMD_DENIED_LIST_FULL) { 145 ser_err_rl("List is full cannot add CMD %d cmd id %d", 146 cmd_list->cmd.cmd_type, cmd_list->cmd.cmd_id); 147 status = vdev_status; 148 goto vdev_error; 149 } 150 151 if (is_cmd_for_active_queue) { 152 if (vdev_status != WLAN_SER_CMD_ACTIVE) { 153 ser_err("Failed to add to vdev active queue"); 154 QDF_ASSERT(0); 155 goto vdev_error; 156 } 157 } else { 158 if (vdev_status != WLAN_SER_CMD_PENDING) { 159 ser_err("Failed to add to vdev pending queue"); 160 QDF_ASSERT(0); 161 goto vdev_error; 162 } 163 } 164 165 pdev_status = wlan_serialization_add_cmd_to_pdev_queue( 166 ser_pdev_obj, cmd_list, is_cmd_for_active_queue); 167 168 if (pdev_status == WLAN_SER_CMD_DENIED_LIST_FULL) { 169 status = pdev_status; 170 goto pdev_error; 171 } 172 173 if (is_cmd_for_active_queue) { 174 if (pdev_status != WLAN_SER_CMD_ACTIVE) { 175 ser_err("Failed to add to pdev active queue"); 176 QDF_ASSERT(0); 177 goto pdev_error; 178 } 179 } else { 180 if (pdev_status != WLAN_SER_CMD_PENDING) { 181 ser_err("Failed to add to pdev pending queue"); 182 QDF_ASSERT(0); 183 goto pdev_error; 184 } 185 } 186 pdev_error: 187 /* 188 * If cmd added to vdev queue, but failed while 189 * adding to pdev queue, remove cmd from vdev queue as well 190 */ 191 if (pdev_status != vdev_status) { 192 wlan_serialization_remove_cmd_from_vdev_queue( 193 ser_pdev_obj, &pcmd_list, 194 &cmd_list->cmd, 195 is_cmd_for_active_queue); 196 } else { 197 status = pdev_status; 198 } 199 200 if (is_cmd_for_active_queue) { 201 pdev_queue = wlan_serialization_get_pdev_queue_obj( 202 ser_pdev_obj, cmd_list->cmd.cmd_type); 203 vdev_id = wlan_vdev_get_id(cmd_list->cmd.vdev); 204 pdev_queue->vdev_active_cmd_bitmap |= (1 << vdev_id); 205 206 if (cmd_list->cmd.is_blocking) 207 pdev_queue->blocking_cmd_active = 1; 208 } 209 210 vdev_error: 211 return status; 212 } 213 214 enum wlan_serialization_status 215 wlan_ser_move_non_scan_pending_to_active( 216 struct wlan_ser_pdev_obj *ser_pdev_obj, 217 struct wlan_objmgr_vdev *vdev, 218 bool blocking_cmd_removed) 219 { 220 struct wlan_serialization_command_list *pending_cmd_list = NULL; 221 struct wlan_serialization_command_list *active_cmd_list; 222 struct wlan_serialization_command cmd_to_remove; 223 enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED; 224 struct wlan_serialization_pdev_queue *pdev_queue; 225 struct wlan_serialization_vdev_queue *vdev_queue; 226 227 struct wlan_ser_vdev_obj *ser_vdev_obj; 228 229 qdf_list_t *pending_queue; 230 qdf_list_node_t *pending_node = NULL; 231 QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; 232 uint32_t blocking_cmd_waiting = 0; 233 uint32_t vdev_id; 234 uint32_t qsize; 235 bool vdev_cmd_active = 0; 236 bool vdev_queue_lookup = false; 237 238 pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN]; 239 240 ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev); 241 vdev_queue = &ser_vdev_obj->vdev_q[SER_VDEV_QUEUE_COMP_NON_SCAN]; 242 243 ser_enter(); 244 245 if (!ser_pdev_obj) { 246 ser_err("Can't find ser_pdev_obj"); 247 goto error; 248 } 249 250 wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock); 251 252 blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting; 253 254 if (!blocking_cmd_removed && !blocking_cmd_waiting) { 255 pending_queue = &vdev_queue->pending_list; 256 vdev_queue_lookup = true; 257 } else { 258 pending_queue = &pdev_queue->pending_list; 259 } 260 261 qsize = wlan_serialization_list_size(pending_queue); 262 if (!qsize) { 263 wlan_serialization_release_lock( 264 &pdev_queue->pdev_queue_lock); 265 ser_debug("Pending Queue is empty"); 266 goto error; 267 } 268 269 while (qsize--) { 270 qdf_status = wlan_serialization_get_cmd_from_queue( 271 pending_queue, &pending_node); 272 if (qdf_status != QDF_STATUS_SUCCESS) { 273 ser_err("can't peek cmd"); 274 break; 275 } 276 277 if (vdev_queue_lookup) { 278 pending_cmd_list = 279 qdf_container_of( 280 pending_node, 281 struct wlan_serialization_command_list, 282 vdev_node); 283 } else { 284 pending_cmd_list = 285 qdf_container_of( 286 pending_node, 287 struct wlan_serialization_command_list, 288 pdev_node); 289 } 290 291 if (!pending_cmd_list) { 292 wlan_serialization_release_lock( 293 &pdev_queue->pdev_queue_lock); 294 ser_debug( 295 "non scan cmd cannot move frm pendin to actv"); 296 goto error; 297 } 298 299 vdev_id = wlan_vdev_get_id(pending_cmd_list->cmd.vdev); 300 vdev_cmd_active = 301 pdev_queue->vdev_active_cmd_bitmap & 302 (1 << vdev_id); 303 304 if (!vdev_queue_lookup) { 305 if (pending_cmd_list->cmd.is_blocking && 306 pdev_queue->vdev_active_cmd_bitmap) { 307 break; 308 } 309 if (vdev_cmd_active) 310 continue; 311 } else { 312 if (vdev_cmd_active) 313 break; 314 } 315 316 qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd, 317 sizeof(struct wlan_serialization_command)); 318 319 qdf_status = wlan_ser_remove_non_scan_cmd(ser_pdev_obj, 320 &pending_cmd_list, 321 &cmd_to_remove, 322 false); 323 324 wlan_ser_update_cmd_history( 325 pdev_queue, &pending_cmd_list->cmd, 326 SER_PENDING_TO_ACTIVE, 327 false, false); 328 329 if (QDF_STATUS_SUCCESS != qdf_status) { 330 wlan_serialization_release_lock( 331 &pdev_queue->pdev_queue_lock); 332 ser_err("Can't remove cmd from pendingQ id-%d type-%d", 333 pending_cmd_list->cmd.cmd_id, 334 pending_cmd_list->cmd.cmd_type); 335 QDF_ASSERT(0); 336 status = WLAN_SER_CMD_DENIED_UNSPECIFIED; 337 goto error; 338 } 339 340 active_cmd_list = pending_cmd_list; 341 342 status = wlan_ser_add_non_scan_cmd( 343 ser_pdev_obj, active_cmd_list, true); 344 345 if (WLAN_SER_CMD_ACTIVE != status) { 346 wlan_serialization_release_lock( 347 &pdev_queue->pdev_queue_lock); 348 ser_err("Can't move cmd to activeQ id-%d type-%d", 349 pending_cmd_list->cmd.cmd_id, 350 pending_cmd_list->cmd.cmd_type); 351 wlan_serialization_insert_back( 352 &pdev_queue->cmd_pool_list, 353 &active_cmd_list->pdev_node); 354 status = WLAN_SER_CMD_DENIED_UNSPECIFIED; 355 QDF_ASSERT(0); 356 goto error; 357 } 358 359 wlan_ser_update_cmd_history( 360 pdev_queue, &active_cmd_list->cmd, 361 SER_PENDING_TO_ACTIVE, 362 true, true); 363 364 qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION, 365 &active_cmd_list->cmd_in_use); 366 367 wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock); 368 369 wlan_serialization_activate_cmd(active_cmd_list, ser_pdev_obj, 370 SER_PENDING_TO_ACTIVE); 371 372 wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock); 373 374 if (vdev_queue_lookup) 375 break; 376 377 pending_node = NULL; 378 379 if (active_cmd_list->cmd.is_blocking) { 380 pdev_queue->blocking_cmd_waiting--; 381 break; 382 } 383 } 384 385 wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock); 386 error: 387 ser_exit(); 388 return status; 389 } 390 391 QDF_STATUS wlan_ser_remove_non_scan_cmd( 392 struct wlan_ser_pdev_obj *ser_pdev_obj, 393 struct wlan_serialization_command_list **pcmd_list, 394 struct wlan_serialization_command *cmd, 395 uint8_t is_active_cmd) 396 { 397 QDF_STATUS pdev_status, vdev_status; 398 QDF_STATUS status = QDF_STATUS_E_FAILURE; 399 uint32_t vdev_id; 400 bool blocking_cmd_removed = 0; 401 struct wlan_serialization_pdev_queue *pdev_queue; 402 403 ser_debug("remove non scan cmd: type[%d] id[%d] prio[%d] blocking[%d]", 404 cmd->cmd_type, 405 cmd->cmd_id, 406 cmd->is_high_priority, 407 cmd->is_blocking); 408 409 vdev_status = 410 wlan_serialization_remove_cmd_from_vdev_queue(ser_pdev_obj, 411 pcmd_list, 412 cmd, 413 is_active_cmd); 414 415 /* Here command removal can fail for 2 reasons 416 * 1. The cmd is not present 417 * 2. The command had not returned from activation 418 * and will not be removed now. 419 * 420 * In the second case, we should not flag it as error 421 * since it will removed after the activation completes. 422 */ 423 424 if (vdev_status != QDF_STATUS_SUCCESS) { 425 status = vdev_status; 426 if (vdev_status != QDF_STATUS_E_PENDING) 427 ser_debug("Failed to remove cmd from vdev queue"); 428 goto error; 429 } 430 431 pdev_status = 432 wlan_serialization_remove_cmd_from_pdev_queue(ser_pdev_obj, 433 pcmd_list, 434 cmd, 435 is_active_cmd); 436 437 if (pdev_status != QDF_STATUS_SUCCESS) { 438 ser_err("Failed to remove cmd from pdev active/pending queue"); 439 goto error; 440 } 441 442 if (is_active_cmd) { 443 blocking_cmd_removed = (*pcmd_list)->cmd.is_blocking; 444 pdev_queue = wlan_serialization_get_pdev_queue_obj( 445 ser_pdev_obj, (*pcmd_list)->cmd.cmd_type); 446 447 if (blocking_cmd_removed) 448 pdev_queue->blocking_cmd_active = 0; 449 450 vdev_id = wlan_vdev_get_id(cmd->vdev); 451 pdev_queue->vdev_active_cmd_bitmap &= ~(1 << vdev_id); 452 } 453 454 status = QDF_STATUS_SUCCESS; 455 456 error: 457 return status; 458 } 459 460 enum wlan_serialization_cmd_status 461 wlan_ser_cancel_non_scan_cmd( 462 struct wlan_ser_pdev_obj *ser_pdev_obj, 463 struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_vdev *vdev, 464 struct wlan_serialization_command *cmd, 465 enum wlan_serialization_cmd_type cmd_type, 466 uint8_t is_active_queue, enum wlan_ser_cmd_attr cmd_attr) 467 { 468 qdf_list_t *pdev_queue; 469 qdf_list_t *vdev_queue; 470 struct wlan_serialization_pdev_queue *pdev_q; 471 uint32_t qsize; 472 uint8_t vdev_id; 473 bool is_blocking; 474 struct wlan_serialization_command_list *cmd_list = NULL; 475 struct wlan_serialization_command cmd_bkup; 476 qdf_list_node_t *nnode = NULL, *pnode = NULL; 477 enum wlan_serialization_cmd_status status = WLAN_SER_CMD_NOT_FOUND; 478 struct wlan_objmgr_psoc *psoc = NULL; 479 QDF_STATUS qdf_status; 480 QDF_STATUS pdev_status, vdev_status; 481 struct wlan_ser_vdev_obj *ser_vdev_obj; 482 483 ser_enter(); 484 485 pdev_q = wlan_serialization_get_pdev_queue_obj(ser_pdev_obj, cmd_type); 486 487 pdev_queue = wlan_serialization_get_list_from_pdev_queue( 488 ser_pdev_obj, cmd_type, is_active_queue); 489 490 if (pdev) 491 psoc = wlan_pdev_get_psoc(pdev); 492 else if (vdev) 493 psoc = wlan_vdev_get_psoc(vdev); 494 else if (cmd && cmd->vdev) 495 psoc = wlan_vdev_get_psoc(cmd->vdev); 496 else 497 ser_debug("Can't find psoc"); 498 499 wlan_serialization_acquire_lock(&pdev_q->pdev_queue_lock); 500 501 qsize = wlan_serialization_list_size(pdev_queue); 502 while (!wlan_serialization_list_empty(pdev_queue) && qsize--) { 503 if (wlan_serialization_get_cmd_from_queue(pdev_queue, &nnode) 504 != QDF_STATUS_SUCCESS) { 505 ser_err("can't read cmd from queue"); 506 status = WLAN_SER_CMD_NOT_FOUND; 507 break; 508 } 509 cmd_list = 510 qdf_container_of(nnode, 511 struct wlan_serialization_command_list, 512 pdev_node); 513 if (cmd && !wlan_serialization_match_cmd_id_type( 514 nnode, cmd, 515 WLAN_SER_PDEV_NODE)) { 516 pnode = nnode; 517 continue; 518 } 519 520 if (vdev && 521 !wlan_serialization_match_cmd_vdev(nnode, 522 vdev, 523 WLAN_SER_PDEV_NODE)) { 524 pnode = nnode; 525 continue; 526 } 527 528 if (pdev && 529 !wlan_serialization_match_cmd_pdev(nnode, 530 pdev, 531 WLAN_SER_PDEV_NODE)) { 532 pnode = nnode; 533 continue; 534 } 535 536 if (cmd_type > WLAN_SER_CMD_NONSCAN && vdev && 537 (!wlan_serialization_match_cmd_type(nnode, cmd_type, 538 WLAN_SER_PDEV_NODE) || 539 !wlan_serialization_match_cmd_vdev(nnode, vdev, 540 WLAN_SER_PDEV_NODE))) { 541 pnode = nnode; 542 continue; 543 } 544 545 /* 546 * If a non-blocking cmd is required to be cancelled, but 547 * the nnode cmd is a blocking cmd then continue with the 548 * next command in the list else proceed with cmd cancel. 549 */ 550 if ((cmd_attr == WLAN_SER_CMD_ATTR_NONBLOCK) && 551 wlan_serialization_match_cmd_blocking(nnode, 552 WLAN_SER_PDEV_NODE)) { 553 pnode = nnode; 554 continue; 555 } 556 557 /* 558 * active queue can't be removed directly, requester needs to 559 * wait for active command response and send remove request for 560 * active command separately 561 */ 562 if (is_active_queue) { 563 if (!psoc || !cmd_list) { 564 ser_err("psoc:0x%pK, cmd_list:0x%pK", 565 psoc, cmd_list); 566 status = WLAN_SER_CMD_NOT_FOUND; 567 break; 568 } 569 570 /* Cancel request received for a cmd in active 571 * queue which has not been activated yet, we mark 572 * it as CMD_ACTIVE_MARKED_FOR_CANCEL and remove 573 * the cmd after activation 574 */ 575 if (qdf_atomic_test_bit(CMD_MARKED_FOR_ACTIVATION, 576 &cmd_list->cmd_in_use)) { 577 qdf_atomic_set_bit(CMD_ACTIVE_MARKED_FOR_CANCEL, 578 &cmd_list->cmd_in_use); 579 status = WLAN_SER_CMD_MARKED_FOR_ACTIVATION; 580 continue; 581 } 582 583 qdf_status = wlan_serialization_find_and_stop_timer( 584 psoc, &cmd_list->cmd, 585 SER_CANCEL); 586 if (QDF_IS_STATUS_ERROR(qdf_status)) { 587 ser_err("Can't find timer for active cmd"); 588 status = WLAN_SER_CMD_NOT_FOUND; 589 /* 590 * This should not happen, as an active command 591 * should always have the timer. 592 */ 593 QDF_BUG(0); 594 break; 595 } 596 597 status = WLAN_SER_CMD_IN_ACTIVE_LIST; 598 } 599 600 qdf_mem_copy(&cmd_bkup, &cmd_list->cmd, 601 sizeof(struct wlan_serialization_command)); 602 603 pdev_status = 604 wlan_serialization_remove_node(pdev_queue, 605 &cmd_list->pdev_node); 606 607 ser_vdev_obj = wlan_serialization_get_vdev_obj( 608 cmd_list->cmd.vdev); 609 610 vdev_queue = wlan_serialization_get_list_from_vdev_queue( 611 ser_vdev_obj, cmd_type, is_active_queue); 612 613 vdev_status = 614 wlan_serialization_remove_node(vdev_queue, 615 &cmd_list->vdev_node); 616 617 if (pdev_status != QDF_STATUS_SUCCESS || 618 vdev_status != QDF_STATUS_SUCCESS) { 619 ser_err("can't remove cmd from pdev/vdev queue"); 620 status = WLAN_SER_CMD_NOT_FOUND; 621 break; 622 } 623 624 qdf_mem_zero(&cmd_list->cmd, 625 sizeof(struct wlan_serialization_command)); 626 cmd_list->cmd_in_use = 0; 627 qdf_status = wlan_serialization_insert_back( 628 &pdev_q->cmd_pool_list, 629 &cmd_list->pdev_node); 630 631 if (QDF_STATUS_SUCCESS != qdf_status) { 632 ser_err("can't remove cmd from queue"); 633 status = WLAN_SER_CMD_NOT_FOUND; 634 break; 635 } 636 nnode = pnode; 637 638 vdev_id = wlan_vdev_get_id(cmd_bkup.vdev); 639 is_blocking = cmd_bkup.is_blocking; 640 641 wlan_ser_update_cmd_history(pdev_q, &cmd_bkup, 642 SER_CANCEL, false, is_active_queue); 643 644 wlan_serialization_release_lock(&pdev_q->pdev_queue_lock); 645 /* 646 * call pending cmd's callback to notify that 647 * it is being removed 648 */ 649 if (cmd_bkup.cmd_cb) { 650 /* caller should now do necessary clean up */ 651 ser_debug("cmd cb: type[%d] id[%d]", 652 cmd_bkup.cmd_type, 653 cmd_bkup.cmd_id); 654 ser_debug("reason: WLAN_SER_CB_CANCEL_CMD"); 655 cmd_bkup.cmd_cb(&cmd_bkup, 656 WLAN_SER_CB_CANCEL_CMD); 657 /* caller should release the memory */ 658 ser_debug("reason: WLAN_SER_CB_RELEASE_MEM_CMD"); 659 cmd_bkup.cmd_cb(&cmd_bkup, 660 WLAN_SER_CB_RELEASE_MEM_CMD); 661 } 662 663 wlan_serialization_acquire_lock(&pdev_q->pdev_queue_lock); 664 665 if (is_active_queue) { 666 if (is_blocking) 667 pdev_q->blocking_cmd_active = 0; 668 pdev_q->vdev_active_cmd_bitmap &= ~(1 << vdev_id); 669 ser_debug("pdev_q->vdev_active_cmd_bitmap %x after reseting for vdev %d", 670 pdev_q->vdev_active_cmd_bitmap, 671 vdev_id); 672 } else { 673 if (is_blocking) 674 pdev_q->blocking_cmd_waiting--; 675 676 status = WLAN_SER_CMD_IN_PENDING_LIST; 677 } 678 679 680 if (!vdev && !pdev) 681 break; 682 } 683 684 wlan_serialization_release_lock(&pdev_q->pdev_queue_lock); 685 686 ser_exit(); 687 return status; 688 } 689