Parcourir la source

qcacld-3.0: Remove 40mhz bonded channel from driver

40 mhz channel array is redundant and does not give the
correct channel bonding information. Therefore remove
these channels, bonding array, and its associated usage.

Change-Id: I913fb97cdc913b1a027d21b0df526dfd5cd5902f
CRs-Fixed: 856727
Amar Singhal il y a 9 ans
Parent
commit
7ccdc4ff47

+ 1 - 42
core/cds/inc/cds_reg_service.h

@@ -137,39 +137,6 @@ enum channel_enum {
 	RF_CHAN_183,
 	RF_CHAN_184,
 
-	/* CHANNEL BONDED CHANNELS */
-	RF_CHAN_BOND_3,
-	RF_CHAN_BOND_4,
-	RF_CHAN_BOND_5,
-	RF_CHAN_BOND_6,
-	RF_CHAN_BOND_7,
-	RF_CHAN_BOND_8,
-	RF_CHAN_BOND_9,
-	RF_CHAN_BOND_10,
-	RF_CHAN_BOND_11,
-	RF_CHAN_BOND_38,
-	RF_CHAN_BOND_42,
-	RF_CHAN_BOND_46,
-	RF_CHAN_BOND_50,
-	RF_CHAN_BOND_54,
-	RF_CHAN_BOND_58,
-	RF_CHAN_BOND_62,
-	RF_CHAN_BOND_102,
-	RF_CHAN_BOND_106,
-	RF_CHAN_BOND_110,
-	RF_CHAN_BOND_114,
-	RF_CHAN_BOND_118,
-	RF_CHAN_BOND_122,
-	RF_CHAN_BOND_126,
-	RF_CHAN_BOND_130,
-	RF_CHAN_BOND_134,
-	RF_CHAN_BOND_138,
-	RF_CHAN_BOND_142,
-	RF_CHAN_BOND_151,
-	RF_CHAN_BOND_155,
-	RF_CHAN_BOND_159,
-	RF_CHAN_BOND_163,
-
 	NUM_RF_CHANNELS,
 
 	MIN_24GHZ_CHANNEL = RF_CHAN_1,
@@ -185,11 +152,6 @@ enum channel_enum {
 	NUM_20MHZ_RF_CHANNELS =
 		(MAX_20MHZ_RF_CHANNEL - MIN_20MHZ_RF_CHANNEL + 1),
 
-	MIN_40MHZ_RF_CHANNEL = RF_CHAN_BOND_3,
-	MAX_40MHZ_RF_CHANNEL = RF_CHAN_BOND_163,
-	NUM_40MHZ_RF_CHANNELS =
-		(MAX_40MHZ_RF_CHANNEL - MIN_40MHZ_RF_CHANNEL + 1),
-
 	MIN_59GHZ_CHANNEL = RF_CHAN_170,
 	MAX_59GHZ_CHANNEL = RF_CHAN_184,
 
@@ -323,10 +285,7 @@ QDF_STATUS cds_read_default_country(uint8_t *default_country);
 
 QDF_STATUS cds_get_channel_list_with_power(struct channel_power
 					   *base_channels,
-					   uint8_t *num_base_channels,
-					   struct channel_power
-					   *channel_40mhz,
-					   uint8_t *num_channels_40mhz);
+					   uint8_t *num_base_channels);
 
 enum channel_state cds_get_channel_state(uint32_t chan_num);
 QDF_STATUS cds_get_dfs_region(uint8_t *dfs_region);

+ 1 - 60
core/cds/src/cds_reg_service.c

@@ -95,37 +95,6 @@ const struct chan_map chan_mapping[NUM_RF_CHANNELS] = {
 	{5910, 182},
 	{5915, 183},
 	{5920, 184},
-	{2422, 3},
-	{2427, 4},
-	{2432, 5},
-	{2437, 6},
-	{2442, 7},
-	{2447, 8},
-	{2452, 9},
-	{2457, 10},
-	{2462, 11},
-	{5190, 38},
-	{5210, 42},
-	{5230, 46},
-	{5250, 50},
-	{5270, 54},
-	{5290, 58},
-	{5310, 62},
-	{5510, 102},
-	{5530, 106},
-	{5550, 110},
-	{5570, 114},
-	{5590, 118},
-	{5610, 122},
-	{5630, 126},
-	{5650, 130},
-	{5670, 134},
-	{5690, 138},
-	{5710, 142},
-	{5755, 151},
-	{5775, 155},
-	{5795, 159},
-	{5815, 163},
 };
 
 struct regulatory_channel reg_channels[NUM_RF_CHANNELS];
@@ -136,17 +105,12 @@ uint8_t dfs_region;
  * cds_get_channel_list_with_power() - retrieve channel list with power
  * @base_channels: base channels
  * @num_base_channels: number of base channels
- * @channels_40mhz: 40 MHz channels
- * @num_40mhz_channels: number of 40 Mhz channels
  *
  * Return: QDF_STATUS_SUCCESS
  */
 QDF_STATUS cds_get_channel_list_with_power(struct channel_power
 					   *base_channels,
-					   uint8_t *num_base_channels,
-					   struct channel_power
-					   *channels_40mhz,
-					   uint8_t *num_40mhz_channels)
+					   uint8_t *num_base_channels)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	int i, count;
@@ -172,29 +136,6 @@ QDF_STATUS cds_get_channel_list_with_power(struct channel_power
 		*num_base_channels = count;
 	}
 
