فهرست منبع

qcacld-3.0: Refactor hdd_register_wext()

In addition to actually registering with wireless extensions,
hdd_register_wext() initializes data structures associated with the
STA's roam profile. Since roam profile initialization is independent
of wireless extensions, refactor all of the roam profile
initialization code out of hdd_register_wext(), and relocate it to
wlan_hdd_assoc.c.

Change-Id: Ibd19b02373694b169ba9c122c812a264e6b8a63b
CRs-Fixed: 2212067
Jeff Johnson 7 سال پیش
والد
کامیت
7f2c5915a9

+ 11 - 0
core/hdd/inc/wlan_hdd_assoc.h

@@ -412,4 +412,15 @@ void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap,
 void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap,
 		       tDot11fIEVHTCaps *roam_vht_cap);
 
+/**
+ * hdd_roam_profile_init() - initialize adapter roam profile
+ * @adapter: The HDD adapter being initialized
+ *
+ * This function initializes the roam profile that is embedded within
+ * the adapter.
+ *
+ * Return: void
+ */
+void hdd_roam_profile_init(struct hdd_adapter *adapter);
+
 #endif

+ 20 - 3
core/hdd/inc/wlan_hdd_wext.h

@@ -237,8 +237,26 @@ struct ccp_freq_chan_map {
 #define HDD_FWTEST_MU_DEFAULT_VALUE 40
 #define HDD_FWTEST_MAX_VALUE 500
 
-int hdd_unregister_wext(struct net_device *dev);
-int hdd_register_wext(struct net_device *dev);
+/**
+ * hdd_unregister_wext() - unregister wext context
+ * @dev: net device handle
+ *
+ * Unregisters wext interface context for a given net device
+ *
+ * Returns: None
+ */
+void hdd_unregister_wext(struct net_device *dev);
+
+/**
+ * hdd_register_wext() - register wext context
+ * @dev: net device handle
+ *
+ * Registers wext interface context for a given net device
+ *
+ * Returns: None
+ */
+void hdd_register_wext(struct net_device *dev);
+
 int hdd_wlan_get_freq(uint32_t chan, uint32_t *freq);
 void hdd_display_stats_help(void);
 void hdd_wlan_get_version(struct hdd_context *hdd_ctx,
@@ -276,7 +294,6 @@ void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len);
 int wlan_hdd_get_linkspeed_for_peermac(struct hdd_adapter *adapter,
 				       struct qdf_mac_addr *mac_address,
 				       uint32_t *linkspeed);
-void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter);
 
 QDF_STATUS wlan_hdd_get_class_astats(struct hdd_adapter *adapter);
 

+ 127 - 0
core/hdd/src/wlan_hdd_assoc.c

@@ -1484,6 +1484,72 @@ static void hdd_conn_remove_connect_info(struct hdd_station_ctx *sta_ctx)
 	qdf_mem_zero(&sta_ctx->conn_info.SSID, sizeof(tCsrSSIDInfo));
 }
 
