Browse Source

qcacld-3.0: Add PNO changes for converged scan

Adds PNO related changes for converged scan.

Change-Id: Ie7194d15d2d6ad5e4327e3aadbb4e39a5bf576a8
CRs-Fixed: 2013212
Abhishek Singh 8 years ago
parent
commit
b20db96d64

+ 23 - 0
core/hdd/src/wlan_hdd_main.c

@@ -10935,6 +10935,27 @@ static int hdd_update_pmo_config(hdd_context_t *hdd_ctx)
 }
 
 #ifdef NAPIER_SCAN
+
+#ifdef FEATURE_WLAN_SCAN_PNO
+static inline void hdd_update_pno_config(struct pno_user_cfg *pno_cfg,
+	struct hdd_config *cfg)
+{
+	pno_cfg->channel_prediction = cfg->pno_channel_prediction;
+	pno_cfg->top_k_num_of_channels = cfg->top_k_num_of_channels;
+	pno_cfg->stationary_thresh = cfg->stationary_thresh;
+	pno_cfg->adaptive_dwell_mode = cfg->adaptive_dwell_mode_enabled;
+	pno_cfg->channel_prediction_full_scan =
+		cfg->channel_prediction_full_scan;
+}
+#else
+static inline void
+hdd_update_pno_config(struct pno_user_cfg *pno_cfg,
+	struct hdd_config *cfg)
+{
+	return;
+}
+#endif
+
 /**
  * hdd_update_scan_config - API to update scan configuration parameters
  * @hdd_ctx: HDD context
@@ -10958,6 +10979,8 @@ static int hdd_update_scan_config(hdd_context_t *hdd_ctx)
 	scan_cfg.scan_cache_aging_time = cfg->scanAgingTimeout;
 	scan_cfg.scan_dwell_time_mode = cfg->scan_adaptive_dwell_mode;
 
+	hdd_update_pno_config(&scan_cfg.pno_cfg, cfg);
+
 	status = ucfg_scan_update_user_config(psoc, &scan_cfg);
 	if (status != QDF_STATUS_SUCCESS) {
 		hdd_err("failed pmo psoc configuration");

+ 6 - 8
core/hdd/src/wlan_hdd_scan.c

@@ -2679,14 +2679,9 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	if ((QDF_STA_MODE == pAdapter->device_mode) &&
-	    (eConnectionState_Connecting ==
-	     (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) {
-		hdd_err("%p(%d) Connection in progress: sched_scan_start denied (EBUSY)",
-		       WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
-		       pAdapter->sessionId);
-		return -EBUSY;
-	}
+#ifdef NAPIER_SCAN
+	return wlan_cfg80211_sched_scan_start(pHddCtx->hdd_pdev, dev, request);
+#endif
 
 	MTRACE(qdf_trace(QDF_MODULE_ID_HDD,
 			 TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START,
@@ -2943,6 +2938,9 @@ int wlan_hdd_sched_scan_stop(struct net_device *dev)
 		goto exit;
 	}
 
+#ifdef NAPIER_SCAN
+	return wlan_cfg80211_sched_scan_stop(hdd_ctx->hdd_pdev, dev);
+#endif
 	pno_req = (tpSirPNOScanReq) qdf_mem_malloc(sizeof(tSirPNOScanReq));
 	if (NULL == pno_req) {
 		hdd_err("qdf_mem_malloc failed");

+ 5 - 0
core/hdd/src/wlan_hdd_scan.h

@@ -77,6 +77,11 @@ int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy,
  * Return: 0 for success, non zero for failure
  */
 int wlan_hdd_sched_scan_stop(struct net_device *dev);
