Przeglądaj źródła

qcacld-3.0: Cache the current band value

Add a separate variable to store the band value. Since the
value can be set at run-time, config data structure cannot be
used to store the runtime value. Also apply the configuration
restrictions while calculating this band value.

Change-Id: Id6df155b7ecfbe9ca84e489b2dd099cdd0cbcc8f
CRs-Fixed: 2085746
Amar Singhal 7 lat temu
rodzic
commit
58b45ef32b

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -1808,6 +1808,7 @@ struct hdd_context {
 #endif
 	uint8_t bt_a2dp_active:1;
 	uint8_t bt_vo_active:1;
+	eCsrBand curr_band;
 };
 
 /**

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

@@ -1609,6 +1609,8 @@ void hdd_update_tgt_cfg(void *context, void *param)
 		hdd_warn("ini BandCapability not supported by the target");
 	}
 
+	hdd_ctx->curr_band = hdd_ctx->config->nBandCapability;
+
 	if (!cds_is_driver_recovering() || cds_is_driver_in_bad_state()) {
 		hdd_ctx->reg.reg_domain = cfg->reg_domain;
 		hdd_ctx->reg.eeprom_rd_ext = cfg->eeprom_rd_ext;
@@ -6312,10 +6314,10 @@ QDF_STATUS hdd_set_sme_chan_list(hdd_context_t *hdd_ctx)
  */
 bool hdd_is_5g_supported(hdd_context_t *hdd_ctx)
 {
-	if (!hdd_ctx || !hdd_ctx->config)
+	if (!hdd_ctx)
 		return true;
 
-	if (hdd_ctx->config->nBandCapability != eCSR_BAND_24)
+	if (hdd_ctx->curr_band != eCSR_BAND_24)
 		return true;
 	else
 		return false;

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

@@ -389,7 +389,7 @@ static void hdd_process_regulatory_data(struct hdd_context *hdd_ctx,
 	struct regulatory_channel *cds_chan;
 	uint8_t band_capability;
 
-	band_capability = hdd_ctx->config->nBandCapability;
+	band_capability = hdd_ctx->curr_band;
 
 	for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS; band_num++) {
 

+ 3 - 2
core/hdd/src/wlan_hdd_wext.c

@@ -7816,7 +7816,6 @@ int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal,
 		sme_update_config(hal, sme_config);
 
 		phddctx->config->dot11Mode = hdd_dot11mode;
-		phddctx->config->nBandCapability = curr_band;
 		phddctx->config->nChannelBondingMode24GHz =
 			sme_config->csrConfig.channelBondingMode24GHz;
 		phddctx->config->nChannelBondingMode5GHz =
@@ -12772,7 +12771,7 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band)
 	}
 
 	if (QDF_STATUS_SUCCESS != ucfg_reg_get_curr_band(pHddCtx->hdd_pdev,
-				&currBand)) {
+							 &currBand)) {
 		hdd_debug("Failed to get current band config");
 		return -EIO;
 	}
@@ -12780,6 +12779,8 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band)
 	if (currBand == band)
 		return 0;
 
+	pHddCtx->curr_band = band;
+
 	/* Change band request received.
 	 * Abort pending scan requests, flush the existing scan results,
 	 * and change the band capability