+/**
+ * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs
+ * @adapter: adapter who's IEs are to be cleared
+ *
+ * Return: None
+ */
+static void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter)
+{
+	struct hdd_station_ctx *sta_ctx;
+	struct csr_roam_profile *roam_profile;
+
+	hdd_enter();
+
+	/* clear WPA/RSN/WSC IE information in the profile */
+	roam_profile = hdd_roam_profile(adapter);
+
+	roam_profile->nWPAReqIELength = 0;
+	roam_profile->pWPAReqIE = NULL;
+	roam_profile->nRSNReqIELength = 0;
+	roam_profile->pRSNReqIE = NULL;
+
+#ifdef FEATURE_WLAN_WAPI
+	roam_profile->nWAPIReqIELength = 0;
+	roam_profile->pWAPIReqIE = NULL;
+#endif
+
+	roam_profile->bWPSAssociation = false;
+	roam_profile->bOSENAssociation = false;
+	roam_profile->pAddIEScan = NULL;
+	roam_profile->nAddIEScanLength = 0;
+	roam_profile->pAddIEAssoc = NULL;
+	roam_profile->nAddIEAssocLength = 0;
+
+	roam_profile->EncryptionType.numEntries = 1;
+	roam_profile->EncryptionType.encryptionType[0] =
+		eCSR_ENCRYPT_TYPE_NONE;
+
+	roam_profile->mcEncryptionType.numEntries = 1;
+	roam_profile->mcEncryptionType.encryptionType[0] =
+		eCSR_ENCRYPT_TYPE_NONE;
+
+	roam_profile->AuthType.numEntries = 1;
+	roam_profile->AuthType.authType[0] =
+		eCSR_AUTH_TYPE_OPEN_SYSTEM;
+
+	qdf_mem_zero(roam_profile->bssid_hint.bytes, QDF_MAC_ADDR_SIZE);
+
+#ifdef WLAN_FEATURE_11W
+	roam_profile->MFPEnabled = false;
+	roam_profile->MFPRequired = 0;
+	roam_profile->MFPCapable = 0;
+#endif
+
+	qdf_mem_zero(roam_profile->Keys.KeyLength, CSR_MAX_NUM_KEY);
+
+#ifdef FEATURE_WLAN_WAPI
+	adapter->wapi_info.wapi_auth_mode = WAPI_AUTH_MODE_OPEN;
+	adapter->wapi_info.wapi_mode = false;
+#endif
+
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	sta_ctx->auth_key_mgmt = 0;
+	qdf_zero_macaddr(&sta_ctx->requested_bssid);
+	hdd_exit();
+}
+
 /**
  * hdd_roam_deregister_sta() - deregister station
  * @adapter: pointer to adapter
@@ -5447,3 +5513,64 @@ int hdd_set_csr_auth_type(struct hdd_adapter *adapter,
 
 	return 0;
 }
+
+#ifdef WLAN_FEATURE_FILS_SK
+static void hdd_initialize_fils_info(struct hdd_adapter *adapter)
+{
+	struct csr_roam_profile *roam_profile;
+
+	roam_profile = hdd_roam_profile(adapter);
+	roam_profile->fils_con_info = NULL;
+	roam_profile->hlp_ie = NULL;
+	roam_profile->hlp_ie_len = 0;
+}
+#else
+static void hdd_initialize_fils_info(struct hdd_adapter *adapter)
+{ }
+#endif
+
+void hdd_roam_profile_init(struct hdd_adapter *adapter)
+{
+	struct csr_roam_profile *roam_profile;
+	uint8_t *security_ie;
+	tSirAddie *assoc_additional_ie;
+	struct hdd_station_ctx *sta_ctx;
+
+	hdd_enter();
+
+	roam_profile = hdd_roam_profile(adapter);
+	qdf_mem_zero(roam_profile, sizeof(*roam_profile));
+
+	security_ie = hdd_security_ie(adapter);
+	qdf_mem_zero(security_ie, MAX_WPA_RSN_IE_LEN);
+
+	assoc_additional_ie = hdd_assoc_additional_ie(adapter);
+	qdf_mem_zero(assoc_additional_ie, sizeof(*assoc_additional_ie));
+
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+
+	/* Configure the roaming profile links to SSID and bssid. */
+	roam_profile->SSIDs.numOfSSIDs = 0;
+	roam_profile->SSIDs.SSIDList = &sta_ctx->conn_info.SSID;
+
+	roam_profile->BSSIDs.numOfBSSIDs = 0;
+	roam_profile->BSSIDs.bssid = &sta_ctx->conn_info.bssId;
+
+	/* Set the numOfChannels to zero to scan all the channels */
+	roam_profile->ChannelInfo.numOfChannels = 0;
+	roam_profile->ChannelInfo.ChannelList = NULL;
+
+	roam_profile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
+
+	roam_profile->phyMode = eCSR_DOT11_MODE_AUTO;
+	sta_ctx->wpa_versions = 0;
+
+	/* Set the default scan mode */
+	adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
+
+	hdd_clear_roam_profile_ie(adapter);
+
+	hdd_initialize_fils_info(adapter);
+
+	hdd_exit();
+}

+ 3 - 7
core/hdd/src/wlan_hdd_main.c

@@ -4029,12 +4029,9 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 	sme_set_pdev_ht_vht_ies(hdd_ctx->hHal, hdd_ctx->config->enable2x2);
 	sme_set_vdev_ies_per_band(hdd_ctx->hHal, adapter->session_id);
 
