Răsfoiți Sursa

qcacld-3.0: Refine the extscan stop BSSID hotlist logic

Make the following updates to the extscan stop BSSID hotlist logic:
1) Exclusively use the Unified WMI data structures.
2) Update the HDD<=>SME interface to enforce the contract that SME
   must not make any assumptions about the buffers provided by HDD.

Change-Id: I01e29a96fded829c734532b021aeea1960bba641
CRs-Fixed: 2294273
Jeff Johnson 6 ani în urmă
părinte
comite
9743eb7f49

+ 25 - 37
core/hdd/src/wlan_hdd_ext_scan.c

@@ -3484,20 +3484,18 @@ int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy,
  */
 static int
 __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
-						  struct wireless_dev
-						  *wdev, const void *data,
-						  int data_len)
+						struct wireless_dev *wdev,
+						const void *data,
+						int data_len)
 {
-	tpSirExtScanResetBssidHotlistReqParams pReqMsg = NULL;
+	struct extscan_bssid_hotlist_reset_params params;
 	struct net_device *dev = wdev->netdev;
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
-	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX +
-			  1];
+	struct nlattr *tb[EXTSCAN_PARAM_MAX + 1];
 	struct hdd_ext_scan_context *context;
-	uint32_t request_id;
 	QDF_STATUS status;
-	int retval;
+	int id, retval;
 	unsigned long rc;
 
 	hdd_enter_dev(dev);
@@ -3515,42 +3513,35 @@ __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
 		hdd_err("extscan not supported");
 		return -ENOTSUPP;
 	}
-	if (wlan_cfg80211_nla_parse(tb,
-			   QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
-			   data, data_len, wlan_hdd_extscan_config_policy)) {
+
+	if (wlan_cfg80211_nla_parse(tb, EXTSCAN_PARAM_MAX,
+				    data, data_len,
+				    wlan_hdd_extscan_config_policy)) {
 		hdd_err("Invalid ATTR");
 		return -EINVAL;
 	}
 
-	pReqMsg = qdf_mem_malloc(sizeof(*pReqMsg));
-	if (!pReqMsg) {
-		hdd_err("qdf_mem_malloc failed");
-		return -ENOMEM;
-	}
-
 	/* Parse and fetch request Id */
-	if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) {
+	id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID;
+	if (!tb[id]) {
 		hdd_err("attr request id failed");
-		goto fail;
+		return -EINVAL;
 	}
 
-	pReqMsg->requestId =
-		nla_get_u32(tb
-		 [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
-	pReqMsg->sessionId = adapter->session_id;
-	hdd_debug("Req Id %d Session Id %d",
-		pReqMsg->requestId, pReqMsg->sessionId);
+	params.request_id = nla_get_u32(tb[id]);
+	params.vdev_id = adapter->session_id;
+	hdd_debug("Req Id %d vdev Id %d", params.request_id, params.vdev_id);
 
 	context = &ext_scan_context;
 	spin_lock(&context->context_lock);
 	INIT_COMPLETION(context->response_event);
-	context->request_id = request_id = pReqMsg->requestId;
+	context->request_id = params.request_id;
 	spin_unlock(&context->context_lock);
 
-	status = sme_reset_bss_hotlist(hdd_ctx->mac_handle, pReqMsg);
+	status = sme_reset_bss_hotlist(hdd_ctx->mac_handle, &params);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		hdd_err("sme_reset_bss_hotlist failed(err=%d)", status);
-		goto fail;
+		return qdf_status_to_os_return(status);
 	}
 
 	/* request was sent -- wait for the response */
@@ -3562,7 +3553,7 @@ __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
 		retval = -ETIMEDOUT;
 	} else {
 		spin_lock(&context->context_lock);
-		if (context->request_id == request_id)
+		if (context->request_id == params.request_id)
 			retval = context->response_status;
 		else
 			retval = -EINVAL;
@@ -3570,10 +3561,6 @@ __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
 	}
 	hdd_exit();
 	return retval;
-
-fail:
-	qdf_mem_free(pReqMsg);
-	return -EINVAL;
 }
 
 /**
@@ -3586,14 +3573,15 @@ fail:
  * Return: 0 on success, negative errno on failure
  */
 int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy,
