Browse Source

qcacmn: Add is_wps is_osen in connect req

Add is_wps and is_osen in connect req to avoid parsing assoc ie
multiple time to get the info.

Change-Id: Iae0130e946d02cdacfec986770ef25b3d6b57aa4
CRs-Fixed: 2859665
gaurank kathpalia 4 years ago
parent
commit
4cd10d00e3

+ 27 - 40
umac/mlme/connection_mgr/core/src/wlan_cm_connect.c

@@ -303,17 +303,7 @@ cm_send_connect_start_fail(struct cnx_mgr *cm_ctx,
 	if (!resp)
 	if (!resp)
 		return QDF_STATUS_E_NOMEM;
 		return QDF_STATUS_E_NOMEM;
 
 
-	resp->connect_status = QDF_STATUS_E_FAILURE;
-	resp->cm_id = req->cm_id;
-	resp->vdev_id = wlan_vdev_get_id(cm_ctx->vdev);
-	resp->reason = reason;
-	resp->ssid.length = req->req.ssid.length;
-	qdf_mem_copy(resp->ssid.ssid, req->req.ssid.ssid, resp->ssid.length);
-	if (req->cur_candidate) {
-		qdf_copy_macaddr(&resp->bssid,
-				 &req->cur_candidate->entry->bssid);
-		resp->freq = req->cur_candidate->entry->channel.chan_freq;
-	}
+	cm_fill_failure_resp_from_cm_id(cm_ctx, resp, req->cm_id, reason);
 
 
 	status = cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_CONNECT_FAILURE,
 	status = cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_CONNECT_FAILURE,
 					  sizeof(*resp), resp);
 					  sizeof(*resp), resp);