-	/* Register wireless extensions */
-	status = hdd_register_wext(adapter->dev);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		hdd_err("failed to register wireless extensions: %d", status);
-		goto error_register_wext;
-	}
+	hdd_roam_profile_init(adapter);
+	hdd_register_wext(adapter->dev);
+
 	hdd_conn_set_connection_state(adapter, eConnectionState_NotConnected);
 
 	qdf_mem_set(sta_ctx->conn_info.staId,
@@ -4093,7 +4090,6 @@ error_wmm_init:
 	hdd_deinit_tx_rx(adapter);
 error_init_txrx:
 	hdd_unregister_wext(adapter->dev);
-error_register_wext:
 	QDF_BUG(!hdd_vdev_destroy(adapter));
 
 	return status;

+ 2 - 9
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -410,14 +410,8 @@ int hdd_init_nan_data_mode(struct hdd_adapter *adapter)
 	sme_set_pdev_ht_vht_ies(hdd_ctx->hHal, hdd_ctx->config->enable2x2);
 	sme_set_vdev_ies_per_band(hdd_ctx->hHal, adapter->session_id);
 
-	/* Register wireless extensions */
-	ret_val = hdd_register_wext(wlan_dev);
-	if (0 > ret_val) {
-		hdd_err("Wext registration failed with status code %d",
-			ret_val);
-		ret_val = -EAGAIN;
-		goto error_register_wext;
-	}
+	hdd_roam_profile_init(adapter);
+	hdd_register_wext(wlan_dev);
 
 	status = hdd_init_tx_rx(adapter);
 	if (QDF_STATUS_SUCCESS != status) {
@@ -455,7 +449,6 @@ error_wmm_init:
 error_init_txrx:
 	hdd_unregister_wext(wlan_dev);
 
-error_register_wext:
 	QDF_BUG(!hdd_vdev_destroy(adapter));
 
 	return ret_val;

+ 8 - 177
core/hdd/src/wlan_hdd_wext.c

@@ -4070,72 +4070,6 @@ int wlan_hdd_get_peer_info(struct hdd_adapter *adapter,
 	return ret;
 }
 
-/**
- * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs
- * @adapter: adapter who's IEs are to be cleared
- *
- * Return: None
- */
-void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter)
-{
-	struct hdd_station_ctx *sta_ctx;
-	struct csr_roam_profile *roam_profile;
-
-	hdd_enter();
-
-	/* clear WPA/RSN/WSC IE information in the profile */
-	roam_profile = hdd_roam_profile(adapter);
-
-	roam_profile->nWPAReqIELength = 0;
-	roam_profile->pWPAReqIE = NULL;
-	roam_profile->nRSNReqIELength = 0;
-	roam_profile->pRSNReqIE = NULL;
-
-#ifdef FEATURE_WLAN_WAPI
-	roam_profile->nWAPIReqIELength = 0;
-	roam_profile->pWAPIReqIE = NULL;
-#endif
-
-	roam_profile->bWPSAssociation = false;
-	roam_profile->bOSENAssociation = false;
-	roam_profile->pAddIEScan = NULL;
-	roam_profile->nAddIEScanLength = 0;
-	roam_profile->pAddIEAssoc = NULL;
-	roam_profile->nAddIEAssocLength = 0;
-
-	roam_profile->EncryptionType.numEntries = 1;
-	roam_profile->EncryptionType.encryptionType[0] =
-		eCSR_ENCRYPT_TYPE_NONE;
-
-	roam_profile->mcEncryptionType.numEntries = 1;
-	roam_profile->mcEncryptionType.encryptionType[0] =
-		eCSR_ENCRYPT_TYPE_NONE;
-
-	roam_profile->AuthType.numEntries = 1;
-	roam_profile->AuthType.authType[0] =
-		eCSR_AUTH_TYPE_OPEN_SYSTEM;
-
-	qdf_mem_zero(roam_profile->bssid_hint.bytes, QDF_MAC_ADDR_SIZE);
-
-#ifdef WLAN_FEATURE_11W
-	roam_profile->MFPEnabled = false;
-	roam_profile->MFPRequired = 0;
-	roam_profile->MFPCapable = 0;
-#endif
-
-	qdf_mem_zero(roam_profile->Keys.KeyLength, CSR_MAX_NUM_KEY);
-
-#ifdef FEATURE_WLAN_WAPI
-	adapter->wapi_info.wapi_auth_mode = WAPI_AUTH_MODE_OPEN;
-	adapter->wapi_info.wapi_mode = false;
-#endif
-
-	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-	sta_ctx->auth_key_mgmt = 0;
-	qdf_zero_macaddr(&sta_ctx->requested_bssid);
-	hdd_exit();
-}
-
 /**
  * hdd_get_ldpc() - Get adapter LDPC
  * @adapter: adapter being queried
@@ -11709,125 +11643,22 @@ const struct iw_handler_def we_handler_def = {
 	.get_wireless_stats = NULL,
 };
 
-/* hdd_set_wext() - configures bss parameters
- * @adapter: handle to adapter context
- *
- * Returns: none
- */
-static int hdd_set_wext(struct hdd_adapter *adapter)
+void hdd_register_wext(struct net_device *dev)
 {
-	struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-	struct csr_roam_profile *roam_profile;
-
-	hdd_enter();
-
-	roam_profile = hdd_roam_profile(adapter);
-
-	/* Now configure the roaming profile links. To SSID and bssid. */
-	roam_profile->SSIDs.numOfSSIDs = 0;
-	roam_profile->SSIDs.SSIDList = &sta_ctx->conn_info.SSID;
-
-	roam_profile->BSSIDs.numOfBSSIDs = 0;
-	roam_profile->BSSIDs.bssid = &sta_ctx->conn_info.bssId;
-
-	/*Set the numOfChannels to zero to scan all the channels */
-	roam_profile->ChannelInfo.numOfChannels = 0;
-	roam_profile->ChannelInfo.ChannelList = NULL;
-
-	/* Default is no encryption */
-	roam_profile->EncryptionType.numEntries = 1;
-	roam_profile->EncryptionType.encryptionType[0] =
-		eCSR_ENCRYPT_TYPE_NONE;
-
-	roam_profile->mcEncryptionType.numEntries = 1;
-	roam_profile->mcEncryptionType.encryptionType[0] =
-		eCSR_ENCRYPT_TYPE_NONE;
-
-	roam_profile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
-
-	/* Default is no authentication */
-	roam_profile->AuthType.numEntries = 1;
-	roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
-
-	roam_profile->phyMode = eCSR_DOT11_MODE_AUTO;
-	sta_ctx->wpa_versions = 0;
-
-	/*Set the default scan mode */
-	adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
-
-	hdd_clear_roam_profile_ie(adapter);
-
-	hdd_exit();
-	return QDF_STATUS_SUCCESS;
-
-}
-
-#ifdef WLAN_FEATURE_FILS_SK
-static void hdd_initialize_fils_info(struct hdd_adapter *adapter)
-{
-	struct csr_roam_profile *roam_profile;
-
-	roam_profile = hdd_roam_profile(adapter);
-	roam_profile->fils_con_info = NULL;
-	roam_profile->hlp_ie = NULL;
-	roam_profile->hlp_ie_len = 0;
-}
-#else
-static void hdd_initialize_fils_info(struct hdd_adapter *adapter)
-{ }
-#endif
-
-/**
- * hdd_register_wext() - register wext context
- * @dev: net device handle
- *
- * Registers wext interface context for a given net device
- *
- * Returns: 0 on success, errno on failure
- */
-int hdd_register_wext(struct net_device *dev)
-{
-	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	struct csr_roam_profile *roam_profile;
-	uint8_t *security_ie;
-	tSirAddie *assoc_additional_ie;
-	QDF_STATUS status;
-
-	hdd_enter();
-
-	roam_profile = hdd_roam_profile(adapter);
-	qdf_mem_zero(roam_profile, sizeof(*roam_profile));
-
-	security_ie = hdd_security_ie(adapter);
-	qdf_mem_zero(security_ie, MAX_WPA_RSN_IE_LEN);
-
-	assoc_additional_ie = hdd_assoc_additional_ie(adapter);
-	qdf_mem_zero(assoc_additional_ie, sizeof(*assoc_additional_ie));
-
-	status = hdd_set_wext(adapter);
-
-	if (!QDF_IS_STATUS_SUCCESS(status)) {
-		hdd_err("ERROR: hdd_set_wext failed!!");
-		return QDF_STATUS_E_FAILURE;
-	}
+	hdd_enter_dev(dev);
 
-	hdd_initialize_fils_info(adapter);
-	/* Register as a wireless device */
 	dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def;
 
 	hdd_exit();
-	return 0;
 }
 
-int hdd_unregister_wext(struct net_device *dev)
+void hdd_unregister_wext(struct net_device *dev)
 {
-	hdd_debug("dev(%pK)", dev);
+	hdd_enter_dev(dev);
 
-	if (dev != NULL) {
-		rtnl_lock();
-		dev->wireless_handlers = NULL;
-		rtnl_unlock();
-	}
+	rtnl_lock();
+	dev->wireless_handlers = NULL;
+	rtnl_unlock();
 
-	return 0;
+	hdd_exit();
 }