-	if (channels_40mhz && num_40mhz_channels) {
-		count = 0;
-
-		for (i = RF_CHAN_BOND_3; i <= RF_CHAN_BOND_11; i++) {
-			if (reg_channels[i].state) {
-				channels_40mhz[count].chan_num =
-					chan_mapping[i].chan_num;
-				channels_40mhz[count++].power =
-					reg_channels[i].pwr_limit;
-			}
-		}
-
-		for (i = RF_CHAN_BOND_38; i <= RF_CHAN_BOND_163; i++) {
-			if (reg_channels[i].state) {
-				channels_40mhz[count].chan_num =
-					chan_mapping[i].chan_num;
-				channels_40mhz[count++].power =
-					reg_channels[i].pwr_limit;
-			}
-		}
-		*num_40mhz_channels = count;
-	}
-
 	return status;
 }
 

+ 4 - 68
core/hdd/src/wlan_hdd_regulatory.c

@@ -276,37 +276,6 @@ static void hdd_regulatory_wiphy_init(hdd_context_t *hdd_ctx,
 }
 #endif
 
-/**
- * hdd_bw20_ch_index_to_() - convert 20 mhhz channel index to 40 mhz index
- * @k: 20 mhz channel index
- *
- * Return: void
- */
-static int hdd_bw20_ch_index_to_bw40_ch_index(int k)
-{
-	int m = -1;
-
-	if (k >= RF_CHAN_1 && k <= RF_CHAN_14) {
-		m = k - RF_CHAN_1 + RF_CHAN_BOND_3;
-		if (m > RF_CHAN_BOND_11)
-			m = RF_CHAN_BOND_11;
-	} else if (k >= RF_CHAN_36 && k <= RF_CHAN_64) {
-		m = k - RF_CHAN_36 + RF_CHAN_BOND_38;
-		if (m > RF_CHAN_BOND_62)
-			m = RF_CHAN_BOND_62;
-	} else if (k >= RF_CHAN_100 && k <= RF_CHAN_144) {
-		m = k - RF_CHAN_100 + RF_CHAN_BOND_102;
-		if (m > RF_CHAN_BOND_142)
-			m = RF_CHAN_BOND_142;
-	} else if (k >= RF_CHAN_149 && k <= RF_CHAN_165) {
-		m = k - RF_CHAN_149 + RF_CHAN_BOND_151;
-		if (m > RF_CHAN_BOND_163)
-			m = RF_CHAN_BOND_163;
-	}
-
-	return m;
-}
-
 /**
  * is_wiphy_custom_regulatory() - is custom regulatory defined
  * @wiphy: wiphy
@@ -381,9 +350,9 @@ static void hdd_process_regulatory_data(hdd_context_t *hdd_ctx,
 					bool reset)
 {
 	int i, j, m;
-	int k = 0, n = 0;
+	int k = 0;
 	struct ieee80211_channel *chan;
-	struct regulatory_channel *temp_chan_k, *temp_chan_n, *temp_chan;
+	struct regulatory_channel *temp_chan_k, *temp_chan;
 	uint8_t band_capability;
 
 	band_capability = hdd_ctx->config->nBandCapability;
@@ -416,11 +385,9 @@ static void hdd_process_regulatory_data(hdd_context_t *hdd_ctx,
 		for (j = 0; j < wiphy->bands[i]->n_channels; j++) {
 
 			k = m + j;
-			n = hdd_bw20_ch_index_to_bw40_ch_index(k);
 
 			chan = &(wiphy->bands[i]->channels[j]);
 			temp_chan_k = &(reg_channels[k]);
-			temp_chan_n = &(reg_channels[n]);
 
 			if (!reset)
 				hdd_modify_wiphy(wiphy, chan);
@@ -429,11 +396,7 @@ static void hdd_process_regulatory_data(hdd_context_t *hdd_ctx,
 				temp_chan_k->state =
 					CHANNEL_STATE_DISABLE;
 				temp_chan_k->flags = chan->flags;
-				if (n != -1) {
-					temp_chan_n->state =
-						CHANNEL_STATE_DISABLE;
-					temp_chan_n->flags = chan->flags;
-				}
+
 			} else if (chan->flags &
 				   (IEEE80211_CHAN_RADAR |
 				    IEEE80211_CHAN_PASSIVE_SCAN |
@@ -448,20 +411,6 @@ static void hdd_process_regulatory_data(hdd_context_t *hdd_ctx,
 					chan->max_power;
 				temp_chan_k->flags = chan->flags;
 
-				if (n != -1) {
-					if ((chan->flags &
-					     IEEE80211_CHAN_NO_HT40) ==
-					    IEEE80211_CHAN_NO_HT40) {
-						temp_chan_n->state =
-							CHANNEL_STATE_DISABLE;
-					} else {
-						temp_chan_n->state =
-							CHANNEL_STATE_DFS;
-						temp_chan_n->pwr_limit =
-							 chan->max_power-3;
-					}
-					temp_chan_n->flags = chan->flags;
-				}
 				if ((chan->flags &
 				     IEEE80211_CHAN_NO_80MHZ) == 0)
 					hdd_ctx->isVHT80Allowed = 1;
@@ -469,20 +418,7 @@ static void hdd_process_regulatory_data(hdd_context_t *hdd_ctx,
 				temp_chan_k->state = CHANNEL_STATE_ENABLE;
 				temp_chan_k->pwr_limit = chan->max_power;
 				temp_chan_k->flags = chan->flags;
-				if (n != -1) {
-					if ((chan->flags &
-					     IEEE80211_CHAN_NO_HT40) ==
-					    IEEE80211_CHAN_NO_HT40) {
-						temp_chan_n->state =
-							CHANNEL_STATE_DISABLE;
-					} else {
-						temp_chan_n->state =
-							CHANNEL_STATE_ENABLE;
-						temp_chan_n->pwr_limit =
-							chan->max_power - 3;
-					}
-					temp_chan_n->flags = chan->flags;
-				}
+
 				if ((chan->flags &
 				     IEEE80211_CHAN_NO_80MHZ) == 0)
 					hdd_ctx->isVHT80Allowed = 1;

+ 0 - 4
core/sme/inc/csr_internal.h

@@ -690,11 +690,8 @@ typedef struct tagCsrScanStruct {
 	tSirScanType curScanType;
 	tCsrChannel channels11d;
 	struct channel_power defaultPowerTable[WNI_CFG_VALID_CHANNEL_LIST_LEN];
-	struct channel_power
-			defaultPowerTable40MHz[WNI_CFG_VALID_CHANNEL_LIST_LEN];
 	uint32_t numChannelsDefault;
 	tCsrChannel base_channels;  /* The channel base to work on */
