Forráskód Böngészése

qcacld-3.0: Update user_configured_nss while initializing driver

While initializing the driver, user_configured_nss is not
updated. Thus, user_configured_nss was getting value as 0.
If nss=1 is configured for TDLS, then updating the vht mcs
rates, nss was getting value 0, which is invalid. Thus,
the rates were not getting updated properly.

The fix is to update user_configured_nss while initializing
the driver.

Change-Id: I41a4e9aaa82a45f9612c05869c7212820019e0bb
CRs-Fixed: 2031151
Nitesh Shah 8 éve
szülő
commit
e50711f2bb

+ 44 - 30
core/hdd/src/wlan_hdd_ioctl.c

@@ -6332,6 +6332,49 @@ static bool hdd_is_supported_chain_mask_1x1(hdd_context_t *hdd_ctx)
 	return (!hdd_ctx->config->enable2x2) ? true : false;
 }
 
+QDF_STATUS hdd_update_smps_antenna_mode(hdd_context_t *hdd_ctx, int mode)
+{
+	QDF_STATUS status;
+	uint8_t smps_mode;
+	uint8_t smps_enable;
+
+	/* Update SME SMPS config */
+	if (HDD_ANTENNA_MODE_1X1 == mode) {
+		smps_enable = true;
+		smps_mode = HDD_SMPS_MODE_STATIC;
+	} else {
+		smps_enable = false;
+		smps_mode = HDD_SMPS_MODE_DISABLED;
+	}
+
+	hdd_debug("Update SME SMPS enable: %d mode: %d",
+		 smps_enable, smps_mode);
+	status = sme_update_mimo_power_save(
+		hdd_ctx->hHal, smps_enable, smps_mode, false);
+	if (QDF_STATUS_SUCCESS != status) {
+		hdd_err("Update SMPS config failed enable: %d mode: %d"
+			"status: %d",
+			smps_enable, smps_mode, status);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	hdd_ctx->current_antenna_mode = mode;
+	/*
+	 * Update the user requested nss in the mac context.
+	 * This will be used in tdls protocol engine to form tdls
+	 * Management frames.
+	 */
+	sme_update_user_configured_nss(
+		hdd_ctx->hHal,
+		hdd_ctx->current_antenna_mode);
+
+	hdd_debug("Successfully switched to mode: %d x %d",
+		 hdd_ctx->current_antenna_mode,
+		 hdd_ctx->current_antenna_mode);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * drv_cmd_set_antenna_mode() - SET ANTENNA MODE driver command
  * handler
@@ -6352,8 +6395,6 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
 	int ret = 0;
 	int mode;
 	uint8_t *value = command;
-	uint8_t smps_mode;
-	uint8_t smps_enable;
 
 	if (((1 << QDF_STA_MODE) != hdd_ctx->concurrency_mode) ||
 	    (hdd_ctx->no_of_active_sessions[QDF_STA_MODE] > 1)) {
@@ -6440,38 +6481,11 @@ static int drv_cmd_set_antenna_mode(hdd_adapter_t *adapter,
 		goto exit;
 	}
 
-	/* Update SME SMPS config */
-	if (HDD_ANTENNA_MODE_1X1 == mode) {
-		smps_enable = true;
-		smps_mode = HDD_SMPS_MODE_STATIC;
-	} else {
-		smps_enable = false;
-		smps_mode = HDD_SMPS_MODE_DISABLED;
-	}
-
-	hdd_debug("Update SME SMPS enable: %d mode: %d",
-		 smps_enable, smps_mode);
-	status = sme_update_mimo_power_save(
-		hdd_ctx->hHal, smps_enable, smps_mode, false);
+	status = hdd_update_smps_antenna_mode(hdd_ctx, mode);
 	if (QDF_STATUS_SUCCESS != status) {
-		hdd_err("Update SMPS config failed enable: %d mode: %d status: %d",
-			smps_enable, smps_mode, status);
 		ret = -EFAULT;
 		goto exit;
 	}
-
-	hdd_ctx->current_antenna_mode = mode;
-	/* Update the user requested nss in the mac context.
-	 * This will be used in tdls protocol engine to form tdls
-	 * Management frames.
-	 */
-	sme_update_user_configured_nss(
-		hdd_ctx->hHal,
-		hdd_ctx->current_antenna_mode);
-
-	hdd_debug("Successfully switched to mode: %d x %d",
-		 hdd_ctx->current_antenna_mode,
-		 hdd_ctx->current_antenna_mode);
 	ret = 0;
 exit:
 #ifdef FEATURE_WLAN_TDLS

+ 10 - 0
core/hdd/src/wlan_hdd_ioctl.h

@@ -37,5 +37,15 @@ extern struct sock *cesium_nl_srv_sock;
 int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 int wlan_hdd_set_mc_rate(hdd_adapter_t *pAdapter, int targetRate);
 
+/**
+ * hdd_update_smps_antenna_mode() - set smps and antenna mode
+ * @hdd_ctx: Pointer to hdd context
+ * @mode: antenna mode
+ *
+ * This function will set smps and antenna mode.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS hdd_update_smps_antenna_mode(hdd_context_t *hdd_ctx, int mode);
 #endif /* end #if !defined(WLAN_HDD_IOCTL_H) */
 

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

@@ -1391,6 +1391,7 @@ void hdd_update_tgt_cfg(void *context, void *param)
 	struct wma_tgt_cfg *cfg = param;
 	uint8_t temp_band_cap;
 	struct cds_config_info *cds_cfg = cds_get_ini_config();
+	uint8_t antenna_mode;
 
 	/* Reuse same pdev for module stop and start */
 	if ((hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) ||
@@ -1493,9 +1494,9 @@ void hdd_update_tgt_cfg(void *context, void *param)
 	hdd_debug("fine_time_meas_cap: 0x%x",
 		hdd_ctx->config->fine_time_meas_cap);
 
-	hdd_ctx->current_antenna_mode =
-		(hdd_ctx->config->enable2x2 == 0x01) ?
-		HDD_ANTENNA_MODE_2X2 : HDD_ANTENNA_MODE_1X1;
+	antenna_mode = (hdd_ctx->config->enable2x2 == 0x01) ?
+			HDD_ANTENNA_MODE_2X2 : HDD_ANTENNA_MODE_1X1;
+	hdd_update_smps_antenna_mode(hdd_ctx, antenna_mode);
 	hdd_debug("Init current antenna mode: %d",
 		 hdd_ctx->current_antenna_mode);