Browse Source

qcacld-3.0: TDLS to queue scan req with source during scan reject

When TDLS module reject scan, it will queue the scan request but
does not store the source information, and pass NL_80211 as the
scan source. Thus, if the scan is started by vendor command, still
the scan done callback is given to cfg80211.

Fix is to store the scan source information and queue the scan
request along with scan source information.

Change-Id: Id438f29de0176b1ac73603a1fe0a1a6e231c5278
CRs-Fixed: 1107919
Nitesh Shah 8 years ago
parent
commit
9ed1a9f8de

+ 5 - 2
core/hdd/inc/wlan_hdd_tdls.h

@@ -138,14 +138,16 @@ typedef struct {
  * @magic: magic
  * @attempt: attempt
  * @reject: reject
+ * @source: scan request source(NL/Vendor scan)
  * @tdls_scan_work: delayed tdls scan work
  */
 typedef struct {
 	struct wiphy *wiphy;
 	struct cfg80211_scan_request *scan_request;
-	int magic;
+	uint32_t magic;
 	int attempt;
 	int reject;
+	uint8_t source;
 	struct delayed_work tdls_scan_work;
 } tdls_scan_context_t;
 
@@ -593,7 +595,8 @@ int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
 				    struct cfg80211_scan_request *request);
 
 int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
-				struct cfg80211_scan_request *request);
+				struct cfg80211_scan_request *request,
+				uint8_t source);
 
 void wlan_hdd_tdls_scan_done_callback(hdd_adapter_t *pAdapter);
 

+ 4 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -3335,6 +3335,10 @@ void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t *pAdapter, uint8_t key_index,
 #endif
 hdd_context_t *hdd_cfg80211_wiphy_alloc(int priv_size);
 
+int wlan_hdd_cfg80211_tdls_scan(struct wiphy *wiphy,
+				struct cfg80211_scan_request *request,
+				uint8_t source);
+
 int wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 			   struct cfg80211_scan_request *request);
 

+ 25 - 1
core/hdd/src/wlan_hdd_scan.c

@@ -1590,7 +1590,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 	 * (return -EBUSY)
 	 */
 	status = wlan_hdd_tdls_scan_callback(pAdapter, wiphy,
-					request);
+					request, source);
 	if (status <= 0) {
 		if (!status)
 			hdd_err("TDLS in progress.scan rejected %d",
@@ -1899,6 +1899,30 @@ int wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
 	return ret;
 }
 
+/**
+ * wlan_hdd_cfg80211_tdls_scan() - API to process cfg80211 scan request
+ * @wiphy: Pointer to wiphy
+ * @request: Pointer to scan request
+ * @source: scan request source(NL/Vendor scan)
+ *
+ * This API responds to scan trigger and update cfg80211 scan database
+ * later, scan dump command can be used to recieve scan results. This
+ * function gets called when tdls module queues the scan request.
+ *
+ * Return: 0 for success, non zero for failure.
+ */
+int wlan_hdd_cfg80211_tdls_scan(struct wiphy *wiphy,
+				struct cfg80211_scan_request *request,
+				uint8_t source)
+{
+	int ret;
+	cds_ssr_protect(__func__);
+	ret = __wlan_hdd_cfg80211_scan(wiphy,
+				request, source);
+	cds_ssr_unprotect(__func__);
+	return ret;
+}
+
 /**
  * wlan_hdd_get_rates() -API to get the rates from scan request
  * @wiphy: Pointer to wiphy

+ 12 - 6
core/hdd/src/wlan_hdd_tdls.c

@@ -489,8 +489,8 @@ static void wlan_hdd_tdls_schedule_scan(struct work_struct *work)
 
 	scan_ctx->attempt++;
 
-	wlan_hdd_cfg80211_scan(scan_ctx->wiphy,
-			       scan_ctx->scan_request);
+	wlan_hdd_cfg80211_tdls_scan(scan_ctx->wiphy,
+			       scan_ctx->scan_request, scan_ctx->source);
 }
 
 /**
@@ -636,6 +636,7 @@ void hdd_tdls_context_init(hdd_context_t *hdd_ctx)
 	hdd_ctx->tdls_scan_ctxt.magic = 0;
 	hdd_ctx->tdls_scan_ctxt.attempt = 0;
 	hdd_ctx->tdls_scan_ctxt.reject = 0;
+	hdd_ctx->tdls_scan_ctxt.source = 0;
 	hdd_ctx->tdls_scan_ctxt.scan_request = NULL;
 	hdd_ctx->tdls_external_peer_count = 0;
 	hdd_ctx->set_state_info.set_state_cnt = 0;
@@ -2748,18 +2749,20 @@ int wlan_hdd_tdls_copy_scan_context(hdd_context_t *pHddCtx,
  * @dev: net device
  * @request: scan request
  * @delay: delay value to pass to the work scheduling
+ * @source: scan request source(NL/Vendor scan)
  *
  * Return: Void
  */
 static void wlan_hdd_tdls_scan_init_work(hdd_context_t *pHddCtx,
 					 struct wiphy *wiphy,
 					 struct cfg80211_scan_request *request,
-					 unsigned long delay)
+					 unsigned long delay, uint8_t source)
 {
 	if (TDLS_CTX_MAGIC != pHddCtx->tdls_scan_ctxt.magic) {
 		wlan_hdd_tdls_copy_scan_context(pHddCtx, wiphy, request);
 		pHddCtx->tdls_scan_ctxt.attempt = 0;
 		pHddCtx->tdls_scan_ctxt.magic = TDLS_CTX_MAGIC;
+		pHddCtx->tdls_scan_ctxt.source = source;
 	}
 	schedule_delayed_work(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, delay);
 }
@@ -2776,7 +2779,8 @@ static void wlan_hdd_tdls_scan_init_work(hdd_context_t *pHddCtx,
  *         1 = caller can continue to scan
  */
 int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
-				struct cfg80211_scan_request *request)
+				struct cfg80211_scan_request *request,
+				uint8_t source)
 {
 	hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 	u16 connectedTdlsPeers;
@@ -2829,7 +2833,8 @@ int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
 
 			wlan_hdd_tdls_scan_init_work(pHddCtx, wiphy,
 						     request,
-						     msecs_to_jiffies(delay));
+						     msecs_to_jiffies(delay),
+						     source);
 			/* scan should not continue */
 			return 0;
 		}
@@ -2925,7 +2930,8 @@ int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
 
 			wlan_hdd_tdls_scan_init_work(pHddCtx, wiphy,
 						     request,
-						     msecs_to_jiffies(delay));
+						     msecs_to_jiffies(delay),
+						     source);
 			/* scan should not continue */
 			return 0;
 		}