-	tCsrChannel base40MHzChannels;  /* center channels for 40MHz channels */
 	tDblLinkList channelPowerInfoList24;
 	tDblLinkList channelPowerInfoList5G;
 	uint32_t nLastAgeTimeOut;
@@ -980,7 +977,6 @@ typedef struct tagCsrRoamStruct {
 	tCsrConfig configParam;
 	uint32_t numChannelsEeprom;     /* total channels of eeprom */
 	tCsrChannel baseChannels;  /* The channel base to work on */
-	tCsrChannel base40MHzChannels;  /* center channels for 40MHz channels */
 	eCsrRoamState curState[CSR_ROAM_SESSION_MAX];
 	eCsrRoamSubState curSubState[CSR_ROAM_SESSION_MAX];
 	/*

+ 4 - 0
core/sme/inc/sme_inside.h

@@ -284,4 +284,8 @@ void active_list_cmd_timeout_handle(void *userData);
 void csr_process_set_dual_mac_config(tpAniSirGlobal mac, tSmeCmd *command);
 void csr_process_set_hw_mode(tpAniSirGlobal mac, tSmeCmd *command);
 void csr_process_nss_update_req(tpAniSirGlobal mac, tSmeCmd *command);
+
+QDF_STATUS sme_check_ch_in_band(tpAniSirGlobal mac_ctx, uint8_t start_ch,
+				uint8_t ch_cnt);
+
 #endif /* #if !defined( __SMEINSIDE_H ) */

+ 36 - 14
core/sme/src/common/sme_api.c

@@ -7271,11 +7271,6 @@ sme_search_in_base_ch_lst(tpAniSirGlobal mac_ctx, uint8_t curr_ch)
 			return true;
 	}
 