-					struct wireless_dev *wdev,
-					const void *data, int data_len)
+						  struct wireless_dev *wdev,
+						  const void *data,
+						  int data_len)
 {
-	int ret = 0;
+	int ret;
 
 	cds_ssr_protect(__func__);
 	ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev,
-								data, data_len);
+							      data, data_len);
 	cds_ssr_unprotect(__func__);
 
 	return ret;

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

@@ -4300,12 +4300,6 @@ typedef struct {
 	uint8_t sessionId;
 } tSirExtScanStopReqParams, *tpSirExtScanStopReqParams;
 
-typedef struct {
-	uint32_t requestId;
-	uint8_t sessionId;
-} tSirExtScanResetBssidHotlistReqParams,
-*tpSirExtScanResetBssidHotlistReqParams;
-
 typedef struct {
 	uint32_t requestId;
 	uint8_t sessionId;

+ 13 - 3
core/sme/inc/sme_api.h

@@ -1007,9 +1007,19 @@ QDF_STATUS
 sme_set_bss_hotlist(mac_handle_t mac_handle,
 		    struct extscan_bssid_hotlist_set_params *params);
 
-QDF_STATUS sme_reset_bss_hotlist(tHalHandle hHal,
-		tSirExtScanResetBssidHotlistReqParams *
-		pResetReq);
+/**
+ * sme_reset_bss_hotlist() - SME API to reset BSSID hotlist
+ * @mac_handle: Opaque handle to the MAC context
+ * @params: extscan reset hotlist structure
+ *
+ * Handles the request to reset the BSSID hotlist in firmware.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+sme_reset_bss_hotlist(mac_handle_t mac_handle,
+		      struct extscan_bssid_hotlist_reset_params *params);
+
 QDF_STATUS sme_set_significant_change(tHalHandle hHal,
 		tSirExtScanSetSigChangeReqParams *
 		pSetSignificantChangeReq);

+ 22 - 21
core/sme/src/common/sme_api.c

@@ -11216,36 +11216,37 @@ sme_set_bss_hotlist(mac_handle_t mac_handle,
 	return status;
 }
 
-/*
- * sme_reset_bss_hotlist() -
- * SME API to reset BSSID hotlist
- *
- * hHal
- * pSetHotListReq: extscan set hotlist structure
- * Return QDF_STATUS
- */
-QDF_STATUS sme_reset_bss_hotlist(tHalHandle hHal,
-				 tSirExtScanResetBssidHotlistReqParams *
-				 pResetReq)
+QDF_STATUS
+sme_reset_bss_hotlist(mac_handle_t mac_handle,
+		      struct extscan_bssid_hotlist_reset_params *params)
 {
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+	QDF_STATUS status;
+	tpAniSirGlobal mac = MAC_CONTEXT(mac_handle);
 	struct scheduler_msg message = {0};
+	struct extscan_bssid_hotlist_reset_params *bodyptr;
 
-	status = sme_acquire_global_lock(&pMac->sme);
+	/* per contract must make a copy of the params when messaging */
+	bodyptr = qdf_mem_malloc(sizeof(*bodyptr));
+	if (!bodyptr) {
+		sme_err("buffer allocation failure");
+		return QDF_STATUS_E_NOMEM;
+	}
+	*bodyptr = *params;
+
+	status = sme_acquire_global_lock(&mac->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
 		/* Serialize the req through MC thread */
-		message.bodyptr = pResetReq;
+		message.bodyptr = bodyptr;
 		message.type = WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
 		MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG,
 				 NO_SESSION, message.type));
-		qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA,
-						 &message);
-		if (!QDF_IS_STATUS_SUCCESS(qdf_status))
-			status = QDF_STATUS_E_FAILURE;
+		status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message);
+		sme_release_global_lock(&mac->sme);
+	}
 
