Browse Source

qcacld-3.0: Refactor vdev create API

Modify the hdd_vdev_create() API to accept link info pointer
as function argument to create VDEV for that particular link info.
The VDEV info is saved in that link info post successful VDEV
create.

Change-Id: I1fd25e93094c34d2ecf8479cbf1f2ebf1566160b
CRs-Fixed: 3523922
Vinod Kumar Pirla 2 years ago
parent
commit
b7b5d8c821
3 changed files with 18 additions and 18 deletions
  1. 2 2
      core/hdd/inc/wlan_hdd_main.h
  2. 15 15
      core/hdd/src/wlan_hdd_main.c
  3. 1 1
      core/hdd/src/wlan_hdd_nan_datapath.c

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

@@ -2853,14 +2853,14 @@ void hdd_cancel_ip_notifier_work(struct hdd_adapter *adapter)
 
 /**
  * hdd_vdev_create() - Create the vdev in the firmware
- * @adapter: hdd adapter
+ * @link_info: Link info pointer in HDD adapter
  *
  * This function will create the vdev in the firmware
  *
  * Return: 0 when the vdev create is sent to firmware or -EINVAL when
  * there is a failure to send the command.
  */
-int hdd_vdev_create(struct hdd_adapter *adapter);
+int hdd_vdev_create(struct wlan_hdd_link_info *link_info);
 
 /**
  * hdd_vdev_destroy() - Destroy the vdev in the firmware

+ 15 - 15
core/hdd/src/wlan_hdd_main.c

@@ -7022,21 +7022,21 @@ hdd_vdev_configure_rtt_params(struct wlan_objmgr_vdev *vdev)
 	return status;
 }
 
-static void hdd_store_vdev_info(struct hdd_adapter *adapter,
+static void hdd_store_vdev_info(struct wlan_hdd_link_info *link_info,
 				struct wlan_objmgr_vdev *vdev)
 {
 	struct vdev_osif_priv *osif_priv;
 
 	osif_priv = wlan_vdev_get_ospriv(vdev);
 	if (osif_priv) {
-		osif_priv->wdev = adapter->dev->ieee80211_ptr;
-		osif_priv->legacy_osif_priv = adapter->deflink;
+		osif_priv->wdev = link_info->adapter->dev->ieee80211_ptr;
+		osif_priv->legacy_osif_priv = link_info;
 	}
 
-	qdf_spin_lock_bh(&adapter->deflink->vdev_lock);
-	adapter->deflink->vdev_id = wlan_vdev_get_id(vdev);
-	adapter->deflink->vdev = vdev;
-	qdf_spin_unlock_bh(&adapter->deflink->vdev_lock);
+	qdf_spin_lock_bh(&link_info->vdev_lock);
+	link_info->vdev_id = wlan_vdev_get_id(vdev);
+	link_info->vdev = vdev;
+	qdf_spin_unlock_bh(&link_info->vdev_lock);
 }
 
 static void
@@ -7211,10 +7211,11 @@ hdd_populate_vdev_create_params(struct hdd_adapter *adapter,
 }
 #endif
 
-int hdd_vdev_create(struct hdd_adapter *adapter)
+int hdd_vdev_create(struct wlan_hdd_link_info *link_info)
 {
 	QDF_STATUS status;
 	int errno = 0;
+	struct hdd_adapter *adapter = link_info->adapter;
 	struct hdd_context *hdd_ctx;
 	struct wlan_objmgr_vdev *vdev;
 	struct wlan_vdev_create_params vdev_params = {0};
@@ -7246,13 +7247,13 @@ int hdd_vdev_create(struct hdd_adapter *adapter)
 		return -EINVAL;
 	}
 
-	hdd_store_vdev_info(adapter, vdev);
+	hdd_store_vdev_info(link_info, vdev);
 	osif_cm_osif_priv_init(vdev);
 
 	if (hdd_adapter_is_ml_adapter(adapter))
 		hdd_mlo_t2lm_register_callback(vdev);
 
-	set_bit(SME_SESSION_OPENED, &adapter->deflink->link_flags);
+	set_bit(SME_SESSION_OPENED, &link_info->link_flags);
 	status = sme_vdev_post_vdev_create_setup(hdd_ctx->mac_handle, vdev);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("Failed to setup the vdev");
@@ -7270,13 +7271,12 @@ int hdd_vdev_create(struct hdd_adapter *adapter)
 
 	hdd_vdev_configure_opmode_params(hdd_ctx, vdev);
 
-	hdd_nofl_debug("vdev %d created successfully",
-		       adapter->deflink->vdev_id);
+	hdd_nofl_debug("vdev %d created successfully", link_info->vdev_id);
 
 	return errno;
 
 hdd_vdev_destroy_procedure:
-	QDF_BUG(!hdd_vdev_destroy(adapter->deflink));
+	QDF_BUG(!hdd_vdev_destroy(link_info));
 
 	return errno;
 }
@@ -13962,7 +13962,7 @@ int hdd_start_station_adapter(struct hdd_adapter *adapter)
 	    (adapter->device_mode == QDF_NAN_DISC_MODE))
 		wlan_hdd_lpc_del_monitor_interface(adapter->hdd_ctx);
 
-	ret = hdd_vdev_create(adapter);
+	ret = hdd_vdev_create(adapter->deflink);
 	if (ret) {
 		hdd_err("failed to create vdev: %d", ret);
 		return ret;
@@ -14037,7 +14037,7 @@ int hdd_start_ap_adapter(struct hdd_adapter *adapter)
 		return qdf_status_to_os_return(QDF_STATUS_E_FAILURE);
 	}
 
-	ret = hdd_vdev_create(adapter);
+	ret = hdd_vdev_create(adapter->deflink);
 	if (ret) {
 		hdd_err("failed to create vdev, status:%d", ret);
 		goto sap_destroy_ctx;

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

@@ -579,7 +579,7 @@ int hdd_init_nan_data_mode(struct hdd_adapter *adapter)
 	struct wlan_objmgr_vdev *vdev;
 	uint16_t rts_profile = 0;
 
-	ret_val = hdd_vdev_create(adapter);
+	ret_val = hdd_vdev_create(adapter->deflink);
 	if (ret_val) {
 		hdd_err("failed to create vdev: %d", ret_val);
 		return ret_val;