From ba57c33317bd5ae129a5cad19f58ae93bbf41ca0 Mon Sep 17 00:00:00 2001 From: Santosh Anbu Date: Tue, 25 Dec 2018 22:58:24 +0530 Subject: [PATCH] qcacmn: Return if cmd already exists in pending queue When adding stop command to the serialization queue, if the command is getting added to the pending queue of the vdev and there already existed another stop command in the same queue, then return already exists as the return value after the command is enqueued. This to avoid notifying the vdev state machine with down event multiple times though the command already in the pending queue would have notified. Change-Id: I1830251c6b6c1fa2860f17a3ea8a869e8a3c87ff CRs-Fixed: 2372563 --- umac/mlme/mlme_utils/wlan_vdev_mlme_ser_if.c | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/umac/mlme/mlme_utils/wlan_vdev_mlme_ser_if.c b/umac/mlme/mlme_utils/wlan_vdev_mlme_ser_if.c index 1565a1aaf0e0..cce98ef337ea 100644 --- a/umac/mlme/mlme_utils/wlan_vdev_mlme_ser_if.c +++ b/umac/mlme/mlme_utils/wlan_vdev_mlme_ser_if.c @@ -72,17 +72,24 @@ wlan_vdev_mlme_ser_start_bss(struct wlan_serialization_command *cmd) enum wlan_serialization_status wlan_vdev_mlme_ser_stop_bss(struct wlan_serialization_command *cmd) { + uint8_t stop_cmd_pending; + uint8_t ret; + if (!cmd || !cmd->vdev) { mlme_err("Null input"); return WLAN_SER_CMD_DENIED_UNSPECIFIED; } /* * Serialization command filtering logic - * a.Cancel any existing start/stop/restart command in the pending - * queue. - * b.If there is a stop cmd in active queue then return - * c.Else enqueue the cmd + * a. Cancel any existing start/stop/restart command in the pending + * queue. + * b. If there is a stop cmd in active queue then return + * c. Else enqueue the cmd + * d. If stop cmd already existed in pending queue then return with + * already exists else return the enqueued return value. */ + stop_cmd_pending = + wlan_serialization_is_cmd_present_in_pending_queue(NULL, cmd); wlan_vdev_mlme_ser_cancel_request(cmd->vdev, WLAN_SER_CMD_NONSCAN, WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD); @@ -92,7 +99,12 @@ wlan_vdev_mlme_ser_stop_bss(struct wlan_serialization_command *cmd) return WLAN_SER_CMD_DENIED_UNSPECIFIED; } - return wlan_serialization_request(cmd); + ret = wlan_serialization_request(cmd); + + if (stop_cmd_pending && ret == WLAN_SER_CMD_PENDING) + return WLAN_SER_CMD_ALREADY_EXISTS; + else + return ret; } enum wlan_serialization_status