+#else
+static inline int wlan_hdd_sched_scan_stop(struct net_device *dev)
+{
+	return 0;
+}
 #endif /* End of FEATURE_WLAN_SCAN_PNO */
 
 int wlan_hdd_cfg80211_vendor_scan(struct wiphy *wiphy,

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

@@ -295,8 +295,12 @@ void wma_set_channel(tp_wma_handle wma, tpSwitchChannelParams params);
 QDF_STATUS wma_pno_start(tp_wma_handle wma, tpSirPNOScanReq pno);
 
 QDF_STATUS wma_pno_stop(tp_wma_handle wma, uint8_t vdev_id);
-
+#ifndef NAPIER_SCAN
 void wma_config_pno(tp_wma_handle wma, tpSirPNOScanReq pno);
+#else
+static inline void wma_config_pno(tp_wma_handle wma, tpSirPNOScanReq pno) {}
+#endif
+
 void wma_set_pno_channel_prediction(uint8_t *buf_ptr,
 		tpSirPNOScanReq pno);
 void wma_scan_cache_updated_ind(tp_wma_handle wma, uint8_t sessionId);

+ 11 - 8
core/wma/src/wma_features.c

@@ -71,6 +71,7 @@
 #include "wma_nan_datapath.h"
 #include <cdp_txrx_handle.h>
 #include "wlan_pmo_ucfg_api.h"
+#include <target_if_scan.h>
 
 #ifndef ARRAY_LENGTH
 #define ARRAY_LENGTH(a)         (sizeof(a) / sizeof((a)[0]))
@@ -3224,21 +3225,23 @@ int wma_wow_wakeup_host_event(void *handle, uint8_t *event,
 #ifdef FEATURE_WLAN_SCAN_PNO
 	case WOW_REASON_NLOD:
 		if (wma_vdev) {
+			wmi_nlo_event *nlo_event;
+			WMI_NLO_MATCH_EVENTID_param_tlvs param_buf;
+
 			WMA_LOGD("NLO match happened");
-			wma_vdev->nlo_match_evt_received = true;
-			cds_host_diag_log_work(&wma->pno_wake_lock,
-					WMA_PNO_MATCH_WAKE_LOCK_TIMEOUT,
-					WIFI_POWER_EVENT_WAKELOCK_PNO);
-			qdf_wake_lock_timeout_acquire(&wma->pno_wake_lock,
-					WMA_PNO_MATCH_WAKE_LOCK_TIMEOUT);
+			nlo_event = param_buf.fixed_param;
+			nlo_event->vdev_id = wake_info->vdev_id;
+			target_if_nlo_match_event_handler(handle,
+				(uint8_t *)&param_buf,
+				sizeof(WMI_NLO_MATCH_EVENTID_param_tlvs));
 		}
 		break;
 
 	case WOW_REASON_NLO_SCAN_COMPLETE:
 		WMA_LOGD("Host woken up due to pno scan complete reason");
 		if (param_buf->wow_packet_buffer)
-			wma_nlo_scan_cmp_evt_handler(handle,
-					wmi_cmd_struct_ptr, wow_buf_pkt_len);
+			target_if_nlo_complete_handler(handle,
+				wmi_cmd_struct_ptr, wow_buf_pkt_len);
 		else
 			WMA_LOGD("No wow_packet_buffer present");
 		break;

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

@@ -3081,7 +3081,7 @@ QDF_STATUS wma_start(void *cds_ctx)
 		qdf_status = QDF_STATUS_E_FAILURE;
 		goto end;
 	}
-
+#ifndef NAPIER_SCAN
 #ifdef FEATURE_WLAN_SCAN_PNO
 	if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap,
 				   WMI_SERVICE_NLO)) {
@@ -3109,6 +3109,7 @@ QDF_STATUS wma_start(void *cds_ctx)
 		}
 	}
 #endif /* FEATURE_WLAN_SCAN_PNO */
+#endif
 
 #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \
 	defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(CONFIG_HL_SUPPORT)

+ 61 - 57
core/wma/src/wma_scan_roam.c

@@ -3012,6 +3012,7 @@ send_resp:
 }
 
 #ifdef FEATURE_WLAN_SCAN_PNO
+#ifndef NAPIER_SCAN
 /**
  * wma_set_pno_channel_prediction() - Set PNO configuration
  * @buf_ptr:      Buffer passed by upper layers
@@ -3196,6 +3197,8 @@ void wma_config_pno(tp_wma_handle wma, tpSirPNOScanReq pno)
 	 * processing PNO request. */
 	qdf_mem_free(pno);
 }
