diff --git a/umac/cmn_services/serialization/src/wlan_serialization_main.c b/umac/cmn_services/serialization/src/wlan_serialization_main.c index 98f43e7acdbb..06d936103c41 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_main.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_main.c @@ -271,7 +271,9 @@ static QDF_STATUS wlan_serialization_pdev_create_handler( goto error_free; } - pdev_queue->vdev_active_cmd_bitmap = 0; + qdf_mem_zero(pdev_queue->vdev_active_cmd_bitmap, + sizeof(pdev_queue->vdev_active_cmd_bitmap)); + pdev_queue->blocking_cmd_active = 0; pdev_queue->blocking_cmd_waiting = 0; } diff --git a/umac/cmn_services/serialization/src/wlan_serialization_main_i.h b/umac/cmn_services/serialization/src/wlan_serialization_main_i.h index eabfa895dc8c..35870013c02d 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_main_i.h +++ b/umac/cmn_services/serialization/src/wlan_serialization_main_i.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -80,6 +80,9 @@ #define ser_debug_rl(params...) \ QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_SERIALIZATION, params) +#define ser_debug_hex(ptr, size) \ + qdf_trace_hex_dump(QDF_MODULE_ID_SERIALIZATION, \ + QDF_TRACE_LEVEL_DEBUG, ptr, size) /** * struct serialization_legacy_callback - to handle legacy serialization cb * @serialization_purge_cmd_list: function ptr to be filled by serialization 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 cd41cb7a6a39..b3cab1cdf560 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_non_scan.c @@ -27,6 +27,7 @@ #include "wlan_serialization_main_i.h" #include "wlan_serialization_utils_i.h" #include "wlan_serialization_non_scan_i.h" +#include "qdf_util.h" bool wlan_serialization_is_non_scan_pending_queue_empty( @@ -69,7 +70,7 @@ wlan_serialization_is_active_non_scan_cmd_allowed( { struct wlan_serialization_pdev_queue *pdev_queue; struct wlan_ser_pdev_obj *ser_pdev_obj; - uint32_t vdev_active_cmd_bitmap; + unsigned long *vdev_active_cmd_bitmap; bool blocking_cmd_active = 0; uint8_t blocking_cmd_waiting = 0; bool status = false; @@ -82,6 +83,7 @@ wlan_serialization_is_active_non_scan_cmd_allowed( cmd->cmd_type); vdev_active_cmd_bitmap = pdev_queue->vdev_active_cmd_bitmap; + blocking_cmd_active = pdev_queue->blocking_cmd_active; blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting; @@ -93,7 +95,8 @@ wlan_serialization_is_active_non_scan_cmd_allowed( * For blocking commands, no other * commands from any vdev should be active */ - if (vdev_active_cmd_bitmap) { + + if (wlan_serialization_any_vdev_cmd_active(pdev_queue)) { status = false; pdev_queue->blocking_cmd_waiting++; } else { @@ -114,8 +117,13 @@ wlan_serialization_is_active_non_scan_cmd_allowed( * If not active, put to active else pending queue */ vdev_id = wlan_vdev_get_id(cmd->vdev); - status = vdev_active_cmd_bitmap & (1 << vdev_id) + status = qdf_test_bit(vdev_id, vdev_active_cmd_bitmap) ? false : true; + + ser_debug_hex( + vdev_active_cmd_bitmap, + sizeof(pdev_queue->vdev_active_cmd_bitmap)); + } } return status; @@ -193,6 +201,7 @@ pdev_error: ser_pdev_obj, &pcmd_list, &cmd_list->cmd, is_cmd_for_active_queue); + goto vdev_error; } else { status = pdev_status; } @@ -201,7 +210,7 @@ pdev_error: pdev_queue = wlan_serialization_get_pdev_queue_obj( ser_pdev_obj, cmd_list->cmd.cmd_type); vdev_id = wlan_vdev_get_id(cmd_list->cmd.vdev); - pdev_queue->vdev_active_cmd_bitmap |= (1 << vdev_id); + qdf_set_bit(vdev_id, pdev_queue->vdev_active_cmd_bitmap); if (cmd_list->cmd.is_blocking) pdev_queue->blocking_cmd_active = 1; @@ -293,13 +302,13 @@ wlan_ser_move_non_scan_pending_to_active( } vdev_id = wlan_vdev_get_id(pending_cmd_list->cmd.vdev); - vdev_cmd_active = - pdev_queue->vdev_active_cmd_bitmap & - (1 << vdev_id); + vdev_cmd_active = qdf_test_bit( + vdev_id, pdev_queue->vdev_active_cmd_bitmap); if (!vdev_queue_lookup) { if (pending_cmd_list->cmd.is_blocking && - pdev_queue->vdev_active_cmd_bitmap) { + wlan_serialization_any_vdev_cmd_active( + pdev_queue)) { break; } if (vdev_cmd_active) @@ -439,7 +448,7 @@ QDF_STATUS wlan_ser_remove_non_scan_cmd( pdev_queue->blocking_cmd_active = 0; vdev_id = wlan_vdev_get_id(cmd->vdev); - pdev_queue->vdev_active_cmd_bitmap &= ~(1 << vdev_id); + qdf_clear_bit(vdev_id, pdev_queue->vdev_active_cmd_bitmap); } status = QDF_STATUS_SUCCESS; @@ -649,10 +658,14 @@ wlan_ser_cancel_non_scan_cmd( if (is_active_queue) { if (is_blocking) pdev_q->blocking_cmd_active = 0; - pdev_q->vdev_active_cmd_bitmap &= ~(1 << vdev_id); - ser_debug("pdev_q->vdev_active_cmd_bitmap %x after reseting for vdev %d", - pdev_q->vdev_active_cmd_bitmap, + + qdf_clear_bit(vdev_id, pdev_q->vdev_active_cmd_bitmap); + + ser_debug("active_cmd_bitmap after resetting vdev %d", vdev_id); + ser_debug_hex(pdev_q->vdev_active_cmd_bitmap, + sizeof(pdev_q->vdev_active_cmd_bitmap)); + } else { if (is_blocking) pdev_q->blocking_cmd_waiting--; diff --git a/umac/cmn_services/serialization/src/wlan_serialization_utils.c b/umac/cmn_services/serialization/src/wlan_serialization_utils.c index 4ec739408f03..5f0ef50eb8a5 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_utils.c +++ b/umac/cmn_services/serialization/src/wlan_serialization_utils.c @@ -902,3 +902,22 @@ wlan_serialization_destroy_lock(qdf_spinlock_t *lock) return QDF_STATUS_SUCCESS; } + +bool wlan_serialization_any_vdev_cmd_active( + struct wlan_serialization_pdev_queue *pdev_queue) +{ + bool status = false; + unsigned long any_vdev_active; + uint32_t vdev_bitmap_size; + + vdev_bitmap_size = + (QDF_CHAR_BIT * sizeof(pdev_queue->vdev_active_cmd_bitmap)); + + any_vdev_active = qdf_find_first_bit( + pdev_queue->vdev_active_cmd_bitmap, vdev_bitmap_size); + + if (any_vdev_active < vdev_bitmap_size) + status = true; + + 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 6b9c82f0bfbf..820c78b9b215 100644 --- a/umac/cmn_services/serialization/src/wlan_serialization_utils_i.h +++ b/umac/cmn_services/serialization/src/wlan_serialization_utils_i.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -103,7 +103,7 @@ struct wlan_serialization_pdev_queue { qdf_list_t active_list; qdf_list_t pending_list; qdf_list_t cmd_pool_list; - uint32_t vdev_active_cmd_bitmap; + qdf_bitmap(vdev_active_cmd_bitmap, WLAN_UMAC_PSOC_MAX_VDEVS); bool blocking_cmd_active; uint16_t blocking_cmd_waiting; qdf_spinlock_t pdev_queue_lock; @@ -681,6 +681,15 @@ wlan_serialization_create_lock(qdf_spinlock_t *lock); QDF_STATUS wlan_serialization_destroy_lock(qdf_spinlock_t *lock); +/** + * wlan_serialization_any_vdev_cmd_active() - Check any vdev cmd active for pdev + * @pdev_queue: serialization pdev queue object + * + * Return: true or false + */ +bool wlan_serialization_any_vdev_cmd_active( + struct wlan_serialization_pdev_queue *pdev_queue); + /** * wlan_ser_update_cmd_history() - Update serialization queue history * @pdev_queue:serialization pdev queue