-		sme_release_global_lock(&pMac->sme);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		sme_err("failure: %d", status);
+		qdf_mem_free(bodyptr);
 	}
 	return status;
 }

+ 10 - 1
core/wma/inc/wma_internal.h

@@ -374,8 +374,17 @@ QDF_STATUS wma_stop_extscan(tp_wma_handle wma,
 QDF_STATUS wma_extscan_start_hotlist_monitor(tp_wma_handle wma,
 			struct extscan_bssid_hotlist_set_params *params);
 
+/**
+ * wma_extscan_stop_hotlist_monitor() - stop hotlist monitor
+ * @wma: wma handle
+ * @params: hotlist request params
+ *
+ * This function configures hotlist monitor to stop in fw.
+ *
+ * Return: QDF status
+ */
 QDF_STATUS wma_extscan_stop_hotlist_monitor(tp_wma_handle wma,
-			tSirExtScanResetBssidHotlistReqParams *photlist_reset);
+			struct extscan_bssid_hotlist_reset_params *params);
 
 QDF_STATUS wma_extscan_start_change_monitor(tp_wma_handle wma,
 					    tSirExtScanSetSigChangeReqParams *

+ 1 - 2
core/wma/src/wma_main.c

@@ -8154,8 +8154,7 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
 		qdf_mem_free(msg->bodyptr);
 		break;
 	case WMA_EXTSCAN_RESET_BSSID_HOTLIST_REQ:
-		wma_extscan_stop_hotlist_monitor(wma_handle,
-			(tSirExtScanResetBssidHotlistReqParams *) msg->bodyptr);
+		wma_extscan_stop_hotlist_monitor(wma_handle, msg->bodyptr);
 		qdf_mem_free(msg->bodyptr);
 		break;
 	case WMA_EXTSCAN_SET_SIGNF_CHANGE_REQ:

+ 7 - 20
core/wma/src/wma_scan_roam.c

@@ -4674,39 +4674,26 @@ QDF_STATUS wma_extscan_start_hotlist_monitor(tp_wma_handle wma,
 							     params);
 }
 
-/**
- * wma_extscan_stop_hotlist_monitor() - stop hotlist monitor
- * @wma: wma handle
- * @photlist_reset: hotlist reset params
- *
- * This function configures hotlist monitor to stop in fw.
- *
- * Return: QDF status
- */
 QDF_STATUS wma_extscan_stop_hotlist_monitor(tp_wma_handle wma,
-		    tSirExtScanResetBssidHotlistReqParams *photlist_reset)
+		    struct extscan_bssid_hotlist_reset_params *params)
 {
-	struct extscan_bssid_hotlist_reset_params params = {0};
-
 	if (!wma || !wma->wmi_handle) {
-		WMA_LOGE("%s: WMA is closed, can not issue  cmd", __func__);
+		WMA_LOGE("%s: WMA is closed, can not issue cmd", __func__);
 		return QDF_STATUS_E_INVAL;
 	}
-	if (!photlist_reset) {
-		WMA_LOGE("%s: Invalid reset hotlist buffer", __func__);
+
+	if (!params) {
+		WMA_LOGE("%s: Invalid params", __func__);
 		return QDF_STATUS_E_INVAL;
 	}
 	if (!wmi_service_enabled(wma->wmi_handle,
-				    wmi_service_extscan)) {
+				 wmi_service_extscan)) {
 		WMA_LOGE("%s: extscan not enabled", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	params.request_id = photlist_reset->requestId;
-	params.vdev_id = photlist_reset->requestId;
-
 	return wmi_unified_extscan_stop_hotlist_monitor_cmd(wma->wmi_handle,
-				&params);
+							    params);
 }
 
 /**