diff --git a/core/cds/inc/cds_reg_service.h b/core/cds/inc/cds_reg_service.h index d69c877d1a21..43f0a8a21df5 100644 --- a/core/cds/inc/cds_reg_service.h +++ b/core/cds/inc/cds_reg_service.h @@ -41,6 +41,36 @@ #define CDS_COUNTRY_CODE_LEN 2 #define CDS_MAC_ADDRESS_LEN 6 +#define CDS_CHANNEL_STATE(enum) reg_channels[enum].enabled +#define CDS_CHANNEL_NUM(enum) chan_mapping[enum].chan_num +#define CDS_CHANNEL_FREQ(enum) chan_mapping[enum].center_freq +#define CDS_IS_DFS_CH(chan_num) (cds_get_channel_state((chan_num)) == \ + CHANNEL_STATE_DFS) + +#define CDS_IS_PASSIVE_OR_DISABLE_CH(chan_num) \ + (cds_get_channel_state(chan_num) != CHANNEL_STATE_ENABLE) + +#define CDS_MIN_24GHZ_CHANNEL_NUMBER \ + chan_mapping[MIN_24GHZ_CHANNEL].chan_num +#define CDS_MAX_24GHZ_CHANNEL_NUMBER \ + chan_mapping[MAX_24GHZ_CHANNEL].chan_num +#define CDS_MIN_5GHZ_CHANNEL_NUMBER chan_mapping[MIN_5GHZ_CHANNEL].chan_num +#define CDS_MAX_5GHZ_CHANNEL_NUMBER chan_mapping[MAX_5GHZ_CHANNEL].chan_num + +#define CDS_IS_CHANNEL_5GHZ(chan_num) \ + ((chan_num >= CDS_MIN_5GHZ_CHANNEL_NUMBER) && \ + (chan_num <= CDS_MAX_5GHZ_CHANNEL_NUMBER)) + +#define CDS_IS_CHANNEL_24GHZ(chan_num) \ + ((chan_num >= CDS_MIN_24GHZ_CHANNEL_NUMBER) && \ + (chan_num <= CDS_MAX_24GHZ_CHANNEL_NUMBER)) + +#define CDS_IS_SAME_BAND_CHANNELS(ch1, ch2) \ + (ch1 && ch2 && \ + (CDS_IS_CHANNEL_5GHZ(ch1) == CDS_IS_CHANNEL_5GHZ(ch2))) + +#define CDS_MIN_11P_CHANNEL chan_mapping[MIN_59GHZ_CHANNEL].chan_num + typedef enum { REGDOMAIN_FCC, REGDOMAIN_ETSI, @@ -50,7 +80,6 @@ typedef enum { } v_REGDOMAIN_t; typedef enum { - /* 2.4GHz Band */ RF_CHAN_1 = 0, RF_CHAN_2, RF_CHAN_3, @@ -66,7 +95,6 @@ typedef enum { RF_CHAN_13, RF_CHAN_14, - /* 4.9GHz Band */ RF_CHAN_240, RF_CHAN_244, RF_CHAN_248, @@ -75,7 +103,6 @@ typedef enum { RF_CHAN_212, RF_CHAN_216, - /* 5GHz Low & Mid U-NII Band */ RF_CHAN_36, RF_CHAN_40, RF_CHAN_44, @@ -85,7 +112,6 @@ typedef enum { RF_CHAN_60, RF_CHAN_64, - /* 5GHz Mid Band - ETSI & FCC */ RF_CHAN_100, RF_CHAN_104, RF_CHAN_108, @@ -97,17 +123,14 @@ typedef enum { RF_CHAN_132, RF_CHAN_136, RF_CHAN_140, - RF_CHAN_144, - /* 5GHz High U-NII Band */ RF_CHAN_149, RF_CHAN_153, RF_CHAN_157, RF_CHAN_161, RF_CHAN_165, - /* 802.11p */ RF_CHAN_170, RF_CHAN_171, RF_CHAN_172, @@ -134,19 +157,19 @@ typedef enum { RF_CHAN_BOND_9, RF_CHAN_BOND_10, RF_CHAN_BOND_11, - RF_CHAN_BOND_242, /* 4.9GHz Band */ + RF_CHAN_BOND_242, RF_CHAN_BOND_246, RF_CHAN_BOND_250, RF_CHAN_BOND_210, RF_CHAN_BOND_214, - RF_CHAN_BOND_38, /* 5GHz Low & Mid U-NII Band */ + 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, /* 5GHz Mid Band - ETSI & FCC */ + RF_CHAN_BOND_102, RF_CHAN_BOND_106, RF_CHAN_BOND_110, RF_CHAN_BOND_114, @@ -156,21 +179,19 @@ typedef enum { RF_CHAN_BOND_130, RF_CHAN_BOND_134, RF_CHAN_BOND_138, - RF_CHAN_BOND_142, - - RF_CHAN_BOND_151, /* 5GHz High U-NII Band */ + RF_CHAN_BOND_151, RF_CHAN_BOND_155, RF_CHAN_BOND_159, RF_CHAN_BOND_163, NUM_RF_CHANNELS, - MIN_2_4GHZ_CHANNEL = RF_CHAN_1, - MAX_2_4GHZ_CHANNEL = RF_CHAN_14, - NUM_24GHZ_CHANNELS = (MAX_2_4GHZ_CHANNEL - MIN_2_4GHZ_CHANNEL + 1), + MIN_24GHZ_CHANNEL = RF_CHAN_1, + MAX_24GHZ_CHANNEL = RF_CHAN_14, + NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1), - MIN_5GHZ_CHANNEL = RF_CHAN_240, + MIN_5GHZ_CHANNEL = RF_CHAN_36, MAX_5GHZ_CHANNEL = RF_CHAN_184, NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1), @@ -184,8 +205,8 @@ typedef enum { NUM_40MHZ_RF_CHANNELS = (MAX_40MHZ_RF_CHANNEL - MIN_40MHZ_RF_CHANNEL + 1), - MIN_5_9GHZ_CHANNEL = RF_CHAN_170, - MAX_5_9GHZ_CHANNEL = RF_CHAN_184, + MIN_59GHZ_CHANNEL = RF_CHAN_170, + MAX_59GHZ_CHANNEL = RF_CHAN_184, INVALID_RF_CHANNEL = 0xBAD, RF_CHANNEL_INVALID_MAX_FIELD = 0x7FFFFFFF @@ -200,16 +221,16 @@ typedef enum { typedef int8_t tPowerdBm; -typedef struct { +struct regulatory_channel { uint32_t enabled:4; uint32_t flags:28; - tPowerdBm pwrLimit; -} sRegulatoryChannel; + tPowerdBm pwr_limit; +}; -typedef struct { - uint16_t targetFreq; - uint16_t channelNum; -} tRfChannelProps; +struct chan_map { + uint16_t center_freq; + uint16_t chan_num; +}; typedef struct { uint8_t chanId; @@ -272,6 +293,8 @@ enum channel_width { */ typedef uint8_t country_code_t[CDS_COUNTRY_CODE_LEN + 1]; +extern struct regulatory_channel reg_channels[NUM_RF_CHANNELS]; +extern const struct chan_map chan_mapping[NUM_RF_CHANNELS]; CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *pRegDomain, const country_code_t countryCode, @@ -280,44 +303,22 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *pRegDomain, CDF_STATUS cds_read_default_country(country_code_t default_country); CDF_STATUS cds_get_channel_list_with_power(tChannelListWithPower - *pChannels20MHz, - uint8_t *pNum20MHzChannelsFound, + *base_channels, + uint8_t *num_base_channels, tChannelListWithPower *pChannels40MHz, - uint8_t *pNum40MHzChannelsFound); + uint8_t *); -CDF_STATUS cds_set_reg_domain(void *clientCtxt, v_REGDOMAIN_t regId); +CDF_STATUS cds_set_reg_domain(void *client_ctxt, v_REGDOMAIN_t reg_domain); -CHANNEL_STATE cds_get_channel_state(uint32_t rfChannel); +CHANNEL_STATE cds_get_channel_state(uint32_t chan_num); CDF_STATUS cds_regulatory_init(void); CDF_STATUS cds_get_dfs_region(uint8_t *dfs_region); CDF_STATUS cds_set_dfs_region(uint8_t dfs_region); bool cds_is_dsrc_channel(uint16_t); CHANNEL_STATE cds_get_bonded_channel_state(uint32_t chan_num, - enum channel_width ch_width); + enum channel_width chan_width); enum channel_width cds_get_max_channel_bw(uint32_t chan_num); - -#define CDS_IS_DFS_CH(channel) (cds_get_channel_state((channel)) == \ - CHANNEL_STATE_DFS) - -#define CDS_IS_PASSIVE_OR_DISABLE_CH(channel) \ - (cds_get_channel_state((channel)) != CHANNEL_STATE_ENABLE) - -#define CDS_MAX_24GHz_CHANNEL_NUMBER \ - (rf_channels[MAX_2_4GHZ_CHANNEL].channelNum) -#define CDS_MIN_5GHz_CHANNEL_NUMBER (rf_channels[RF_CHAN_36].channelNum) -#define CDS_MAX_5GHz_CHANNEL_NUMBER (rf_channels[MAX_5GHZ_CHANNEL].channelNum) - -#define CDS_IS_CHANNEL_5GHZ(chnNum) \ - (((chnNum) >= CDS_MIN_5GHz_CHANNEL_NUMBER) && ((chnNum) <= CDS_MAX_5GHz_CHANNEL_NUMBER)) - -#define CDS_IS_CHANNEL_24GHZ(chnNum) \ - (((chnNum) > 0) && ((chnNum) <= CDS_MAX_24GHz_CHANNEL_NUMBER)) - -#define CDS_IS_SAME_BAND_CHANNELS(ch1, ch2) \ - (ch1 && ch2 && \ - (CDS_IS_CHANNEL_5GHZ(ch1) == CDS_IS_CHANNEL_5GHZ(ch2))) - #endif /* __CDS_REG_SERVICE_H */ diff --git a/core/cds/src/cds_reg_service.c b/core/cds/src/cds_reg_service.c index ddbec514f1fe..c4945722a6b9 100644 --- a/core/cds/src/cds_reg_service.c +++ b/core/cds/src/cds_reg_service.c @@ -42,21 +42,13 @@ #define WORLD_SKU_MASK 0x00F0 #define WORLD_SKU_PREFIX 0x0060 -#define MAX_COUNTRY_COUNT 300 +#define REG_WAIT_TIME 50 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS) #define IEEE80211_CHAN_PASSIVE_SCAN IEEE80211_CHAN_NO_IR #define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR #endif -/* true if init happens thru init time driver hint */ -static bool init_by_driver = false; -/* true if init happens thru init time callback from regulatory core. - this should be set to true during driver reload */ -static bool init_by_reg_core = false; - -#define REG_WAIT_TIME 50 - #define REG_RULE_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0) #define REG_RULE_2467_2472 REG_RULE(2467-10, 2472+10, 40, 0, 20, \ @@ -131,7 +123,7 @@ static const struct ieee80211_regdomain cds_world_regdom_67_68_6A_6C = { } }; -const tRfChannelProps rf_channels[NUM_RF_CHANNELS] = { +const struct chan_map chan_mapping[NUM_RF_CHANNELS] = { {2412, 1}, {2417, 2}, {2422, 3}, @@ -231,7 +223,10 @@ const tRfChannelProps rf_channels[NUM_RF_CHANNELS] = { {5815, 163}, }; -sRegulatoryChannel reg_channels[NUM_RF_CHANNELS]; +static bool init_by_driver; +static bool init_by_reg_core; + +struct regulatory_channel reg_channels[NUM_RF_CHANNELS]; /** * cds_is_wwr_sku() - is regdomain world sku @@ -400,17 +395,17 @@ CDF_STATUS cds_get_channel_list_with_power(tChannelListWithPower * for (i = 0; i <= RF_CHAN_14; i++) { if (reg_channels[i].enabled) { base_channels[count].chanId = - rf_channels[i].channelNum; + chan_mapping[i].chan_num; base_channels[count++].pwr = - reg_channels[i].pwrLimit; + reg_channels[i].pwr_limit; } } for (i = RF_CHAN_36; i <= RF_CHAN_184; i++) { if (reg_channels[i].enabled) { base_channels[count].chanId = - rf_channels[i].channelNum; + chan_mapping[i].chan_num; base_channels[count++].pwr = - reg_channels[i].pwrLimit; + reg_channels[i].pwr_limit; } } *num_base_channels = count; @@ -422,18 +417,18 @@ CDF_STATUS cds_get_channel_list_with_power(tChannelListWithPower * for (i = RF_CHAN_BOND_3; i <= RF_CHAN_BOND_11; i++) { if (reg_channels[i].enabled) { channels_40mhz[count].chanId = - rf_channels[i].channelNum; + chan_mapping[i].chan_num; channels_40mhz[count++].pwr = - reg_channels[i].pwrLimit; + reg_channels[i].pwr_limit; } } for (i = RF_CHAN_BOND_38; i <= RF_CHAN_BOND_163; i++) { if (reg_channels[i].enabled) { channels_40mhz[count].chanId = - rf_channels[i].channelNum; + chan_mapping[i].chan_num; channels_40mhz[count++].pwr = - reg_channels[i].pwrLimit; + reg_channels[i].pwr_limit; } } *num_40mhz_channels = count; @@ -482,7 +477,7 @@ static eRfChannels cds_get_channel_enum(uint32_t chan_num) uint32_t loop; for (loop = 0; loop <= RF_CHAN_184; loop++) - if (rf_channels[loop].channelNum == chan_num) + if (chan_mapping[loop].chan_num == chan_num) return loop; CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR, @@ -494,7 +489,7 @@ static eRfChannels cds_get_channel_enum(uint32_t chan_num) /** * cds_get_channel_state() - get the channel state - * @channel_num: channel number + * @chan_num: channel number * * Return: CHANNEL_STATE */ @@ -795,9 +790,7 @@ static int cds_process_regulatory_data(struct wiphy *wiphy, hdd_context_t *hdd_ctx; const struct ieee80211_reg_rule *reg_rule; struct ieee80211_channel *chan; - sRegulatoryChannel *temp_chan_k; - sRegulatoryChannel *temp_chan_n; - sRegulatoryChannel *temp_chan; + struct regulatory_channel *temp_chan_k, *temp_chan_n, *temp_chan; hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD); if (NULL == hdd_ctx) { @@ -927,7 +920,7 @@ static int cds_process_regulatory_data(struct wiphy *wiphy, IEEE80211_CHAN_PASSIVE_SCAN; #endif temp_chan_k->enabled = CHANNEL_STATE_DFS; - temp_chan_k->pwrLimit = + temp_chan_k->pwr_limit = chan->max_power; temp_chan_k->flags = chan->flags; @@ -940,7 +933,7 @@ static int cds_process_regulatory_data(struct wiphy *wiphy, } else { temp_chan_n->enabled = CHANNEL_STATE_DFS; - temp_chan_n->pwrLimit = + temp_chan_n->pwr_limit = chan->max_power-3; } temp_chan_n->flags = chan->flags; @@ -950,7 +943,7 @@ static int cds_process_regulatory_data(struct wiphy *wiphy, hdd_ctx->isVHT80Allowed = 1; } else { temp_chan_k->enabled = CHANNEL_STATE_ENABLE; - temp_chan_k->pwrLimit = chan->max_power; + temp_chan_k->pwr_limit = chan->max_power; temp_chan_k->flags = chan->flags; if (n != -1) { if ((chan->flags & @@ -961,7 +954,7 @@ static int cds_process_regulatory_data(struct wiphy *wiphy, } else { temp_chan_n->enabled = CHANNEL_STATE_ENABLE; - temp_chan_n->pwrLimit = + temp_chan_n->pwr_limit = chan->max_power - 3; } temp_chan_n->flags = chan->flags; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 09ba705be76c..138b634affc5 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -1275,20 +1275,20 @@ static void wlan_hdd_set_acs_ch_range(tsap_Config_t *sap_cfg, bool ht_enabled, int i; if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211B) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11b; - sap_cfg->acs_cfg.start_ch = rf_channels[RF_CHAN_1].channelNum; - sap_cfg->acs_cfg.end_ch = rf_channels[RF_CHAN_14].channelNum; + sap_cfg->acs_cfg.start_ch = CDS_CHANNEL_NUM(RF_CHAN_1); + sap_cfg->acs_cfg.end_ch = CDS_CHANNEL_NUM(RF_CHAN_14); } else if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211G) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11g; - sap_cfg->acs_cfg.start_ch = rf_channels[RF_CHAN_1].channelNum; - sap_cfg->acs_cfg.end_ch = rf_channels[RF_CHAN_13].channelNum; + sap_cfg->acs_cfg.start_ch = CDS_CHANNEL_NUM(RF_CHAN_1); + sap_cfg->acs_cfg.end_ch = CDS_CHANNEL_NUM(RF_CHAN_13); } else if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211A) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_11a; - sap_cfg->acs_cfg.start_ch = rf_channels[RF_CHAN_36].channelNum; - sap_cfg->acs_cfg.end_ch = rf_channels[RF_CHAN_165].channelNum; + sap_cfg->acs_cfg.start_ch = CDS_CHANNEL_NUM(RF_CHAN_36); + sap_cfg->acs_cfg.end_ch = CDS_CHANNEL_NUM(RF_CHAN_165); } else if (sap_cfg->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211ANY) { sap_cfg->acs_cfg.hw_mode = eCSR_DOT11_MODE_abg; - sap_cfg->acs_cfg.start_ch = rf_channels[RF_CHAN_1].channelNum; - sap_cfg->acs_cfg.end_ch = rf_channels[RF_CHAN_165].channelNum; + sap_cfg->acs_cfg.start_ch = CDS_CHANNEL_NUM(RF_CHAN_1); + sap_cfg->acs_cfg.end_ch = CDS_CHANNEL_NUM(RF_CHAN_165); } if (ht_enabled) @@ -5772,7 +5772,7 @@ CDF_STATUS wlan_hdd_validate_operation_channel(hdd_adapter_t *pAdapter, if (hdd_pConfig_ini->sapAllowAllChannel) { /* Validate the channel */ for (count = RF_CHAN_1; count <= RF_CHAN_165; count++) { - if (channel == rf_channels[count].channelNum) { + if (channel == CDS_CHANNEL_NUM(count)) { fValidChannel = true; break; } diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index e7a70a974b4e..0e69738968e5 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3629,10 +3629,10 @@ static int __iw_softap_get_channel_list(struct net_device *dev, curBand, bandStartChannel, bandEndChannel); for (i = bandStartChannel; i <= bandEndChannel; i++) { - if ((CHANNEL_STATE_ENABLE == reg_channels[i].enabled) || - (CHANNEL_STATE_DFS == reg_channels[i].enabled)) { + if ((CHANNEL_STATE_ENABLE == CDS_CHANNEL_STATE(i)) || + (CHANNEL_STATE_DFS == CDS_CHANNEL_STATE(i))) { channel_list->channels[num_channels] = - rf_channels[i].channelNum; + CDS_CHANNEL_NUM(i); num_channels++; } } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a22b44b88e1b..6a4e405da5a3 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -4603,7 +4603,7 @@ static uint8_t hdd_find_prefd_safe_chnl(hdd_context_t *hdd_ctxt, is_unsafe = 0; for (channel_loop = 0; channel_loop < unsafe_channel_count; channel_loop++) { - if (rf_channels[i].channelNum == + if (CDS_CHANNEL_NUM(i) == hdd_ctxt->unsafe_channel_list[channel_loop]) { is_unsafe = 1; break; @@ -4611,7 +4611,7 @@ static uint8_t hdd_find_prefd_safe_chnl(hdd_context_t *hdd_ctxt, } if (!is_unsafe) { safe_channels[safe_channel_count] = - rf_channels[i].channelNum; + CDS_CHANNEL_NUM(i); hddLog(CDF_TRACE_LEVEL_INFO_HIGH, FL("safe channel %d"), safe_channels[safe_channel_count]); @@ -4773,7 +4773,7 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param) for (channel_loop = MIN_20MHZ_RF_CHANNEL; channel_loop <= MAX_20MHZ_RF_CHANNEL; channel_loop++) { - if (rf_channels[channel_loop].targetFreq >= + if (CDS_CHANNEL_FREQ(channel_loop) >= ch_avoid_indi->avoid_freq_range[ range_loop].start_freq) { start_channel_idx = channel_loop; @@ -4782,11 +4782,11 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param) } for (channel_loop = MIN_20MHZ_RF_CHANNEL; channel_loop <= MAX_20MHZ_RF_CHANNEL; channel_loop++) { - if (rf_channels[channel_loop].targetFreq >= + if (CDS_CHANNEL_FREQ(channel_loop) >= ch_avoid_indi->avoid_freq_range[ range_loop].end_freq) { end_channel_idx = channel_loop; - if (rf_channels[channel_loop].targetFreq > + if (CDS_CHANNEL_FREQ(channel_loop) > ch_avoid_indi->avoid_freq_range[ range_loop].end_freq) end_channel_idx--; @@ -4801,8 +4801,8 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param) for (channel_loop = start_channel_idx; channel_loop <= end_channel_idx; channel_loop++) { hdd_ctxt->unsafe_channel_list[ - hdd_ctxt->unsafe_channel_count++] = - rf_channels[channel_loop].channelNum; + hdd_ctxt->unsafe_channel_count++] = + CDS_CHANNEL_FREQ(channel_loop); if (hdd_ctxt->unsafe_channel_count >= NUM_20MHZ_RF_CHANNELS) { hddLog(LOGW, FL("LTECoex unsafe ch list full")); diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 1109ca023c59..0da62d0f9c05 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -790,8 +790,7 @@ typedef struct sap_SoftapStats_s { uint32_t pktCounterRssi[MAX_NUM_RSSI]; #endif } tSap_SoftapStats, *tpSap_SoftapStats; -/* Channel/Frequency table */ -extern const tRfChannelProps rf_channels[NUM_RF_CHANNELS]; + #ifdef FEATURE_WLAN_CH_AVOID /* Store channel safety information */ typedef struct { diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index b66bf04e6ee1..377cd0861431 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -4184,8 +4184,8 @@ static CDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, for (loop_count = band_start_ch; loop_count <= band_end_ch; loop_count++) { /* go to next channel if rf_channel is out of range */ - if ((start_ch_num > rf_channels[loop_count].channelNum) || - (end_ch_num < rf_channels[loop_count].channelNum)) + if ((start_ch_num > CDS_CHANNEL_NUM(loop_count)) || + (end_ch_num < CDS_CHANNEL_NUM(loop_count))) continue; /* * go to next channel if none of these condition pass @@ -4193,22 +4193,22 @@ static CDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, * - DFS scan disable but chan in CHANNEL_STATE_ENABLE */ if (!(((eSAP_TRUE == mac_ctx->scan.fEnableDFSChnlScan) && - (reg_channels[loop_count].enabled)) || + CDS_CHANNEL_STATE(loop_count)) || ((eSAP_FALSE == mac_ctx->scan.fEnableDFSChnlScan) && (CHANNEL_STATE_ENABLE == - reg_channels[loop_count].enabled)))) + CDS_CHANNEL_STATE(loop_count))))) continue; #ifdef FEATURE_WLAN_CH_AVOID for (i = 0; i < NUM_20MHZ_RF_CHANNELS; i++) { if ((safe_channels[i].channelNumber == - rf_channels[loop_count].channelNum)) { + CDS_CHANNEL_NUM(loop_count))) { /* Check if channel is safe */ if (true == safe_channels[i].isSafe) { #endif #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE uint8_t ch; - ch = rf_channels[loop_count].channelNum; + ch = CDS_CHANNEL_NUM(loop_count); if ((sap_ctx->acs_cfg->skip_scan_status == eSAP_DO_PAR_ACS_SCAN)) { if ((ch >= sap_ctx->acs_cfg->skip_scan_range1_stch && @@ -4216,7 +4216,7 @@ static CDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, (ch >= sap_ctx->acs_cfg->skip_scan_range2_stch && ch <= sap_ctx->acs_cfg->skip_scan_range2_endch)) { list[ch_count] = - rf_channels[loop_count].channelNum; + CDS_CHANNEL_NUM(loop_count); ch_count++; CDF_TRACE(CDF_MODULE_ID_SAP, CDF_TRACE_LEVEL_INFO, @@ -4230,7 +4230,7 @@ static CDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, } } else { list[ch_count] = - rf_channels[loop_count].channelNum; + CDS_CHANNEL_NUM(loop_count); ch_count++; CDF_TRACE(CDF_MODULE_ID_SAP, CDF_TRACE_LEVEL_INFO, @@ -4238,7 +4238,7 @@ static CDF_STATUS sap_get_channel_list(ptSapContext sap_ctx, ch_count, ch); } #else - list[ch_count] = rf_channels[loop_count].channelNum; + list[ch_count] = CDS_CHANNEL_NUM(loop_count); ch_count++; #endif #ifdef FEATURE_WLAN_CH_AVOID @@ -4306,10 +4306,10 @@ static CDF_STATUS sap_get5_g_hz_channel_list(ptSapContext sapContext) } for (i = RF_CHAN_36; i <= RF_CHAN_165; i++) { - if (reg_channels[i].enabled == CHANNEL_STATE_ENABLE || - reg_channels[i].enabled == CHANNEL_STATE_DFS) { + if (CDS_CHANNEL_STATE(i) == CHANNEL_STATE_ENABLE || + CDS_CHANNEL_STATE(i) == CHANNEL_STATE_DFS) { sapContext->SapAllChnlList.channelList[count].channel = - rf_channels[i].channelNum; + CDS_CHANNEL_NUM(i); CDF_TRACE(CDF_MODULE_ID_SAP, CDF_TRACE_LEVEL_INFO_LOW, "%s[%d] CHANNEL = %d", __func__, __LINE__, sapContext->SapAllChnlList.channelList[count]. @@ -4601,12 +4601,12 @@ CDF_STATUS sap_init_dfs_channel_nol_list(ptSapContext sapContext) } for (i = RF_CHAN_36; i <= RF_CHAN_165; i++) { - if (reg_channels[i].enabled == CHANNEL_STATE_DFS) { + if (CDS_CHANNEL_STATE(i) == CHANNEL_STATE_DFS) { /* if dfs nol is not found, initialize it */ if (!bFound) { pMac->sap.SapDfsInfo.sapDfsChannelNolList[count] .dfs_channel_number = - rf_channels[i].channelNum; + CDS_CHANNEL_NUM(i); CDF_TRACE(CDF_MODULE_ID_SAP, CDF_TRACE_LEVEL_INFO_LOW, diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 3ba7b0a410d1..1abf9c8e3216 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -76,8 +76,6 @@ extern "C" { #define SAP_CHAN_PREFERRED_INDOOR 1 #define SAP_CHAN_PREFERRED_OUTDOOR 2 -extern const sRegulatoryChannel reg_channels[NUM_RF_CHANNELS]; - /*---------------------------------------------------------------------------- * Typedefs * -------------------------------------------------------------------------*/ diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index af8d356d8415..e3189eae4f33 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -706,7 +706,7 @@ CDF_STATUS csr_update_channel_list(tpAniSirGlobal pMac) for (i = 0; i < pScan->base_channels.numChannels; i++) { /* Scan is not performed on DSRC channels*/ - if (pScan->base_channels.channelList[i] >= MIN_11P_CHANNEL) + if (pScan->base_channels.channelList[i] >= CDS_MIN_11P_CHANNEL) continue; if (pScan->fcc_constraint) { if (pScan->base_channels.channelList[i] == 12) diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 20293af2a9f0..c6e446bcdb80 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -3058,13 +3058,13 @@ CDF_STATUS csr_save_to_channel_power2_g_5_g(tpAniSirGlobal pMac, if ((CDS_IS_CHANNEL_24GHZ(pChannelSet->firstChannel)) && ((pChannelSet->firstChannel + (pChannelSet->numChannels - 1)) <= - CDS_MAX_24GHz_CHANNEL_NUMBER)) { + CDS_MAX_24GHZ_CHANNEL_NUMBER)) { pChannelSet->interChannelOffset = 1; f2GHzInfoFound = true; } else if ((CDS_IS_CHANNEL_5GHZ(pChannelSet->firstChannel)) && ((pChannelSet->firstChannel + ((pChannelSet->numChannels - 1) * 4)) <= - CDS_MAX_5GHz_CHANNEL_NUMBER)) { + CDS_MAX_5GHZ_CHANNEL_NUMBER)) { pChannelSet->interChannelOffset = 4; f2GHzInfoFound = false; } else { @@ -5184,7 +5184,7 @@ csr_issue_user_scan(tpAniSirGlobal mac_ctx, tSmeCmd *cmd) j = 0; for (i = 0; i < len; i++) { new_ch_info.ChannelList[j++] = ch_lst[i]; - if (CDS_MAX_24GHz_CHANNEL_NUMBER >= ch_lst[i]) + if (CDS_MAX_24GHZ_CHANNEL_NUMBER >= ch_lst[i]) new_ch_info.ChannelList[j++] = ch_lst[i]; } if (NULL != @@ -5256,7 +5256,8 @@ static void csr_scan_copy_request_valid_channels_only(tpAniSirGlobal mac_ctx, * that is the only way to find p2p peers. * This can happen only if band is set to 5Ghz mode. */ - if (src_req->ChannelInfo.ChannelList[index] < MIN_11P_CHANNEL && + if (src_req->ChannelInfo.ChannelList[index] < + CDS_MIN_11P_CHANNEL && ((csr_roam_is_valid_channel(mac_ctx, src_req->ChannelInfo.ChannelList[index])) || ((eCSR_SCAN_P2P_DISCOVERY == src_req->requestType) && @@ -5341,7 +5342,7 @@ static bool csr_scan_filter_ibss_chnl_band(tpAniSirGlobal mac_ctx, * Don't allow DSRC channel when IBSS concurrent connection * is up */ - if (valid_chnl_list[i] >= MIN_11P_CHANNEL) + if (valid_chnl_list[i] >= CDS_MIN_11P_CHANNEL) continue; if (CDS_IS_CHANNEL_5GHZ(ibss_channel) && CDS_IS_CHANNEL_24GHZ(valid_chnl_list[i])) { @@ -5455,7 +5456,7 @@ CDF_STATUS csr_scan_copy_request(tpAniSirGlobal mac_ctx, ChannelInfo. ChannelList[index]); if (src_req->ChannelInfo.ChannelList[index] < - MIN_11P_CHANNEL && + CDS_MIN_11P_CHANNEL && ((CHANNEL_STATE_ENABLE == channel_state) || ((CHANNEL_STATE_DFS == channel_state) && @@ -5486,7 +5487,7 @@ CDF_STATUS csr_scan_copy_request(tpAniSirGlobal mac_ctx, for (index = 0; index < src_req->ChannelInfo. numOfChannels; index++) { if (src_req->ChannelInfo.ChannelList[index] < - MIN_11P_CHANNEL) { + CDS_MIN_11P_CHANNEL) { dst_req->ChannelInfo. ChannelList[new_index] = src_req->ChannelInfo. diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index 3a7b54c8f974..7e2a489def6d 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -104,7 +104,6 @@ #define CSR_MAX_BSSID_COUNT ((CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE/4000) * 3) #define CSR_CUSTOM_CONC_GO_BI 100 -#define MIN_11P_CHANNEL (rf_channels[MIN_5_9GHZ_CHANNEL].channelNum) typedef enum { eCsrNextScanNothing, @@ -196,7 +195,6 @@ typedef struct { (eCsrForcedDisassocMICFailure == \ (pCommand)->u.roamCmd.roamReason))) -extern const tRfChannelProps rf_channels[NUM_RF_CHANNELS]; eCsrRoamState csr_roam_state_change(tpAniSirGlobal pMac, eCsrRoamState NewRoamState, uint8_t sessionId); CDF_STATUS csr_scanning_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf); diff --git a/core/sme/src/csr/csr_util.c b/core/sme/src/csr/csr_util.c index 41ede0889193..95faef7eccf1 100644 --- a/core/sme/src/csr/csr_util.c +++ b/core/sme/src/csr/csr_util.c @@ -97,7 +97,6 @@ uint8_t csr_wapi_oui[][CSR_WAPI_OUI_SIZE] = { uint8_t csr_wme_info_oui[CSR_WME_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; uint8_t csr_wme_parm_oui[CSR_WME_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; - /* ////////////////////////////////////////////////////////////////////// */ /** @@ -5535,9 +5534,8 @@ uint16_t sme_chn_to_freq(uint8_t chanNum) int i; for (i = 0; i < NUM_RF_CHANNELS; i++) { - if (rf_channels[i].channelNum == chanNum) { - return rf_channels[i].targetFreq; - } + if (CDS_CHANNEL_NUM(i) == chanNum) + return CDS_CHANNEL_FREQ(i); } return 0;