-	ch_lst_info = &mac_ctx->scan.base40MHzChannels;
-	for (i = 0; i < ch_lst_info->numChannels; i++) {
-		if (ch_lst_info->channelList[i] == curr_ch)
-			return true;
-	}
 	return false;
 }
 /**
@@ -10208,11 +10203,12 @@ void sme_set_80bw_params(tpAniSirGlobal mac_ctx, uint8_t channel,
 }
 
 void sme_set_40bw_params(tpAniSirGlobal mac_ctx, uint8_t channel,
-		struct ch_params_s *ch_params, uint8_t is_11ac_mode)
+			 struct ch_params_s *ch_params, uint8_t is_11ac_mode)
 {
 	uint8_t tmp;
 	uint8_t center_freq = 0;
-	bool valid_40Mhz_ch = true;
+	uint8_t start_ch = 0;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
 	if (channel == 165) {
 		ch_params->ch_width = CH_WIDTH_20MHZ;
@@ -10232,13 +10228,39 @@ void sme_set_40bw_params(tpAniSirGlobal mac_ctx, uint8_t channel,
 				(ch_params->ch_width == CH_WIDTH_40MHZ))) {
 		ch_params->ch_width = CH_WIDTH_40MHZ;
 		ch_params->center_freq_seg0 = center_freq;
-		valid_40Mhz_ch = csr_roam_is_valid40_mhz_channel(mac_ctx,
-				ch_params->center_freq_seg0);
-	}
-	if (!valid_40Mhz_ch) {
-		ch_params->ch_width = CH_WIDTH_20MHZ;
-		ch_params->center_freq_seg0 = 0;
-		ch_params->sec_ch_offset = PHY_SINGLE_CHANNEL_CENTERED;
+
+		if (channel <= 40)
+			start_ch = 36;
+		else if (channel <= 48)
+			start_ch = 44;
+		else if (channel <= 56)
+			start_ch = 52;
+		else if (channel <= 64)
+			start_ch = 60;
+		else if (channel <= 104)
+			start_ch = 100;
+		else if (channel <= 112)
+			start_ch = 108;
+		else if (channel <= 120)
+			start_ch = 116;
+		else if (channel <= 128)
+			start_ch = 124;
+		else if (channel <= 136)
+			start_ch = 132;
+		else if (channel <= 144)
+			start_ch = 140;
+		else if (channel <= 153)
+			start_ch = 149;
+		else if (channel <= 161)
+			start_ch = 157;
+
+		status = sme_check_ch_in_band(mac_ctx, start_ch, 2);
+
+		if (QDF_STATUS_SUCCESS != status) {
+			ch_params->ch_width = CH_WIDTH_20MHZ;
+			ch_params->center_freq_seg0 = 0;
+			ch_params->sec_ch_offset = PHY_SINGLE_CHANNEL_CENTERED;
+		}
 	}
 }
 

+ 7 - 35
core/sme/src/csr/csr_api_roam.c

@@ -2487,17 +2487,13 @@ QDF_STATUS csr_get_channel_and_power_list(tpAniSirGlobal pMac)
 	uint8_t num20MHzChannelsFound = 0;
 	QDF_STATUS qdf_status;
 	uint8_t Index = 0;
-	uint8_t num40MHzChannelsFound = 0;
 
-	/* TODO: this interface changed to include the 40MHz channel list */
-	/* this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation */
-	/* Read the scan channel list (including the power limit) from EEPROM */
 	qdf_status =
 		cds_get_channel_list_with_power(pMac->scan.defaultPowerTable,
-						   &num20MHzChannelsFound,
-						   pMac->scan.defaultPowerTable40MHz,
-						   &num40MHzChannelsFound);
-	if ((QDF_STATUS_SUCCESS != qdf_status) || (num20MHzChannelsFound == 0)) {
+						&num20MHzChannelsFound);
+
+	if ((QDF_STATUS_SUCCESS != qdf_status) ||
+	    (num20MHzChannelsFound == 0)) {
 		sms_log(pMac, LOGE, FL("failed to get channels "));
 		status = QDF_STATUS_E_FAILURE;
 	} else {
@@ -2513,16 +2509,6 @@ QDF_STATUS csr_get_channel_and_power_list(tpAniSirGlobal pMac)
 		}
 		pMac->scan.base_channels.numChannels =
 			num20MHzChannelsFound;
