Browse Source

qcacld-3.0: Serialize IPA stats command in low priority queue

Currently IPA stats command request gets scheduled at every
100ms and posts message to WMA queue which can cause MC
thread to prioritize these request messages over other
messages in pe queue. This can cause delayed processing of
association related messages in pe queue in noisy environement.

To avoid this serialize IPA stats cmd to lower priority SME queue.

Change-Id: I1f8257b869dacd65a61e52e34f001ee24c108c4a
CRs-Fixed: 2040579
Sandeep Puligilla 8 years ago
parent
commit
f587adff92

+ 3 - 3
core/hdd/src/wlan_hdd_ipa.c

@@ -1763,9 +1763,9 @@ static void __hdd_ipa_uc_stat_request(hdd_adapter_t *adapter, uint8_t reason)
 		(false == hdd_ipa->resource_loading)) {
 		hdd_ipa->stat_req_reason = reason;
 		qdf_mutex_release(&hdd_ipa->ipa_lock);
-		wma_cli_set_command(
-			(int)adapter->sessionId,
-			(int)WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID,
+		sme_ipa_uc_stat_request(WLAN_HDD_GET_HAL_CTX(adapter),
+			adapter->sessionId,
+			WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID,
 			0, VDEV_CMD);
 	} else {
 		qdf_mutex_release(&hdd_ipa->ipa_lock);

+ 20 - 0
core/mac/inc/sir_api.h

@@ -7175,4 +7175,24 @@ enum scan_reject_states {
 	EAPOL_IN_PROGRESS,
 	SAP_EAPOL_IN_PROGRESS,
 };
+
+/**
+ * struct ani_ipa_stat_req - IPA stats request
+ * @msg_type: Message type
+ * @msg_len: Message Length
+ * @vdev_id: Vdev Id
+ * @param_id: param id
+ * @param_val: param value
+ * @req_type: request type
+ *
+ * IPA stats request message structure
+ */
+struct ani_ipa_stat_req {
+	uint16_t msg_type;
+	uint16_t msg_len;
+	uint16_t vdev_id;
+	uint32_t param_id;
+	uint32_t param_val;
+	uint32_t req_type;
+};
 #endif /* __SIR_API_H */

+ 1 - 0
core/mac/inc/wni_api.h

@@ -258,6 +258,7 @@ enum eWniMsgTypes {
 	eWNI_SME_RSO_CMD_STATUS_IND,
 	eWMI_SME_LL_STATS_IND,
 	eWNI_SME_DFS_CAC_COMPLETE,
+	eWNI_SME_IPA_STATS_REQ_CMD,
 	eWNI_SME_MSG_TYPES_END
 };
 

+ 12 - 0
core/sme/inc/sme_api.h

@@ -1506,4 +1506,16 @@ QDF_STATUS sme_set_dbs_scan_selection_config(tHalHandle hal,
  */
 void sme_store_pdev(tHalHandle hal, struct wlan_objmgr_pdev *pdev);
 
+/**
+ * sme_ipa_uc_stat_request() - set ipa config parameters
+ * @vdev_id: virtual device for the command
+ * @param_id: parameter id
+ * @param_val: parameter value
+ * @req_cat: parameter category
+ *
+ * Return: QDF_STATUS_SUCCESS or non-zero on failure
+ */
+QDF_STATUS sme_ipa_uc_stat_request(tHalHandle hal,
+			uint32_t vdev_id, uint32_t param_id,
+			uint32_t param_val, uint32_t req_cat);
 #endif /* #if !defined( __SME_API_H ) */

+ 79 - 0
core/sme/src/common/sme_api.c

@@ -1373,6 +1373,33 @@ QDF_STATUS sme_start(tHalHandle hHal)
 	return status;
 }
 
+static QDF_STATUS sme_handle_ipa_uc_stat_request(
+		tpAniSirGlobal mac_ctx, void *msg)
+{
+	wma_cli_set_cmd_t *iwcmd;
+	struct ani_ipa_stat_req *ipa_stat_msg;
+
+	ipa_stat_msg = msg;
+	iwcmd = qdf_mem_malloc(sizeof(*iwcmd));
+	if (!iwcmd) {
+		sme_err("Failed alloc memory for iwcmd");
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	qdf_mem_zero(iwcmd, sizeof(*iwcmd));
+	iwcmd->param_sec_value = 0;
+	iwcmd->param_vdev_id = ipa_stat_msg->vdev_id;
+	iwcmd->param_id = ipa_stat_msg->param_id;
+	iwcmd->param_vp_dev = ipa_stat_msg->req_type;
+	iwcmd->param_value =  ipa_stat_msg->param_val;
+
+	sme_info("param_id %d", iwcmd->param_id);
+	wma_ipa_uc_stat_request(iwcmd);
+	qdf_mem_free(iwcmd);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * sme_handle_scan_req() - Scan request handler
  * @mac_ctx: MAC global context
@@ -2635,6 +2662,17 @@ QDF_STATUS sme_process_msg(tHalHandle hHal, struct scheduler_msg *pMsg)
 							  pMsg->bodyptr);
 		qdf_mem_free(pMsg->bodyptr);
 		break;
+
+	case eWNI_SME_IPA_STATS_REQ_CMD:
+		if (pMsg->bodyptr) {
+			status = sme_handle_ipa_uc_stat_request(pMac,
+							 pMsg->bodyptr);
+			qdf_mem_free(pMsg->bodyptr);
+		} else {
+			sme_err("Empty message for: %d", pMsg->type);
+		}
+		break;
+
 	default:
 
 		if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN)
@@ -16145,3 +16183,44 @@ QDF_STATUS sme_congestion_register_callback(tHalHandle hal,
 
 	return status;
 }
+
+QDF_STATUS sme_ipa_uc_stat_request(tHalHandle hal, uint32_t vdev_id,
+			uint32_t param_id, uint32_t param_val, uint32_t req_cat)
+{
+	struct ani_ipa_stat_req	*ipa_stat_msg;
+	struct scheduler_msg msg = {0};
+	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
+	QDF_STATUS status;
+
+	status = sme_acquire_global_lock(&mac_ctx->sme);
+	if (!QDF_IS_STATUS_SUCCESS(status)) {
+		sme_err("Unable to acquire lock");
+		return status;
+	}
+
+	ipa_stat_msg = qdf_mem_malloc(sizeof(struct ani_ipa_stat_req));
+	if (NULL == ipa_stat_msg) {
+		sme_release_global_lock(&mac_ctx->sme);
+		sme_err("Failed to allocate memory for ipa_stat_msg");
+		return QDF_STATUS_E_NOMEM;
+	}
+	ipa_stat_msg->msg_type = eWNI_SME_IPA_STATS_REQ_CMD;
+	ipa_stat_msg->msg_len = (uint16_t) sizeof(struct ani_ipa_stat_req);
+	ipa_stat_msg->vdev_id = vdev_id;
+	ipa_stat_msg->param_id = param_id;
+	ipa_stat_msg->param_val = param_val;
+	ipa_stat_msg->req_type = req_cat;
+	msg.type = eWNI_SME_IPA_STATS_REQ_CMD;
+	msg.bodyptr = ipa_stat_msg;
+	msg.reserved = 0;
+	msg.bodyval = 0;
+	if (QDF_STATUS_SUCCESS !=
+		scheduler_post_msg(QDF_MODULE_ID_SME, &msg)) {
+		sme_err("sme_ipa_uc_stat_request failed to post msg");
+		qdf_mem_free(ipa_stat_msg);
+		status = QDF_STATUS_E_FAILURE;
+	}
+	sme_release_global_lock(&mac_ctx->sme);
+
+	return status;
+}

+ 8 - 0
core/wma/inc/wma.h

@@ -2479,4 +2479,12 @@ static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
 }
 #endif /* WMI_INTERFACE_EVENT_LOGGING */
 
+/**
+ * wma_ipa_uc_stat_request() - set ipa config parameters
+ * @privcmd: private command
+ *
+ * Return: None
+ */
+void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd);
+
 #endif

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

@@ -7497,3 +7497,10 @@ int wma_peer_rx_reorder_queue_remove(void *scn_handle,
 }
 
 
+void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd)
+{
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
+
+	if (wma_set_priv_cfg(wma, privcmd))
+		WMA_LOGE("Failed to set wma priv congiuration");
+}