瀏覽代碼

qcacld-3.0: Refactor NSS and antenna mode config APIs

Change the following APIs to take link info pointer as
function argument to support per link configuration.
Existing callers moved to deflink.

1) hdd_update_nss()
2) hdd_set_dynamic_antenna_mode()
3) hdd_set_antenna_mode()

Change-Id: Ic1f29cf3b8aa08d9c58b2e5bb65370114f8bfa41
CRs-Fixed: 3521567
Vinod Kumar Pirla 2 年之前
父節點
當前提交
bd1f07ea32

+ 3 - 4
core/hdd/inc/wlan_hdd_cfg.h

@@ -255,8 +255,7 @@ void hdd_cfg_print_global_config(struct hdd_context *hdd_ctx);
 
 /**
  * hdd_update_nss() - Update the number of spatial streams supported.
- *
- * @adapter: the pointer to adapter
+ * @link_info: Link info pointer in HDD adapter
  * @tx_nss: the number of Tx spatial streams to be updated
  * @rx_nss: the number of Rx spatial streams to be updated
  *
@@ -266,8 +265,8 @@ void hdd_cfg_print_global_config(struct hdd_context *hdd_ctx);
  * Return: QDF_STATUS_SUCCESS if nss is correctly updated,
  *              otherwise QDF_STATUS_E_FAILURE would be returned
  */
-QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t tx_nss,
-			  uint8_t rx_nss);
+QDF_STATUS hdd_update_nss(struct wlan_hdd_link_info *link_info,
+			  uint8_t tx_nss, uint8_t rx_nss);
 
 /**
  * hdd_get_nss() - Get the number of spatial streams supported by the adapter

+ 8 - 9
core/hdd/src/wlan_hdd_cfg.c

@@ -1189,9 +1189,10 @@ static void hdd_set_sap_nss_params(struct hdd_context *hdd_ctx,
 	hdd_restart_sap(adapter);
 }
 
-QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t tx_nss,
-			  uint8_t rx_nss)
+QDF_STATUS hdd_update_nss(struct wlan_hdd_link_info *link_info,
+			  uint8_t tx_nss, uint8_t rx_nss)
 {
+	struct hdd_adapter *adapter = link_info->adapter;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	uint32_t rx_supp_data_rate, tx_supp_data_rate;
 	bool status = true;
@@ -1202,8 +1203,7 @@ QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t tx_nss,
 	uint8_t mcs_set_temp[SIZE_OF_SUPPORTED_MCS_SET];
 	uint8_t enable2x2;
 	mac_handle_t mac_handle;
-	bool bval = 0;
-	bool restart_sap = 0;
+	bool bval = 0, restart_sap = 0;
 
 	if ((tx_nss == 2 || rx_nss == 2) && (hdd_ctx->num_rf_chains != 2)) {
 		hdd_err("No support for 2 spatial streams");
@@ -1251,7 +1251,7 @@ QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t tx_nss,
 			return QDF_STATUS_E_FAILURE;
 		}
 
-		if (hdd_is_vdev_in_conn_state(adapter->deflink))
+		if (hdd_is_vdev_in_conn_state(link_info))
 			return hdd_set_nss_params(adapter, tx_nss, rx_nss);
 
 		if (tx_nss != rx_nss) {
@@ -1261,15 +1261,14 @@ QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t tx_nss,
 		}
 
 		hdd_debug("Vdev %d in disconnect state, changing ini nss params",
-			  adapter->deflink->vdev_id);
-
+			  link_info->vdev_id);
 		if (!bval) {
 			hdd_err("Nss in 1x1, no change required, 2x2 mode disabled");
 			return QDF_STATUS_SUCCESS;
 		}
 
 		hdd_update_nss_in_vdev(adapter, mac_handle, tx_nss, rx_nss);
-		sme_set_nss_capability(mac_handle, adapter->deflink->vdev_id,
+		sme_set_nss_capability(mac_handle, link_info->vdev_id,
 				       rx_nss, adapter->device_mode);
 
 		return QDF_STATUS_SUCCESS;
@@ -1379,7 +1378,7 @@ skip_ht_cap_update:
 		status = false;
 		hdd_err("Could not get MCS SET from CFG");
 	}
-	sme_set_nss_capability(mac_handle, adapter->deflink->vdev_id,
+	sme_set_nss_capability(mac_handle, link_info->vdev_id,
 			       rx_nss, adapter->device_mode);
 #undef WLAN_HDD_RX_MCS_ALL_NSTREAM_RATES
 

+ 12 - 14
core/hdd/src/wlan_hdd_cfg80211.c

@@ -8984,15 +8984,14 @@ hdd_populate_vdev_chains(struct wlan_mlme_nss_chains *nss_chains_cfg,
 }
 
 int
-hdd_set_dynamic_antenna_mode(struct hdd_adapter *adapter,
-			     uint8_t num_rx_chains,
-			     uint8_t num_tx_chains)
+hdd_set_dynamic_antenna_mode(struct wlan_hdd_link_info *link_info,
+			     uint8_t num_rx_chains, uint8_t num_tx_chains)
 {
 	enum nss_chains_band_info band;
 	struct wlan_mlme_nss_chains user_cfg;
 	QDF_STATUS status;
 	mac_handle_t mac_handle;
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(link_info->adapter);
 	struct wlan_objmgr_vdev *vdev;
 	int ret;
 
@@ -9006,13 +9005,13 @@ hdd_set_dynamic_antenna_mode(struct hdd_adapter *adapter,
 		return -EINVAL;
 	}
 
-	if (!hdd_is_vdev_in_conn_state(adapter->deflink)) {
+	if (!hdd_is_vdev_in_conn_state(link_info)) {
 		hdd_debug("Vdev (id %d) not in connected/started state, cannot accept command",
-			  adapter->deflink->vdev_id);
+			  link_info->vdev_id);
 		return -EINVAL;
 	}
 
-	vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink, WLAN_OSIF_ID);
+	vdev = hdd_objmgr_get_vdev_by_user(link_info, WLAN_OSIF_ID);
 	if (!vdev) {
 		hdd_err("vdev is NULL");
 		return -EINVAL;
@@ -9032,7 +9031,7 @@ hdd_set_dynamic_antenna_mode(struct hdd_adapter *adapter,
 
 	status = sme_nss_chains_update(mac_handle,
 				       &user_cfg,
-				       adapter->deflink->vdev_id);
+				       link_info->vdev_id);
 	if (QDF_IS_STATUS_ERROR(status))
 		return -EINVAL;
 
@@ -9064,8 +9063,8 @@ static int hdd_config_vdev_chains(struct wlan_hdd_link_info *link_info,
 	rx_chains = nla_get_u8(rx_attr);
 
 	if (hdd_ctx->dynamic_nss_chains_support)
-		return hdd_set_dynamic_antenna_mode(adapter, rx_chains,
-						    tx_chains);
+		return hdd_set_dynamic_antenna_mode(link_info,
+						    rx_chains, tx_chains);
 	return 0;
 }
 
@@ -9100,7 +9099,7 @@ static int hdd_config_tx_rx_nss(struct wlan_hdd_link_info *link_info,
 			rx_nss);
 		return -EINVAL;
 	}
-	status = hdd_update_nss(link_info->adapter, tx_nss, rx_nss);
+	status = hdd_update_nss(link_info, tx_nss, rx_nss);
 	if (status != QDF_STATUS_SUCCESS) {
 		hdd_debug("Can't set tx_nss %d rx_nss %d", tx_nss, rx_nss);
 		return -EINVAL;
@@ -10594,13 +10593,12 @@ static int hdd_set_nss(struct wlan_hdd_link_info *link_info,
 	uint8_t nss;
 	int ret;
 	QDF_STATUS status;
-	struct hdd_adapter *adapter = link_info->adapter;
 
 	nss = nla_get_u8(attr);
-	status = hdd_update_nss(adapter, nss, nss);
+	status = hdd_update_nss(link_info, nss, nss);
 	ret = qdf_status_to_os_return(status);
 
-	if (ret == 0 && adapter->device_mode == QDF_SAP_MODE)
+	if (ret == 0 && link_info->adapter->device_mode == QDF_SAP_MODE)
 		ret = wma_cli_set_command(link_info->vdev_id,
 					  wmi_vdev_param_nss, nss, VDEV_CMD);
 

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

@@ -790,7 +790,7 @@ QDF_STATUS wlan_hdd_send_sta_authorized_event(
 
 /**
  * hdd_set_dynamic_antenna_mode() - set dynamic antenna mode
- * @adapter: Pointer to network adapter
+ * @link_info: Link info pointer in HDD adapter
  * @num_rx_chains: number of chains to be used for receiving data
  * @num_tx_chains: number of chains to be used for transmitting data
  *
@@ -798,9 +798,8 @@ QDF_STATUS wlan_hdd_send_sta_authorized_event(
  *
  * Return: 0 for success
  */
