浏览代码

qcacld-3.0: Map internal PCL weight to the FW weight representation

Map the internal PCL weights to the weights that the FW can
understand.

Change-Id: Ib7b2a67305ddec991fe94016cea09a834e5b4cb5
CRs-Fixed: 1050438
Manishekar Chandrasekaran 8 年之前
父节点
当前提交
b82554d382
共有 3 个文件被更改,包括 74 次插入1 次删除
  1. 1 0
      core/cds/inc/cds_concurrency.h
  2. 40 1
      core/cds/src/cds_concurrency.c
  3. 33 0
      core/wma/src/wma_main.c

+ 1 - 0
core/cds/inc/cds_concurrency.h

@@ -64,6 +64,7 @@
 		(WEIGHT_OF_GROUP2_PCL_CHANNELS - PCL_GROUPS_WEIGHT_DIFFERENCE)
 
 #define WEIGHT_OF_NON_PCL_CHANNELS 1
+#define WEIGHT_OF_DISALLOWED_CHANNELS 0
 
 /**
  * enum hw_mode_ss_config - Possible spatial stream configuration

+ 40 - 1
core/cds/src/cds_concurrency.c

@@ -8699,6 +8699,14 @@ QDF_STATUS cds_get_sap_mandatory_channel(uint32_t *chan)
 QDF_STATUS cds_get_valid_chan_weights(struct sir_pcl_chan_weights *weight)
 {
 	uint32_t i, j;
+	cds_context_type *cds_ctx;
+	struct cds_conc_connection_info info;
+
+	cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	if (!weight->pcl_list) {
 		cds_err("Invalid pcl");
@@ -8715,8 +8723,39 @@ QDF_STATUS cds_get_valid_chan_weights(struct sir_pcl_chan_weights *weight)
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	qdf_mem_set(weight->weighed_valid_list, QDF_MAX_NUM_CHAN,
+		    WEIGHT_OF_DISALLOWED_CHANNELS);
+
+	qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+	if (cds_mode_specific_connection_count(CDS_STA_MODE, NULL) > 0) {
+		/*
+		 * Store the STA mode's parameter and temporarily delete it
+		 * from the concurrency table. This way the allow concurrency
+		 * check can be used as though a new connection is coming up,
+		 * allowing to detect the disallowed channels.
+		 */
+		cds_store_and_del_conn_info(CDS_STA_MODE, &info);
+		qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+		/*
+		 * There is a small window between releasing the above lock
+		 * and acquiring the same in cds_allow_concurrency, below!
+		 */
+		for (i = 0; i < weight->saved_num_chan; i++) {
+			if (cds_allow_concurrency(CDS_STA_MODE,
+						  weight->saved_chan_list[i],
+						  HW_MODE_20_MHZ)) {
+				weight->weighed_valid_list[i] =
+					WEIGHT_OF_NON_PCL_CHANNELS;
+			}
+		}
+
+		qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
+		/* Restore the connection info */
+		cds_restore_deleted_conn_info(&info);
+	}
+	qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
+
 	for (i = 0; i < weight->saved_num_chan; i++) {
-		weight->weighed_valid_list[i] = WEIGHT_OF_NON_PCL_CHANNELS;
 		for (j = 0; j < weight->pcl_len; j++) {
 			if (weight->saved_chan_list[i] == weight->pcl_list[j]) {
 				weight->weighed_valid_list[i] =

+ 33 - 0
core/wma/src/wma_main.c

@@ -6222,6 +6222,30 @@ void wma_log_completion_timeout(void *data)
 	return;
 }
 
+/**
+ * wma_map_pcl_weights() - Map PCL weights
+ * @pcl_weight: Internal PCL weights
+ *
+ * Maps the internal weights of PCL to the weights needed by FW
+ *
+ * Return: Mapped channel weight of type wmi_pcl_chan_weight
+ */
+static wmi_pcl_chan_weight wma_map_pcl_weights(uint32_t pcl_weight)
+{
+	switch (pcl_weight) {
+	case WEIGHT_OF_GROUP1_PCL_CHANNELS:
+		return WMI_PCL_WEIGHT_VERY_HIGH;
+	case WEIGHT_OF_GROUP2_PCL_CHANNELS:
+		return WMI_PCL_WEIGHT_HIGH;
+	case WEIGHT_OF_GROUP3_PCL_CHANNELS:
+		return WMI_PCL_WEIGHT_MEDIUM;
+	case WEIGHT_OF_NON_PCL_CHANNELS:
+		return WMI_PCL_WEIGHT_LOW;
+	default:
+		return WMI_PCL_WEIGHT_DISALLOW;
+	}
+}
+
 /**
  * wma_send_pdev_set_pcl_cmd() - Send WMI_SOC_SET_PCL_CMDID to FW
  * @wma_handle: WMA handle
@@ -6260,6 +6284,15 @@ QDF_STATUS wma_send_pdev_set_pcl_cmd(tp_wma_handle wma_handle,
 
 	msg->saved_num_chan = wma_handle->saved_chan.num_channels;
 	status = cds_get_valid_chan_weights((struct sir_pcl_chan_weights *)msg);
+
+	for (i = 0; i < msg->saved_num_chan; i++) {
+		msg->weighed_valid_list[i] =
+			wma_map_pcl_weights(msg->weighed_valid_list[i]);
+		WMA_LOGD("%s: chan:%d weight[%d]=%d", __func__,
+			 msg->saved_chan_list[i], i,
+			 msg->weighed_valid_list[i]);
+	}
+
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		WMA_LOGE("%s: Error in creating weighed pcl", __func__);
 		return status;