@@ -661,23 +651,9 @@ static inline void cm_update_advance_filter(struct wlan_objmgr_pdev *pdev,
 static void cm_update_security_filter(struct scan_filter *filter,
 static void cm_update_security_filter(struct scan_filter *filter,
 				      struct wlan_cm_connect_req *req)
 				      struct wlan_cm_connect_req *req)
 {
 {
-	uint8_t wsc_oui[OUI_LENGTH];
-	uint8_t osen_oui[OUI_LENGTH];
-	uint32_t oui_cpu;
-
-	oui_cpu = qdf_be32_to_cpu(WSC_OUI);
-	qdf_mem_copy(wsc_oui, &oui_cpu, OUI_LENGTH);
-	oui_cpu = qdf_be32_to_cpu(OSEN_OUI);
-	qdf_mem_copy(osen_oui, &oui_cpu, OUI_LENGTH);
-
 	/* Ignore security match for rsn override, OSEN and WPS connection */
 	/* Ignore security match for rsn override, OSEN and WPS connection */
-	if (req->force_rsne_override ||
-	    wlan_get_vendor_ie_ptr_from_oui(wsc_oui, OUI_LENGTH,
-					    req->assoc_ie.ptr,
-					    req->assoc_ie.len) ||
-	    wlan_get_vendor_ie_ptr_from_oui(osen_oui, OUI_LENGTH,
-					    req->assoc_ie.ptr,
-					    req->assoc_ie.len)) {
+	if (req->force_rsne_override || req->is_wps_connection ||
+	    req->is_osen_connection) {
 		filter->ignore_auth_enc_type = 1;
 		filter->ignore_auth_enc_type = 1;
 		return;
 		return;
 	}
 	}
@@ -808,21 +784,11 @@ static QDF_STATUS cm_connect_get_candidates(struct wlan_objmgr_pdev *pdev,
 	uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev);
 	uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev);
 	bool security_valid_for_6ghz;
 	bool security_valid_for_6ghz;
 	const uint8_t *rsnxe;
 	const uint8_t *rsnxe;
-	uint8_t wsc_oui[OUI_LENGTH];
-	uint32_t oui_cpu;
-	bool is_wps = false;
 
 
 	filter = qdf_mem_malloc(sizeof(*filter));
 	filter = qdf_mem_malloc(sizeof(*filter));
 	if (!filter)
 	if (!filter)
 		return QDF_STATUS_E_NOMEM;
 		return QDF_STATUS_E_NOMEM;
 
 
-	oui_cpu = qdf_be32_to_cpu(WSC_OUI);
-	qdf_mem_copy(wsc_oui, &oui_cpu, OUI_LENGTH);
-	if (wlan_get_vendor_ie_ptr_from_oui(wsc_oui, OUI_LENGTH,
-					    cm_req->req.assoc_ie.ptr,
-					    cm_req->req.assoc_ie.len))
-		is_wps = true;
-
 	rsnxe = wlan_get_ie_ptr_from_eid(WLAN_ELEMID_RSNXE,
 	rsnxe = wlan_get_ie_ptr_from_eid(WLAN_ELEMID_RSNXE,
 					 cm_req->req.assoc_ie.ptr,
 					 cm_req->req.assoc_ie.ptr,
 					 cm_req->req.assoc_ie.len);
 					 cm_req->req.assoc_ie.len);
@@ -831,7 +797,7 @@ static QDF_STATUS cm_connect_get_candidates(struct wlan_objmgr_pdev *pdev,
 					     cm_req->req.crypto.akm_suites,
 					     cm_req->req.crypto.akm_suites,
 					     cm_req->req.crypto.rsn_caps,
 					     cm_req->req.crypto.rsn_caps,
 					     rsnxe, cm_req->req.sae_pwe,
 					     rsnxe, cm_req->req.sae_pwe,
-					     is_wps);
+					     cm_req->req.is_wps_connection);
 
 
 	/*
 	/*
 	 * Ignore connect req if the freq is provided and its 6Ghz and
 	 * Ignore connect req if the freq is provided and its 6Ghz and
@@ -1458,6 +1424,8 @@ cm_resume_connect_after_peer_create(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id)
 	req.vdev_id = wlan_vdev_get_id(cm_ctx->vdev);
 	req.vdev_id = wlan_vdev_get_id(cm_ctx->vdev);
 	req.cm_id = *cm_id;
 	req.cm_id = *cm_id;
 	req.force_rsne_override = cm_req->connect_req.req.force_rsne_override;
 	req.force_rsne_override = cm_req->connect_req.req.force_rsne_override;
+	req.is_wps_connection = cm_req->connect_req.req.is_wps_connection;
+	req.is_osen_connection = cm_req->connect_req.req.is_osen_connection;
 	req.assoc_ie = cm_req->connect_req.req.assoc_ie;
 	req.assoc_ie = cm_req->connect_req.req.assoc_ie;
 	req.scan_ie = cm_req->connect_req.req.scan_ie;
 	req.scan_ie = cm_req->connect_req.req.scan_ie;
 	req.bss = cm_req->connect_req.cur_candidate;
 	req.bss = cm_req->connect_req.cur_candidate;
@@ -1468,7 +1436,7 @@ cm_resume_connect_after_peer_create(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id)
 	req.vht_caps_mask = cm_req->connect_req.req.vht_caps_mask;
 	req.vht_caps_mask = cm_req->connect_req.req.vht_caps_mask;
 
 
 	wlan_reg_get_cc_and_src(psoc, country_code);
 	wlan_reg_get_cc_and_src(psoc, country_code);
-	mlme_nofl_info(CM_PREFIX_FMT "Connecting to %.*s " QDF_MAC_ADDR_FMT " rssi: %d freq: %d akm 0x%x cipher: uc 0x%x mc 0x%x, CC: %c%c",
+	mlme_nofl_info(CM_PREFIX_FMT "Connecting to %.*s " QDF_MAC_ADDR_FMT " rssi: %d freq: %d akm 0x%x cipher: uc 0x%x mc 0x%x, wps %d osen %d force RSN %d CC: %c%c",
 		       CM_PREFIX_REF(req.vdev_id, req.cm_id),
 		       CM_PREFIX_REF(req.vdev_id, req.cm_id),
 		       cm_req->connect_req.req.ssid.length,
 		       cm_req->connect_req.req.ssid.length,
 		       cm_req->connect_req.req.ssid.ssid,
 		       cm_req->connect_req.req.ssid.ssid,
@@ -1476,7 +1444,9 @@ cm_resume_connect_after_peer_create(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id)
 		       req.bss->entry->rssi_raw,
 		       req.bss->entry->rssi_raw,
 		       req.bss->entry->channel.chan_freq,
 		       req.bss->entry->channel.chan_freq,
 		       neg_sec_info->key_mgmt, neg_sec_info->ucastcipherset,
 		       neg_sec_info->key_mgmt, neg_sec_info->ucastcipherset,
-		       neg_sec_info->mcastcipherset, country_code[0],
+		       neg_sec_info->mcastcipherset, req.is_wps_connection,
+		       req.is_osen_connection, req.force_rsne_override,
+		       country_code[0],
 		       country_code[1]);
 		       country_code[1]);
 
 
 	status = mlme_cm_connect_req(cm_ctx->vdev, &req);
 	status = mlme_cm_connect_req(cm_ctx->vdev, &req);
@@ -1825,10 +1795,27 @@ cm_set_crypto_params_from_ie(struct wlan_cm_connect_req *req)
 {
 {
 	struct wlan_crypto_params crypto_params;
 	struct wlan_crypto_params crypto_params;
 	QDF_STATUS status;
 	QDF_STATUS status;
+	uint8_t wsc_oui[OUI_LENGTH];
+	uint8_t osen_oui[OUI_LENGTH];
+	uint32_t oui_cpu;
 
 
 	if (!req->assoc_ie.ptr)
 	if (!req->assoc_ie.ptr)
 		return;
 		return;
 
 
+	oui_cpu = qdf_be32_to_cpu(WSC_OUI);
+	qdf_mem_copy(wsc_oui, &oui_cpu, OUI_LENGTH);
+	oui_cpu = qdf_be32_to_cpu(OSEN_OUI);
+	qdf_mem_copy(osen_oui, &oui_cpu, OUI_LENGTH);
+	if (wlan_get_vendor_ie_ptr_from_oui(osen_oui, OUI_LENGTH,
+					    req->assoc_ie.ptr,
+					    req->assoc_ie.len))
+		req->is_osen_connection = true;
+
+	if (wlan_get_vendor_ie_ptr_from_oui(wsc_oui, OUI_LENGTH,
+					    req->assoc_ie.ptr,
+					    req->assoc_ie.len))
+		req->is_wps_connection = true;
+
 	status = wlan_get_crypto_params_from_rsn_ie(&crypto_params,
 	status = wlan_get_crypto_params_from_rsn_ie(&crypto_params,
 						    req->assoc_ie.ptr,
 						    req->assoc_ie.ptr,
 						    req->assoc_ie.len);
 						    req->assoc_ie.len);

+ 6 - 1
umac/mlme/connection_mgr/core/src/wlan_cm_util.c

@@ -409,7 +409,8 @@ cm_fill_connect_resp_from_req(struct wlan_cm_connect_resp *resp,
 		resp->freq = req->chan_freq;
 		resp->freq = req->chan_freq;
 
 
 	resp->ssid = req->ssid;
 	resp->ssid = req->ssid;
-
+	resp->is_wps_connection = req->is_wps_connection;
+	resp->is_osen_connection = req->is_osen_connection;
 	cm_set_fils_connection_from_req(req, resp);
 	cm_set_fils_connection_from_req(req, resp);
 }
 }
 
 
@@ -1102,6 +1103,10 @@ bool cm_get_active_connect_req(struct wlan_objmgr_vdev *vdev,
 			req->vdev_id = wlan_vdev_get_id(vdev);
 			req->vdev_id = wlan_vdev_get_id(vdev);
 			req->cm_id = cm_req->connect_req.cm_id;
 			req->cm_id = cm_req->connect_req.cm_id;
 			req->bss =  cm_req->connect_req.cur_candidate;
 			req->bss =  cm_req->connect_req.cur_candidate;
+			req->is_wps_connection =
+				cm_req->connect_req.req.is_wps_connection;
+			req->is_osen_connection =
+				cm_req->connect_req.req.is_osen_connection;
 			status = true;
 			status = true;
 			cm_req_lock_release(cm_ctx);
 			cm_req_lock_release(cm_ctx);
 			return status;
 			return status;

+ 14 - 2
umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h

@@ -173,6 +173,8 @@ enum wlan_cm_source {
  * used with out validation, used for the scenarios where the device is used
  * used with out validation, used for the scenarios where the device is used
  * as a testbed device with special functionality and not recommended
  * as a testbed device with special functionality and not recommended
  * for production.
  * for production.
+ * @is_wps_connection: if its wps connection
+ * @is_osen_connection: if its osen connection
  * @dot11mode_filter: dot11mode filter used to restrict connection to
  * @dot11mode_filter: dot11mode filter used to restrict connection to
  * 11n/11ac/11ax.
  * 11n/11ac/11ax.
  * @sae_pwe: SAE mechanism for PWE derivation
  * @sae_pwe: SAE mechanism for PWE derivation
@@ -196,7 +198,9 @@ struct wlan_cm_connect_req {
 	struct wlan_cm_connect_crypto_info crypto;
 	struct wlan_cm_connect_crypto_info crypto;
 	struct element_info assoc_ie;
 	struct element_info assoc_ie;
 	struct element_info scan_ie;
 	struct element_info scan_ie;
-	bool force_rsne_override;
+	uint8_t force_rsne_override:1,
+		is_wps_connection:1,
+		is_osen_connection:1;
 	enum dot11_mode_filter dot11mode_filter;
 	enum dot11_mode_filter dot11mode_filter;
 	uint8_t sae_pwe;
 	uint8_t sae_pwe;
 	uint16_t ht_caps;
 	uint16_t ht_caps;
@@ -217,6 +221,8 @@ struct wlan_cm_connect_req {
  * used with out validation, used for the scenarios where the device is used
  * used with out validation, used for the scenarios where the device is used
  * as a testbed device with special functionality and not recommended
  * as a testbed device with special functionality and not recommended
  * for production.
  * for production.
+ * @is_wps_connection: if its wps connection
+ * @is_osen_connection: if its osen connection
  * @ht_caps: ht capability
  * @ht_caps: ht capability
  * @ht_caps_mask: mask of valid ht caps
  * @ht_caps_mask: mask of valid ht caps
  * @vht_caps: vht capability
  * @vht_caps: vht capability
@@ -229,7 +235,9 @@ struct wlan_cm_connect_req {
 struct wlan_cm_vdev_connect_req {
 struct wlan_cm_vdev_connect_req {
 	uint8_t vdev_id;
 	uint8_t vdev_id;
 	wlan_cm_id cm_id;
 	wlan_cm_id cm_id;
-	bool force_rsne_override;
+	uint8_t force_rsne_override:1,
+		is_wps_connection:1,
+		is_osen_connection:1;
 	uint16_t ht_caps;
 	uint16_t ht_caps;
 	uint16_t ht_caps_mask;
 	uint16_t ht_caps_mask;
 	uint32_t vht_caps;
 	uint32_t vht_caps;
@@ -397,6 +405,8 @@ struct wlan_connect_rsp_ies {
  * struct wlan_cm_connect_rsp - connect resp from VDEV mgr and will be sent to
  * struct wlan_cm_connect_rsp - connect resp from VDEV mgr and will be sent to
  * OSIF
  * OSIF
  * @vdev_id: vdev id
  * @vdev_id: vdev id
+ * @is_wps_connection: if its wps connection
+ * @is_osen_connection: if its osen connection
  * @cm_id: Connect manager id
  * @cm_id: Connect manager id
  * @bssid: BSSID of the ap
  * @bssid: BSSID of the ap
  * @ssid: SSID of the connection
  * @ssid: SSID of the connection
@@ -410,6 +420,8 @@ struct wlan_connect_rsp_ies {
  */
  */
 struct wlan_cm_connect_resp {
 struct wlan_cm_connect_resp {
 	uint8_t vdev_id;
 	uint8_t vdev_id;
+	uint8_t is_wps_connection:1,
+		is_osen_connection:1;
 	wlan_cm_id cm_id;
 	wlan_cm_id cm_id;
 	struct qdf_mac_addr bssid;
 	struct qdf_mac_addr bssid;
 	struct wlan_ssid ssid;
 	struct wlan_ssid ssid;