-int hdd_set_dynamic_antenna_mode(struct hdd_adapter *adapter,
-				 uint8_t num_rx_chains,
-				 uint8_t num_tx_chains);
+int hdd_set_dynamic_antenna_mode(struct wlan_hdd_link_info *link_info,
+				 uint8_t num_rx_chains, uint8_t num_tx_chains);
 
 #ifdef MULTI_CLIENT_LL_SUPPORT
 /**

+ 3 - 3
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -913,7 +913,7 @@ static __iw_softap_setparam(struct net_device *dev,
 		ret = wma_cli_set_command(link_info->vdev_id,
 					  wmi_pdev_param_tx_chain_mask,
 					  set_value, PDEV_CMD);
-		ret = hdd_set_antenna_mode(adapter, hdd_ctx, set_value);
+		ret = hdd_set_antenna_mode(link_info, set_value);
 		break;
 	}
 
@@ -923,14 +923,14 @@ static __iw_softap_setparam(struct net_device *dev,
 		ret = wma_cli_set_command(link_info->vdev_id,
 					  wmi_pdev_param_rx_chain_mask,
 					  set_value, PDEV_CMD);
-		ret = hdd_set_antenna_mode(adapter, hdd_ctx, set_value);
+		ret = hdd_set_antenna_mode(link_info, set_value);
 		break;
 	}
 
 	case QCASAP_NSS_CMD:
 	{
 		hdd_debug("QCASAP_NSS_CMD val %d", set_value);
-		hdd_update_nss(adapter, set_value, set_value);
+		hdd_update_nss(link_info, set_value, set_value);
 		ret = wma_cli_set_command(link_info->vdev_id,
 					  wmi_vdev_param_nss,
 					  set_value, VDEV_CMD);

+ 6 - 5
core/hdd/src/wlan_hdd_ioctl.c

@@ -5856,9 +5856,10 @@ wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status,
 	osif_request_put(request);
 }
 
-int hdd_set_antenna_mode(struct hdd_adapter *adapter,
-				  struct hdd_context *hdd_ctx, int mode)
+int hdd_set_antenna_mode(struct wlan_hdd_link_info *link_info, int mode)
 {
+	struct hdd_adapter *adapter =  link_info->adapter;
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct sir_antenna_mode_param params;
 	QDF_STATUS status;
 	int ret = 0;
@@ -5884,7 +5885,7 @@ int hdd_set_antenna_mode(struct hdd_adapter *adapter,
 	}
 
 	if (hdd_ctx->dynamic_nss_chains_support)
-		return hdd_set_dynamic_antenna_mode(adapter,
+		return hdd_set_dynamic_antenna_mode(link_info,
 						    params.num_rx_chains,
 						    params.num_tx_chains);
 
@@ -5904,7 +5905,7 @@ int hdd_set_antenna_mode(struct hdd_adapter *adapter,
 	/* Check TDLS status and update antenna mode */
 	if ((QDF_STA_MODE == adapter->device_mode) &&
 	    policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) {
-		ret = wlan_hdd_tdls_antenna_switch(adapter->deflink, mode);
+		ret = wlan_hdd_tdls_antenna_switch(link_info, mode);
 		if (0 != ret)
 			goto exit;
 	}
@@ -5975,7 +5976,7 @@ static int drv_cmd_set_antenna_mode(struct wlan_hdd_link_info *link_info,
 
 	hdd_debug("Processing antenna mode switch to: %d", mode);
 
-	return hdd_set_antenna_mode(link_info->adapter, hdd_ctx, mode);
+	return hdd_set_antenna_mode(link_info, mode);
 }
 
 /**

+ 2 - 4
core/hdd/src/wlan_hdd_ioctl.h

@@ -78,12 +78,10 @@ QDF_STATUS hdd_update_smps_antenna_mode(struct hdd_context *hdd_ctx, int mode);
 
 /**
  * hdd_set_antenna_mode() - SET ANTENNA MODE command handler
- * @adapter: Pointer to network adapter
- * @hdd_ctx: Pointer to hdd context
+ * @link_info: Link info pointer in HDD adapter
  * @mode: new antenna mode
  */
-int hdd_set_antenna_mode(struct hdd_adapter *adapter,
-			  struct hdd_context *hdd_ctx, int mode);
+int hdd_set_antenna_mode(struct wlan_hdd_link_info *link_info, int mode);
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 /**

+ 5 - 7
core/hdd/src/wlan_hdd_wext.c

@@ -3692,7 +3692,7 @@ static int hdd_we_set_nss(struct wlan_hdd_link_info *link_info, int nss)
 		return -EINVAL;
 	}
 
-	status = hdd_update_nss(link_info->adapter, nss, nss);
+	status = hdd_update_nss(link_info, nss, nss);
 	if (QDF_IS_STATUS_ERROR(status))
 		hdd_err("cfg set failed, value %d status %d", nss, status);
 
@@ -4237,30 +4237,28 @@ static int hdd_we_set_tx_chainmask(struct wlan_hdd_link_info *link_info,
 				   int value)
 {
 	int errno;
-	struct hdd_adapter *adapter = link_info->adapter;
 
-	errno = hdd_we_set_pdev(adapter,
+	errno = hdd_we_set_pdev(link_info->adapter,
 				wmi_pdev_param_tx_chain_mask,
 				value);
 	if (errno)
 		return errno;
 
-	return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
+	return hdd_set_antenna_mode(link_info, value);
 }
 
 static int hdd_we_set_rx_chainmask(struct wlan_hdd_link_info *link_info,
 				   int value)
 {
 	int errno;
-	struct hdd_adapter *adapter = link_info->adapter;
 
-	errno = hdd_we_set_pdev(adapter,
+	errno = hdd_we_set_pdev(link_info->adapter,
 				wmi_pdev_param_rx_chain_mask,
 				value);
 	if (errno)
 		return errno;
 
-	return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
+	return hdd_set_antenna_mode(link_info, value);
 }
 
 static int hdd_we_set_txpow_2g(struct wlan_hdd_link_info *link_info,