-		if (num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) {
-			num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN;
-		}
-		for (Index = 0; Index < num40MHzChannelsFound; Index++) {
-			pMac->scan.base40MHzChannels.channelList[Index] =
-				pMac->scan.defaultPowerTable40MHz[Index].
-				chan_num;
-		}
-		pMac->scan.base40MHzChannels.numChannels =
-			num40MHzChannelsFound;
 	}
 	return status;
 }
@@ -11919,19 +11905,6 @@ bool csr_roam_is_channel_valid(tpAniSirGlobal pMac, uint8_t channel)
 	return fValid;
 }
 
-bool csr_roam_is_valid40_mhz_channel(tpAniSirGlobal pMac, uint8_t channel)
-{
-	bool fValid = false;
-	uint8_t i;
-	for (i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) {
-		if (channel == pMac->scan.base40MHzChannels.channelList[i]) {
-			fValid = true;
-			break;
-		}
-	}
-	return fValid;
-}
-
 /* This function check and validate whether the NIC can do CB (40MHz) */
 static ePhyChanBondState csr_get_cb_mode_from_ies(tpAniSirGlobal pMac,
 						  uint8_t primaryChn,
@@ -12014,8 +11987,9 @@ static ePhyChanBondState csr_get_cb_mode_from_ies(tpAniSirGlobal pMac,
 		break;
 	}
 
-	if ((PHY_SINGLE_CHANNEL_CENTERED != eRet)
-	    && !csr_roam_is_valid40_mhz_channel(pMac, centerChn)) {
+	if ((PHY_SINGLE_CHANNEL_CENTERED != eRet) &&
+	    (QDF_STATUS_SUCCESS != sme_check_ch_in_band(pMac,
+							centerChn - 2, 2))) {
 		sms_log(pMac, LOGE,
 			"Invalid center channel (%d), disable 40MHz mode",
 			centerChn);
@@ -18419,8 +18393,6 @@ void csr_init_operating_classes(tHalHandle hHal)
 
 	csr_update_op_class_array(pMac, opClasses,
 				  &pMac->scan.base_channels, "20MHz", &i);
-	csr_update_op_class_array(pMac, opClasses,
-				  &pMac->scan.base40MHzChannels, "40MHz", &i);
 	numClasses = i;
 
 	/* As per spec the operating classes should be in ascending order.