+#endif
+#endif
 
 #ifdef FEATURE_WLAN_ESE
 /**
@@ -3352,63 +3355,6 @@ void wma_config_plm(tp_wma_handle wma, tpSirPlmReq plm)
 }
 #endif
 
-/**
- * wma_scan_cache_updated_ind() - scan update indication
- * @wma: wma handle
- * @sessionId: session ID
- *
- * After pushing cached scan results (that are stored in LIM) to SME,
- * PE will post WMA_SME_SCAN_CACHE_UPDATED message indication to
- * wma and intern this function handles that message. This function will
- * check for PNO completion (by checking NLO match event) and post PNO
- * completion back to SME if PNO operation is completed successfully.
- *
- * Return: none
- */
-void wma_scan_cache_updated_ind(tp_wma_handle wma, uint8_t sessionId)
-{
-	tSirPrefNetworkFoundInd *nw_found_ind;
-	QDF_STATUS status;
-	struct scheduler_msg cds_msg;
-	uint8_t len, i;
-
-	for (i = 0; i < wma->max_bssid; i++) {
-		if (wma->interfaces[i].nlo_match_evt_received)
-			break;
-	}
-
-	if (i == wma->max_bssid) {
-		WMA_LOGD("PNO match event is not received in any vdev, skip scan cache update indication");
-		return;
-	}
-	wma->interfaces[i].nlo_match_evt_received = false;
-
-	WMA_LOGD("Posting PNO completion to umac");
-
-	len = sizeof(tSirPrefNetworkFoundInd);
-	nw_found_ind = (tSirPrefNetworkFoundInd *) qdf_mem_malloc(len);
-
-	if (NULL == nw_found_ind) {
-		WMA_LOGE("%s: Memory allocation failure", __func__);
-		return;
-	}
-
-	nw_found_ind->mesgType = eWNI_SME_PREF_NETWORK_FOUND_IND;
-	nw_found_ind->mesgLen = len;
-	nw_found_ind->sessionId = sessionId;
-
-	cds_msg.type = eWNI_SME_PREF_NETWORK_FOUND_IND;
-	cds_msg.bodyptr = (void *)nw_found_ind;
-	cds_msg.bodyval = 0;
-
-	status = scheduler_post_msg(QDF_MODULE_ID_SME, &cds_msg);
-	if (status != QDF_STATUS_SUCCESS) {
-		WMA_LOGE("%s: Failed to post PNO completion match event to SME",
-			 __func__);
-		qdf_mem_free(nw_found_ind);
-	}
-}
-
 #ifdef FEATURE_WLAN_EXTSCAN
 /**
  * wma_extscan_wow_event_callback() - extscan wow event callback
@@ -3474,6 +3420,64 @@ void wma_extscan_wow_event_callback(void *handle, void *event, uint32_t len)
 }
 #endif
 
+#ifdef FEATURE_WLAN_SCAN_PNO
+/**
+ * wma_scan_cache_updated_ind() - scan update indication
+ * @wma: wma handle
+ * @sessionId: session ID
+ *
+ * After pushing cached scan results (that are stored in LIM) to SME,
+ * PE will post WMA_SME_SCAN_CACHE_UPDATED message indication to
+ * wma and intern this function handles that message. This function will
+ * check for PNO completion (by checking NLO match event) and post PNO
+ * completion back to SME if PNO operation is completed successfully.
+ *
+ * Return: none
+ */
+void wma_scan_cache_updated_ind(tp_wma_handle wma, uint8_t sessionId)
+{
+	tSirPrefNetworkFoundInd *nw_found_ind;
+	QDF_STATUS status;
+	struct scheduler_msg cds_msg;
+	uint8_t len, i;
+
+	for (i = 0; i < wma->max_bssid; i++) {
+		if (wma->interfaces[i].nlo_match_evt_received)
+			break;
+	}
+
+	if (i == wma->max_bssid) {
+		WMA_LOGD("PNO match event is not received in any vdev, skip scan cache update indication");
+		return;
+	}
+	wma->interfaces[i].nlo_match_evt_received = false;
+
+	WMA_LOGD("Posting PNO completion to umac");
+
+	len = sizeof(tSirPrefNetworkFoundInd);
+	nw_found_ind = (tSirPrefNetworkFoundInd *) qdf_mem_malloc(len);
+
+	if (NULL == nw_found_ind) {
+		WMA_LOGE("%s: Memory allocation failure", __func__);
+		return;
+	}
+
+	nw_found_ind->mesgType = eWNI_SME_PREF_NETWORK_FOUND_IND;
+	nw_found_ind->mesgLen = len;
+	nw_found_ind->sessionId = sessionId;
+
+	cds_msg.type = eWNI_SME_PREF_NETWORK_FOUND_IND;
+	cds_msg.bodyptr = (void *)nw_found_ind;
+	cds_msg.bodyval = 0;
+
+	status = scheduler_post_msg(QDF_MODULE_ID_SME, &cds_msg);
+	if (status != QDF_STATUS_SUCCESS) {
+		WMA_LOGE("%s: Failed to post PNO completion match event to SME",
+			 __func__);
+		qdf_mem_free(nw_found_ind);
+	}
+}
+
 /**
  * wma_nlo_match_evt_handler() - nlo match event handler
  * @handle: wma handle