Ver código fonte

qcacld-3.0: Clean up SME stats ext event handling

There are multiple trivial issues with the SME stats ext event
handling:
* sme_stats_ext_event() is exported as a global function even though
  its use is local to sme_api.c
* As a local API sme_stats_ext_event() should take an internal MAC
  context instead of an external HAL handle
* The dispatch code in sme_process_msg() incorporates conditional
  compilation within the function body.
* There is replication of parameter checking.

Normally such trivial issues would not be addressed, however an
upcoming change will enforce type safety and no longer allow
tHalHandle and tpAniSirGlobal to be freely exchanged, so in
preparation perform the following cleanups:
* Make sme_stats_ext_event() static
* Change sme_stats_ext_event() to take a tpAniSirGlobal MAC context
* Provide a stub implementation of sme_stats_ext_event() when the
  WLAN_FEATURE_STATS_EXT feature is not enabled
* Remove the WLAN_FEATURE_STATS_EXT featurization from
  sme_process_msg()
* Remove the parameter checking from sme_process_msg()

Change-Id: I367e9d73ca50bd5c24e9261ceb2c3a504fb70e1a
CRs-Fixed: 2264796
Jeff Johnson 7 anos atrás
pai
commit
fdecd51166
2 arquivos alterados com 29 adições e 27 exclusões
  1. 0 1
      core/sme/inc/sme_api.h
  2. 29 26
      core/sme/src/common/sme_api.c

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

@@ -906,7 +906,6 @@ QDF_STATUS sme_send_unit_test_cmd(uint32_t vdev_id, uint32_t module_id,
 void sme_stats_ext_deregister_callback(tHalHandle hhal);
 QDF_STATUS sme_stats_ext_request(uint8_t session_id,
 		tpStatsExtRequestReq input);
-QDF_STATUS sme_stats_ext_event(tHalHandle hHal, void *pMsg);
 #endif
 QDF_STATUS sme_update_dfs_scan_mode(tHalHandle hHal,
 		uint8_t sessionId,

+ 29 - 26
core/sme/src/common/sme_api.c

@@ -78,6 +78,9 @@ QDF_STATUS sme_unprotected_mgmt_frm_ind(tHalHandle hHal,
 static QDF_STATUS sme_process_channel_change_resp(tpAniSirGlobal pMac,
 					   uint16_t msg_type, void *pMsgBuf);
 
+static QDF_STATUS sme_stats_ext_event(tpAniSirGlobal mac,
+				      tpStatsExtEvent msg);
+
 /* Internal SME APIs */
 QDF_STATUS sme_acquire_global_lock(tSmeStruct *psSme)
 {
@@ -2136,16 +2139,10 @@ QDF_STATUS sme_process_msg(tHalHandle hHal, struct scheduler_msg *pMsg)
 			sme_err("Empty message for: %d", pMsg->type);
 		}
 		break;
-#ifdef WLAN_FEATURE_STATS_EXT
 	case eWNI_SME_STATS_EXT_EVENT:
-		if (pMsg->bodyptr) {
-			status = sme_stats_ext_event(hHal, pMsg->bodyptr);
-			qdf_mem_free(pMsg->bodyptr);
-		} else {
-			sme_err("Empty message for: %d", pMsg->type);
-		}
+		status = sme_stats_ext_event(pMac, pMsg->bodyptr);
+		qdf_mem_free(pMsg->bodyptr);
 		break;
-#endif
 	case eWNI_SME_GET_PEER_INFO_IND:
 		if (pMac->sme.pget_peer_info_ind_cb)
 			pMac->sme.pget_peer_info_ind_cb(pMsg->bodyptr,
@@ -10823,30 +10820,36 @@ QDF_STATUS sme_stats_ext_request(uint8_t session_id, tpStatsExtRequestReq input)
 	return QDF_STATUS_SUCCESS;
 }
 
-/*
- * sme_stats_ext_event() -
+/**
+ * sme_stats_ext_event() - eWNI_SME_STATS_EXT_EVENT processor
+ * @mac: Global MAC context
+ * @msg: "stats ext" message
+
  * This callback function called when SME received eWNI_SME_STATS_EXT_EVENT
- *  response from WMA
+ * response from WMA
  *
- * hHal - HAL handle for device
- * pMsg - Message body passed from WMA; includes NAN header
- * Return QDF_STATUS
+ * Return: QDF_STATUS
  */
-QDF_STATUS sme_stats_ext_event(tHalHandle hHal, void *pMsg)
+static QDF_STATUS sme_stats_ext_event(tpAniSirGlobal mac,
+				      tpStatsExtEvent msg)
 {
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-
-	if (NULL == pMsg) {
-		sme_err("pMsg is NULL in sme_stats_ext_event");
-		status = QDF_STATUS_E_FAILURE;
-	} else {
-		if (pMac->sme.StatsExtCallback)
-			pMac->sme.StatsExtCallback(pMac->hHdd,
-						   (tpStatsExtEvent) pMsg);
+	if (!msg) {
+		sme_err("Null msg");
+		return QDF_STATUS_E_FAILURE;
 	}
 
-	return status;
+	if (mac->sme.StatsExtCallback)
+		mac->sme.StatsExtCallback(mac->hHdd, msg);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+#else
+
+static QDF_STATUS sme_stats_ext_event(tpAniSirGlobal mac,
+				      tpStatsExtEvent msg)
+{
+	return QDF_STATUS_SUCCESS;
 }
 
 #endif