ソースを参照

qcacld-3.0: Refactor sta mode initialization

To initialize the station context in link info, pass
the link info pointer to station mode init. Callers
can call on per link to initialize each link individually.

Move netdev flags set and wext register and deregister
to caller of hdd_init_station_mode()

Change-Id: Idbe527d037fc91d3e03269c0577570fc6f30413d
CRs-Fixed: 3523895
Vinod Kumar Pirla 2 年 前
コミット
84e6553ede

+ 2 - 2
core/hdd/inc/wlan_hdd_assoc.h

@@ -439,14 +439,14 @@ void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap,
 
 /**
  * hdd_roam_profile_init() - initialize adapter roam profile
- * @adapter: The HDD adapter being initialized
+ * @link_info: Link info pointer in HDD adapter
  *
  * This function initializes the roam profile that is embedded within
  * the adapter.
  *
  * Return: void
  */
-void hdd_roam_profile_init(struct hdd_adapter *adapter);
+void hdd_roam_profile_init(struct wlan_hdd_link_info *link_info);
 
 /**
  * hdd_any_valid_peer_present() - Check if any valid peer is present

+ 17 - 6
core/hdd/inc/wlan_hdd_main.h

@@ -2887,7 +2887,19 @@ int hdd_vdev_destroy(struct wlan_hdd_link_info *link_info);
 int hdd_vdev_ready(struct wlan_objmgr_vdev *vdev,
 		   struct qdf_mac_addr *bridgeaddr);
 
-QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter);
+/**
+ * hdd_init_station_mode() - Initialize STA mode adapter
+ * post vdev creation.
+ * @link_info: Link info pointer in HDD adapter
+ *
+ * The function initializes the adapter post vdev
+ * create for STA mode type adapters on start
+ * adapter.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS hdd_init_station_mode(struct wlan_hdd_link_info *link_info);
+
 struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx,
 			enum QDF_OPMODE mode);
 
@@ -4040,7 +4052,7 @@ hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
 
 /**
  * hdd_roam_profile() - Get adapter's roam profile
- * @adapter: The adapter being queried
+ * @link_info: Link info pointer in HDD adapter
  *
  * Given an adapter this function returns a pointer to its roam profile.
  *
@@ -4049,13 +4061,12 @@ hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
  *
  * Return: pointer to the adapter's roam profile
  */
-static inline
-struct csr_roam_profile *hdd_roam_profile(struct hdd_adapter *adapter)
+static inline struct csr_roam_profile *
+hdd_roam_profile(struct wlan_hdd_link_info *link_info)
 {
 	struct hdd_station_ctx *sta_ctx;
 
-	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
-
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(link_info);
 	return &sta_ctx->roam_profile;
 }
 

+ 5 - 5
core/hdd/src/wlan_hdd_assoc.c

@@ -2700,17 +2700,17 @@ bool hdd_is_fils_connection(struct hdd_context *hdd_ctx,
 }
 #endif
 
-void hdd_roam_profile_init(struct hdd_adapter *adapter)
+void hdd_roam_profile_init(struct wlan_hdd_link_info *link_info)
 {
 	struct csr_roam_profile *roam_profile;
 	struct hdd_station_ctx *sta_ctx;
 
 	hdd_enter();
 
-	roam_profile = hdd_roam_profile(adapter);
+	roam_profile = hdd_roam_profile(link_info);
 	qdf_mem_zero(roam_profile, sizeof(*roam_profile));
 
-	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(link_info);
 
 	/* Configure the roaming profile links to SSID and bssid. */
 	roam_profile->SSIDs.numOfSSIDs = 0;
@@ -2728,9 +2728,9 @@ void hdd_roam_profile_init(struct hdd_adapter *adapter)
 	roam_profile->phyMode = eCSR_DOT11_MODE_AUTO;
 
 	/* Set the default scan mode */
-	adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
+	link_info->adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
 
-	hdd_clear_roam_profile_ie(adapter);
+	hdd_clear_roam_profile_ie(link_info->adapter);
 	hdd_exit();
 }
 

+ 22 - 18
core/hdd/src/wlan_hdd_main.c

@@ -7039,16 +7039,17 @@ static void hdd_store_vdev_info(struct hdd_adapter *adapter,
 	qdf_spin_unlock_bh(&adapter->deflink->vdev_lock);
 }
 
