Browse Source

qcacmn: Define serialization active vdev bitmap using qdf_bitmap

The active vdev bitmap used in serialization is
32bits and it is per pdev.

But in cases, where there can be more than 32 vaps
configured, the bit positions of a 32bit bitmap cannot
be used to indicate the active commands for a vdev whose
id is more than 31.

So, we need to increase active cmd vdev bitmap to support
for max number of vdev ids that is possible for a pdev.

Considering the vdev id is per psoc scope and can spread
across pdevs, increasing the size of the bitmap to max
vdevs supported per psoc.

CRs-Fixed: 2656046
Change-Id: Ic7728145b208492af218320fa84f35bb1f918aab
Vivek 5 years ago
parent
commit
bb32488efe

+ 3 - 1
umac/cmn_services/serialization/src/wlan_serialization_main.c

@@ -271,7 +271,9 @@ static QDF_STATUS wlan_serialization_pdev_create_handler(
 			goto error_free;
 			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_active = 0;
 		pdev_queue->blocking_cmd_waiting = 0;
 		pdev_queue->blocking_cmd_waiting = 0;
 	}
 	}

+ 4 - 1
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
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * any purpose with or without fee is hereby granted, provided that the
@@ -80,6 +80,9 @@
 #define ser_debug_rl(params...) \
 #define ser_debug_rl(params...) \
 	QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_SERIALIZATION, 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
  * struct serialization_legacy_callback - to handle legacy serialization cb
  * @serialization_purge_cmd_list: function ptr to be filled by serialization
  * @serialization_purge_cmd_list: function ptr to be filled by serialization

+ 25 - 12
umac/cmn_services/serialization/src/wlan_serialization_non_scan.c

@@ -27,6 +27,7 @@
 #include "wlan_serialization_main_i.h"
 #include "wlan_serialization_main_i.h"
 #include "wlan_serialization_utils_i.h"
 #include "wlan_serialization_utils_i.h"
 #include "wlan_serialization_non_scan_i.h"
 #include "wlan_serialization_non_scan_i.h"
+#include "qdf_util.h"
 
 
 bool
 bool
 wlan_serialization_is_non_scan_pending_queue_empty(
 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_serialization_pdev_queue *pdev_queue;
 	struct wlan_ser_pdev_obj *ser_pdev_obj;
 	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;
 	bool blocking_cmd_active = 0;
 	uint8_t blocking_cmd_waiting = 0;
 	uint8_t blocking_cmd_waiting = 0;
 	bool status = false;
 	bool status = false;
@@ -82,6 +83,7 @@ wlan_serialization_is_active_non_scan_cmd_allowed(
 							   cmd->cmd_type);
 							   cmd->cmd_type);
 
 
 	vdev_active_cmd_bitmap = pdev_queue->vdev_active_cmd_bitmap;
 	vdev_active_cmd_bitmap = pdev_queue->vdev_active_cmd_bitmap;
+
 	blocking_cmd_active = pdev_queue->blocking_cmd_active;
 	blocking_cmd_active = pdev_queue->blocking_cmd_active;
 	blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting;
 	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
 		 * For blocking commands, no other
 		 * commands from any vdev should be active
 		 * commands from any vdev should be active
 		 */
 		 */
-		if (vdev_active_cmd_bitmap) {
+
+		if (wlan_serialization_any_vdev_cmd_active(pdev_queue)) {
 			status = false;
 			status = false;
 			pdev_queue->blocking_cmd_waiting++;
 			pdev_queue->blocking_cmd_waiting++;
 		} else {
 		} else {
@@ -114,8 +117,13 @@ wlan_serialization_is_active_non_scan_cmd_allowed(
 		 * If not active, put to active else pending queue
 		 * If not active, put to active else pending queue
 		 */
 		 */
 			vdev_id = wlan_vdev_get_id(cmd->vdev);
 			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;
 						? false : true;
+
+			ser_debug_hex(
+				vdev_active_cmd_bitmap,
+				sizeof(pdev_queue->vdev_active_cmd_bitmap));
+
 		}
 		}
 	}
 	}
 	return status;
 	return status;
@@ -193,6 +201,7 @@ pdev_error:
 			ser_pdev_obj, &pcmd_list,
 			ser_pdev_obj, &pcmd_list,
 			&cmd_list->cmd,
 			&cmd_list->cmd,
 			is_cmd_for_active_queue);
 			is_cmd_for_active_queue);
+		goto vdev_error;
 	} else {
 	} else {
 		status = pdev_status;
 		status = pdev_status;
 	}
 	}
@@ -201,7 +210,7 @@ pdev_error:
 		pdev_queue = wlan_serialization_get_pdev_queue_obj(
 		pdev_queue = wlan_serialization_get_pdev_queue_obj(
 				ser_pdev_obj, cmd_list->cmd.cmd_type);
 				ser_pdev_obj, cmd_list->cmd.cmd_type);
 		vdev_id = wlan_vdev_get_id(cmd_list->cmd.vdev);
 		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)
 		if (cmd_list->cmd.is_blocking)
 			pdev_queue->blocking_cmd_active = 1;
 			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_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 (!vdev_queue_lookup) {
 			if (pending_cmd_list->cmd.is_blocking &&
 			if (pending_cmd_list->cmd.is_blocking &&
-			    pdev_queue->vdev_active_cmd_bitmap) {
+			    wlan_serialization_any_vdev_cmd_active(
+					pdev_queue)) {
 				break;
 				break;
 			}
 			}
 			if (vdev_cmd_active)
 			if (vdev_cmd_active)
@@ -439,7 +448,7 @@ QDF_STATUS wlan_ser_remove_non_scan_cmd(
 			pdev_queue->blocking_cmd_active = 0;
 			pdev_queue->blocking_cmd_active = 0;
 
 
 		vdev_id = wlan_vdev_get_id(cmd->vdev);
 		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;
 	status = QDF_STATUS_SUCCESS;
@@ -649,10 +658,14 @@ wlan_ser_cancel_non_scan_cmd(
 		if (is_active_queue) {
 		if (is_active_queue) {
 			if (is_blocking)
 			if (is_blocking)
 				pdev_q->blocking_cmd_active = 0;
 				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);
 				  vdev_id);
+			ser_debug_hex(pdev_q->vdev_active_cmd_bitmap,
+				      sizeof(pdev_q->vdev_active_cmd_bitmap));
+
 		} else {
 		} else {
 			if (is_blocking)
 			if (is_blocking)
 				pdev_q->blocking_cmd_waiting--;
 				pdev_q->blocking_cmd_waiting--;

+ 19 - 0
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;
 	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;
+}

+ 11 - 2
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
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * 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 active_list;
 	qdf_list_t pending_list;
 	qdf_list_t pending_list;
 	qdf_list_t cmd_pool_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;
 	bool blocking_cmd_active;
 	uint16_t blocking_cmd_waiting;
 	uint16_t blocking_cmd_waiting;
 	qdf_spinlock_t pdev_queue_lock;
 	qdf_spinlock_t pdev_queue_lock;
@@ -681,6 +681,15 @@ wlan_serialization_create_lock(qdf_spinlock_t *lock);
 QDF_STATUS
 QDF_STATUS
 wlan_serialization_destroy_lock(qdf_spinlock_t *lock);
 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
  * wlan_ser_update_cmd_history() - Update serialization queue history
  * @pdev_queue:serialization pdev queue
  * @pdev_queue:serialization pdev queue