From 595e6ee3909ee12ce9e3c9c5ce2ed5c7320de82d Mon Sep 17 00:00:00 2001 From: Vivek Date: Mon, 15 Oct 2018 11:20:11 +0530 Subject: [PATCH] qcacmn: Additional flag to mark cmds both for activation and cancel Adding additional flag for commands which has been marked for activation and for which cancel has been received. After the commands marked for activation and also marked for cancel really gets active, we remove the command from the active queue. Change-Id: I5eb42459e216ad8cbcee15ce9a7572dec7f776a2 CRs-Fixed: 2326639 --- .../src/wlan_serialization_internal.c | 15 ++++++++++++++- .../src/wlan_serialization_non_scan.c | 12 ++++++------ .../serialization/src/wlan_serialization_scan.c | 12 ++++++------ .../src/wlan_serialization_utils_i.h | 1 + 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/umac/cmn_services/serialization/src/wlan_serialization_internal.c b/umac/cmn_services/serialization/src/wlan_serialization_internal.c index ba2daee5ce22..d2f697336e53 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_internal.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_internal.c @@ -276,9 +276,22 @@ QDF_STATUS wlan_serialization_activate_cmd( wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock); - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_ERROR(status)) { wlan_serialization_dequeue_cmd(&cmd_list->cmd, true); + return status; + } + /* + * Cmd was marked for activation and cancel + * was received before activation so the command + * should be immediately removed after activation + */ + if (qdf_atomic_test_bit(CMD_ACTIVE_MARKED_FOR_CANCEL, + &cmd_list->cmd_in_use)) + wlan_serialization_cmd_cancel_handler( + ser_pdev_obj, &cmd_list->cmd, + NULL, NULL, cmd_list->cmd.cmd_type, + WLAN_SERIALIZATION_ACTIVE_QUEUE); error: return status; } diff --git a/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c b/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c index 1f468d96f6a5..1844b6f4c656 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c @@ -490,15 +490,16 @@ wlan_ser_cancel_non_scan_cmd( } /* Cancel request received for a cmd in active - * queue which has not been activated yet, we - * should assert here + * queue which has not been activated yet, we mark + * it as CMD_ACTIVE_MARKED_FOR_CANCEL and remove + * the cmd after activation */ if (qdf_atomic_test_bit(CMD_MARKED_FOR_ACTIVATION, &cmd_list->cmd_in_use)) { - wlan_serialization_release_lock( - &pdev_q->pdev_queue_lock); + qdf_atomic_set_bit(CMD_ACTIVE_MARKED_FOR_CANCEL, + &cmd_list->cmd_in_use); status = WLAN_SER_CMD_MARKED_FOR_ACTIVATION; - goto error; + continue; } qdf_status = wlan_serialization_find_and_stop_timer( @@ -589,7 +590,6 @@ wlan_ser_cancel_non_scan_cmd( wlan_serialization_release_lock(&pdev_q->pdev_queue_lock); -error: ser_exit(); return status; } diff --git a/umac/cmn_services/serialization/src/wlan_serialization_scan.c b/umac/cmn_services/serialization/src/wlan_serialization_scan.c index 99e24a6c1672..006c8a814d91 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_scan.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_scan.c @@ -237,15 +237,16 @@ wlan_ser_cancel_scan_cmd( } /* Cancel request received for a cmd in active - * queue which has not been activated yet, we - * should assert here + * queue which has not been activated yet, we mark + * it as CMD_ACTIVE_MARKED_FOR_CANCEL and remove + * the cmd after activation */ if (qdf_atomic_test_bit(CMD_MARKED_FOR_ACTIVATION, &cmd_list->cmd_in_use)) { - wlan_serialization_release_lock( - &pdev_q->pdev_queue_lock); + qdf_atomic_set_bit(CMD_ACTIVE_MARKED_FOR_CANCEL, + &cmd_list->cmd_in_use); status = WLAN_SER_CMD_MARKED_FOR_ACTIVATION; - goto error; + continue; } qdf_status = wlan_serialization_find_and_stop_timer( @@ -312,7 +313,6 @@ wlan_ser_cancel_scan_cmd( wlan_serialization_release_lock(&pdev_q->pdev_queue_lock); -error: ser_exit(); return status; } diff --git a/umac/cmn_services/serialization/src/wlan_serialization_utils_i.h b/umac/cmn_services/serialization/src/wlan_serialization_utils_i.h index b324c86176f1..cc6729365800 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_utils_i.h +++ b/umac/cmn_services/serialization/src/wlan_serialization_utils_i.h @@ -635,6 +635,7 @@ QDF_STATUS wlan_serialization_peek_next( */ #define CMD_MARKED_FOR_ACTIVATION 1 #define CMD_IS_ACTIVE 2 +#define CMD_ACTIVE_MARKED_FOR_CANCEL 3 /** * struct wlan_serialization_timer - Timer used for serialization * @cmd: Cmd to which the timer is linked