-static void hdd_init_station_context(struct hdd_adapter *adapter)
+static void
+hdd_init_station_context(struct wlan_hdd_link_info *link_info)
 {
 	struct hdd_station_ctx *sta_ctx;
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(link_info->adapter);
 
 	/* Set the default operation channel freq and auth type to open */
-	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(link_info);
 	sta_ctx->conn_info.chan_freq = hdd_ctx->config->operating_chan_freq;
 	sta_ctx->conn_info.auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM;
-	hdd_roam_profile_init(adapter);
+	hdd_roam_profile_init(link_info);
 }
 
 static void hdd_vdev_set_ht_vht_ies(mac_handle_t mac_handle,
@@ -7280,8 +7281,9 @@ hdd_vdev_destroy_procedure:
 	return errno;
 }
 
-QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
+QDF_STATUS hdd_init_station_mode(struct wlan_hdd_link_info *link_info)
 {
+	struct hdd_adapter *adapter = link_info->adapter;
 	struct hdd_context *hdd_ctx;
 	QDF_STATUS status;
 	mac_handle_t mac_handle;
@@ -7291,16 +7293,14 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	mac_handle = hdd_ctx->mac_handle;
 
-	vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink,
-					   WLAN_INIT_DEINIT_ID);
+	vdev = hdd_objmgr_get_vdev_by_user(link_info, WLAN_INIT_DEINIT_ID);
 	if (!vdev) {
 		status = QDF_STATUS_E_NULL_VALUE;
-		goto wext_unregister;
+		goto vdev_destroy;
 	}
 
 	hdd_vdev_set_ht_vht_ies(mac_handle, vdev);
-	hdd_init_station_context(adapter);
-	hdd_register_wext(adapter->dev);
+	hdd_init_station_context(link_info);
 
 	status = hdd_wmm_adapter_init(adapter);
 	if (QDF_STATUS_SUCCESS != status) {
@@ -7310,15 +7310,13 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 	}
 	set_bit(WMM_INIT_DONE, &adapter->event_flags);
 
-	hdd_set_netdev_flags(adapter);
-
 	/* rcpi info initialization */
 	qdf_mem_zero(&adapter->rcpi, sizeof(adapter->rcpi));
 
 	if (adapter->device_mode == QDF_STA_MODE) {
 		roam_triggers = ucfg_mlme_get_roaming_triggers(hdd_ctx->psoc);
 		mlme_set_roam_trigger_bitmap(hdd_ctx->psoc,
-					     adapter->deflink->vdev_id,
+					     link_info->vdev_id,
 					     roam_triggers);
 
 		status = hdd_vdev_configure_rtt_params(vdev);
@@ -7332,9 +7330,8 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 error_wmm_init:
 	hdd_objmgr_put_vdev_by_user(vdev, WLAN_INIT_DEINIT_ID);
 
-wext_unregister:
-	hdd_unregister_wext(adapter->dev);
-	QDF_BUG(!hdd_vdev_destroy(adapter->deflink));
+vdev_destroy:
+	QDF_BUG(!hdd_vdev_destroy(link_info));
 
 	return status;
 }
@@ -13970,13 +13967,16 @@ int hdd_start_station_adapter(struct hdd_adapter *adapter)
 		hdd_err("failed to create vdev: %d", ret);
 		return ret;
 	}
-	status = hdd_init_station_mode(adapter);
+	status = hdd_init_station_mode(adapter->deflink);
 
 	if (QDF_STATUS_SUCCESS != status) {
 		hdd_err("Error Initializing station mode: %d", status);
-		return qdf_status_to_os_return(status);
+		goto fail;
 	}
 
+	hdd_register_wext(adapter->dev);
+	hdd_set_netdev_flags(adapter);
+
 	hdd_register_tx_flow_control(adapter,
 		hdd_tx_resume_timer_expired_handler,
 		hdd_tx_resume_cb,
@@ -13993,6 +13993,10 @@ int hdd_start_station_adapter(struct hdd_adapter *adapter)
 	hdd_exit();
 
 	return 0;
+
+fail:
+	hdd_unregister_wext(adapter->dev);
+	return qdf_status_to_os_return(status);
 }
 
 /**

+ 1 - 1
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -596,7 +596,7 @@ int hdd_init_nan_data_mode(struct hdd_adapter *adapter)
 	sme_set_vdev_ies_per_band(mac_handle, adapter->deflink->vdev_id,
 				  adapter->device_mode);
 
-	hdd_roam_profile_init(adapter);
+	hdd_roam_profile_init(adapter->deflink);
 	hdd_register_wext(wlan_dev);
 
 	vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink, WLAN_DP_ID);