|
@@ -49,20 +49,13 @@
|
|
|
#define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR
|
|
|
#endif
|
|
|
|
|
|
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0))
|
|
|
-#define IEEE80211_CHAN_NO_20MHZ (1<<11)
|
|
|
-#define IEEE80211_CHAN_NO_10MHZ (1<<12)
|
|
|
-#endif
|
|
|
-
|
|
|
-static v_REGDOMAIN_t temp_reg_domain = REGDOMAIN_COUNT;
|
|
|
-
|
|
|
/* 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_WAIT_TIME 50
|
|
|
|
|
|
#define REG_RULE_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
|
|
|
|
|
@@ -70,7 +63,7 @@ static bool init_by_reg_core = false;
|
|
|
NL80211_RRF_PASSIVE_SCAN)
|
|
|
|
|
|
#define REG_RULE_2484 REG_RULE(2484-10, 2484+10, 40, 0, 20, \
|
|
|
- NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM)
|
|
|
+ NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM)
|
|
|
|
|
|
#define REG_RULE_5180_5320 REG_RULE(5180-10, 5320+10, 80, 0, 20, \
|
|
|
NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
|
|
@@ -138,161 +131,6 @@ static const struct ieee80211_regdomain cds_world_regdom_67_68_6A_6C = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-typedef struct {
|
|
|
- uint8_t regDomain;
|
|
|
- country_code_t countryCode;
|
|
|
-} CountryInfo_t;
|
|
|
-
|
|
|
-typedef struct {
|
|
|
- uint16_t countryCount;
|
|
|
- CountryInfo_t countryInfo[MAX_COUNTRY_COUNT];
|
|
|
-} CountryInfoTable_t;
|
|
|
-
|
|
|
-static CountryInfoTable_t country_info_table = {
|
|
|
- /* the first entry in the table is always the world domain */
|
|
|
- 138,
|
|
|
- {
|
|
|
- {REGDOMAIN_WORLD, {'0', '0'}}, /* WORLD DOMAIN */
|
|
|
- {REGDOMAIN_FCC, {'A', 'D'}}, /* ANDORRA */
|
|
|
- {REGDOMAIN_ETSI, {'A', 'E'}}, /* UAE */
|
|
|
- {REGDOMAIN_ETSI, {'A', 'L'}}, /* ALBANIA */
|
|
|
- {REGDOMAIN_ETSI, {'A', 'M'}}, /* ARMENIA */
|
|
|
- {REGDOMAIN_ETSI, {'A', 'N'}}, /* NETHERLANDS ANTILLES */
|
|
|
- {REGDOMAIN_FCC, {'A', 'R'}}, /* ARGENTINA */
|
|
|
- {REGDOMAIN_FCC, {'A', 'S'}}, /* AMERICAN SOMOA */
|
|
|
- {REGDOMAIN_ETSI, {'A', 'T'}}, /* AUSTRIA */
|
|
|
- {REGDOMAIN_FCC, {'A', 'U'}}, /* AUSTRALIA */
|
|
|
- {REGDOMAIN_ETSI, {'A', 'W'}}, /* ARUBA */
|
|
|
- {REGDOMAIN_ETSI, {'A', 'Z'}}, /* AZERBAIJAN */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'A'}}, /* BOSNIA AND HERZEGOVINA */
|
|
|
- {REGDOMAIN_FCC, {'B', 'B'}}, /* BARBADOS */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'D'}}, /* BANGLADESH */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'E'}}, /* BELGIUM */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'G'}}, /* BULGARIA */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'H'}}, /* BAHRAIN */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'L'}}, /* */
|
|
|
- {REGDOMAIN_FCC, {'B', 'M'}}, /* BERMUDA */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'N'}}, /* BRUNEI DARUSSALAM */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'O'}}, /* BOLIVIA */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'R'}}, /* BRAZIL */
|
|
|
- {REGDOMAIN_FCC, {'B', 'S'}}, /* BAHAMAS */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'Y'}}, /* BELARUS */
|
|
|
- {REGDOMAIN_ETSI, {'B', 'Z'}}, /* BELIZE */
|
|
|
- {REGDOMAIN_FCC, {'C', 'A'}}, /* CANADA */
|
|
|
- {REGDOMAIN_ETSI, {'C', 'H'}}, /* SWITZERLAND */
|
|
|
- {REGDOMAIN_ETSI, {'C', 'L'}}, /* CHILE */
|
|
|
- {REGDOMAIN_FCC, {'C', 'N'}}, /* CHINA */
|
|
|
- {REGDOMAIN_FCC, {'C', 'O'}}, /* COLOMBIA */
|
|
|
- {REGDOMAIN_ETSI, {'C', 'R'}}, /* COSTA RICA */
|
|
|
- {REGDOMAIN_ETSI, {'C', 'S'}},
|
|
|
- {REGDOMAIN_ETSI, {'C', 'Y'}}, /* CYPRUS */
|
|
|
- {REGDOMAIN_ETSI, {'C', 'Z'}}, /* CZECH REPUBLIC */
|
|
|
- {REGDOMAIN_ETSI, {'D', 'E'}}, /* GERMANY */
|
|
|
- {REGDOMAIN_ETSI, {'D', 'K'}}, /* DENMARK */
|
|
|
- {REGDOMAIN_FCC, {'D', 'O'}}, /* DOMINICAN REPUBLIC */
|
|
|
- {REGDOMAIN_ETSI, {'D', 'Z'}}, /* ALGERIA */
|
|
|
- {REGDOMAIN_ETSI, {'E', 'C'}}, /* ECUADOR */
|
|
|
- {REGDOMAIN_ETSI, {'E', 'E'}}, /* ESTONIA */
|
|
|
- {REGDOMAIN_ETSI, {'E', 'G'}}, /* EGYPT */
|
|
|
- {REGDOMAIN_ETSI, {'E', 'S'}}, /* SPAIN */
|
|
|
- {REGDOMAIN_ETSI, {'F', 'I'}}, /* FINLAND */
|
|
|
- {REGDOMAIN_ETSI, {'F', 'R'}}, /* FRANCE */
|
|
|
- {REGDOMAIN_ETSI, {'G', 'B'}}, /* UNITED KINGDOM */
|
|
|
- {REGDOMAIN_FCC, {'G', 'D'}}, /* GRENADA */
|
|
|
- {REGDOMAIN_ETSI, {'G', 'E'}}, /* GEORGIA */
|
|
|
- {REGDOMAIN_ETSI, {'G', 'F'}}, /* FRENCH GUIANA */
|
|
|
- {REGDOMAIN_ETSI, {'G', 'L'}}, /* GREENLAND */
|
|
|
- {REGDOMAIN_ETSI, {'G', 'P'}}, /* GUADELOUPE */
|
|
|
- {REGDOMAIN_ETSI, {'G', 'R'}}, /* GREECE */
|
|
|
- {REGDOMAIN_FCC, {'G', 'T'}}, /* GUATEMALA */
|
|
|
- {REGDOMAIN_FCC, {'G', 'U'}}, /* GUAM */
|
|
|
- {REGDOMAIN_ETSI, {'H', 'U'}}, /* HUNGARY */
|
|
|
- {REGDOMAIN_FCC, {'I', 'D'}}, /* INDONESIA */
|
|
|
- {REGDOMAIN_ETSI, {'I', 'E'}}, /* IRELAND */
|
|
|
- {REGDOMAIN_ETSI, {'I', 'L'}}, /* ISRAEL */
|
|
|
- {REGDOMAIN_ETSI, {'I', 'N'}}, /* INDIA */
|
|
|
- {REGDOMAIN_ETSI, {'I', 'R'}}, /* IRAN, ISLAMIC REPUBLIC OF */
|
|
|
- {REGDOMAIN_ETSI, {'I', 'S'}}, /* ICELNAD */
|
|
|
- {REGDOMAIN_ETSI, {'I', 'T'}}, /* ITALY */
|
|
|
- {REGDOMAIN_FCC, {'J', 'M'}}, /* JAMAICA */
|
|
|
- {REGDOMAIN_JAPAN, {'J', 'P'}}, /* JAPAN */
|
|
|
- {REGDOMAIN_ETSI, {'J', 'O'}}, /* JORDAN */
|
|
|
- {REGDOMAIN_ETSI, {'K', 'E'}}, /* KENYA */
|
|
|
- {REGDOMAIN_ETSI, {'K', 'H'}}, /* CAMBODIA */
|
|
|
- {REGDOMAIN_ETSI, {'K', 'P'}}, /* KOREA, DEMOCRATIC PEOPLE's REPUBLIC OF */
|
|
|
- {REGDOMAIN_ETSI, {'K', 'R'}}, /* KOREA, REPUBLIC OF */
|
|
|
- {REGDOMAIN_ETSI, {'K', 'W'}}, /* KUWAIT */
|
|
|
- {REGDOMAIN_ETSI, {'K', 'Z'}}, /* KAZAKHSTAN */
|
|
|
- {REGDOMAIN_ETSI, {'L', 'B'}}, /* LEBANON */
|
|
|
- {REGDOMAIN_ETSI, {'L', 'I'}}, /* LIECHTENSTEIN */
|
|
|
- {REGDOMAIN_ETSI, {'L', 'K'}}, /* SRI-LANKA */
|
|
|
- {REGDOMAIN_ETSI, {'L', 'T'}}, /* LITHUANIA */
|
|
|
- {REGDOMAIN_ETSI, {'L', 'U'}}, /* LUXEMBOURG */
|
|
|
- {REGDOMAIN_ETSI, {'L', 'V'}}, /* LATVIA */
|
|
|
- {REGDOMAIN_ETSI, {'M', 'A'}}, /* MOROCCO */
|
|
|
- {REGDOMAIN_ETSI, {'M', 'C'}}, /* MONACO */
|
|
|
- {REGDOMAIN_ETSI, {'M', 'K'}}, /* MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF */
|
|
|
- {REGDOMAIN_FCC, {'M', 'N'}}, /* MONGOLIA */
|
|
|
- {REGDOMAIN_FCC, {'M', 'O'}}, /* MACAO */
|
|
|
- {REGDOMAIN_FCC, {'M', 'P'}}, /* NORTHERN MARIANA ISLANDS */
|
|
|
- {REGDOMAIN_ETSI, {'M', 'Q'}}, /* MARTINIQUE */
|
|
|
- {REGDOMAIN_FCC, {'M', 'T'}}, /* MALTA */
|
|
|
- {REGDOMAIN_ETSI, {'M', 'U'}}, /* MAURITIUS */
|
|
|
- {REGDOMAIN_ETSI, {'M', 'W'}}, /* MALAWI */
|
|
|
- {REGDOMAIN_FCC, {'M', 'X'}}, /* MEXICO */
|
|
|
- {REGDOMAIN_ETSI, {'M', 'Y'}}, /* MALAYSIA */
|
|
|
- {REGDOMAIN_ETSI, {'N', 'G'}}, /* NIGERIA */
|
|
|
- {REGDOMAIN_FCC, {'N', 'I'}}, /* NICARAGUA */
|
|
|
- {REGDOMAIN_ETSI, {'N', 'L'}}, /* NETHERLANDS */
|
|
|
- {REGDOMAIN_ETSI, {'N', 'O'}}, /* NORWAY */
|
|
|
- {REGDOMAIN_ETSI, {'N', 'P'}}, /* NEPAL */
|
|
|
- {REGDOMAIN_FCC, {'N', 'Z'}}, /* NEW-ZEALAND */
|
|
|
- {REGDOMAIN_FCC, {'O', 'M'}}, /* OMAN */
|
|
|
- {REGDOMAIN_FCC, {'P', 'A'}}, /* PANAMA */
|
|
|
- {REGDOMAIN_ETSI, {'P', 'E'}}, /* PERU */
|
|
|
- {REGDOMAIN_ETSI, {'P', 'F'}}, /* FRENCH POLYNESIA */
|
|
|
- {REGDOMAIN_ETSI, {'P', 'G'}}, /* PAPUA NEW GUINEA */
|
|
|
- {REGDOMAIN_FCC, {'P', 'H'}}, /* PHILIPPINES */
|
|
|
- {REGDOMAIN_ETSI, {'P', 'K'}}, /* PAKISTAN */
|
|
|
- {REGDOMAIN_ETSI, {'P', 'L'}}, /* POLAND */
|
|
|
- {REGDOMAIN_FCC, {'P', 'R'}}, /* PUERTO RICO */
|
|
|
- {REGDOMAIN_FCC, {'P', 'S'}}, /* PALESTINIAN TERRITORY, OCCUPIED */
|
|
|
- {REGDOMAIN_ETSI, {'P', 'T'}}, /* PORTUGAL */
|
|
|
- {REGDOMAIN_FCC, {'P', 'Y'}}, /* PARAGUAY */
|
|
|
- {REGDOMAIN_ETSI, {'Q', 'A'}}, /* QATAR */
|
|
|
- {REGDOMAIN_ETSI, {'R', 'E'}}, /* REUNION */
|
|
|
- {REGDOMAIN_ETSI, {'R', 'O'}}, /* ROMAINIA */
|
|
|
- {REGDOMAIN_ETSI, {'R', 'S'}}, /* SERBIA */
|
|
|
- {REGDOMAIN_ETSI, {'R', 'U'}}, /* RUSSIA */
|
|
|
- {REGDOMAIN_FCC, {'R', 'W'}}, /* RWANDA */
|
|
|
- {REGDOMAIN_ETSI, {'S', 'A'}}, /* SAUDI ARABIA */
|
|
|
- {REGDOMAIN_ETSI, {'S', 'E'}}, /* SWEDEN */
|
|
|
- {REGDOMAIN_ETSI, {'S', 'G'}}, /* SINGAPORE */
|
|
|
- {REGDOMAIN_ETSI, {'S', 'I'}}, /* SLOVENNIA */
|
|
|
- {REGDOMAIN_ETSI, {'S', 'K'}}, /* SLOVAKIA */
|
|
|
- {REGDOMAIN_ETSI, {'S', 'V'}}, /* EL SALVADOR */
|
|
|
- {REGDOMAIN_ETSI, {'S', 'Y'}}, /* SYRIAN ARAB REPUBLIC */
|
|
|
- {REGDOMAIN_ETSI, {'T', 'H'}}, /* THAILAND */
|
|
|
- {REGDOMAIN_ETSI, {'T', 'N'}}, /* TUNISIA */
|
|
|
- {REGDOMAIN_ETSI, {'T', 'R'}}, /* TURKEY */
|
|
|
- {REGDOMAIN_ETSI, {'T', 'T'}}, /* TRINIDAD AND TOBAGO */
|
|
|
- {REGDOMAIN_FCC, {'T', 'W'}}, /* TAIWAN, PRIVINCE OF CHINA */
|
|
|
- {REGDOMAIN_FCC, {'T', 'Z'}}, /* TANZANIA, UNITED REPUBLIC OF */
|
|
|
- {REGDOMAIN_ETSI, {'U', 'A'}}, /* UKRAINE */
|
|
|
- {REGDOMAIN_ETSI, {'U', 'G'}}, /* UGANDA */
|
|
|
- {REGDOMAIN_FCC, {'U', 'S'}}, /* USA */
|
|
|
- {REGDOMAIN_ETSI, {'U', 'Y'}}, /* URUGUAY */
|
|
|
- {REGDOMAIN_FCC, {'U', 'Z'}}, /* UZBEKISTAN */
|
|
|
- {REGDOMAIN_ETSI, {'V', 'E'}}, /* VENEZUELA */
|
|
|
- {REGDOMAIN_FCC, {'V', 'I'}}, /* VIRGIN ISLANDS, US */
|
|
|
- {REGDOMAIN_ETSI, {'V', 'N'}}, /* VIETNAM */
|
|
|
- {REGDOMAIN_ETSI, {'Y', 'E'}}, /* YEMEN */
|
|
|
- {REGDOMAIN_ETSI, {'Y', 'T'}}, /* MAYOTTE */
|
|
|
- {REGDOMAIN_ETSI, {'Z', 'A'}}, /* SOUTH AFRICA */
|
|
|
- {REGDOMAIN_ETSI, {'Z', 'W'}}, /* ZIMBABWE */
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
const tRfChannelProps rf_channels[NUM_RF_CHANNELS] = {
|
|
|
{2412, 1},
|
|
|
{2417, 2},
|
|
@@ -390,14 +228,10 @@ const tRfChannelProps rf_channels[NUM_RF_CHANNELS] = {
|
|
|
{5755, 151},
|
|
|
{5775, 155},
|
|
|
{5795, 159},
|
|
|
- {5815, 163, },
|
|
|
+ {5815, 163},
|
|
|
};
|
|
|
|
|
|
-static t_reg_table reg_table;
|
|
|
-
|
|
|
-const sRegulatoryChannel *reg_channels =
|
|
|
- reg_table.regDomains[0].channels;
|
|
|
-
|
|
|
+sRegulatoryChannel reg_channels[NUM_RF_CHANNELS];
|
|
|
|
|
|
/**
|
|
|
* cds_is_wwr_sku() - is regdomain world sku
|
|
@@ -616,17 +450,25 @@ CDF_STATUS cds_get_channel_list_with_power(tChannelListWithPower *
|
|
|
*/
|
|
|
CDF_STATUS cds_read_default_country(country_code_t default_country)
|
|
|
{
|
|
|
- CDF_STATUS status = CDF_STATUS_SUCCESS;
|
|
|
+ hdd_context_t *hdd_ctx;
|
|
|
+
|
|
|
+ hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
+ if (!hdd_ctx) {
|
|
|
+ CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
|
+ "invalid hdd_ctx pointer");
|
|
|
+ return CDF_STATUS_E_FAULT;
|
|
|
+ }
|
|
|
|
|
|
memcpy(default_country,
|
|
|
- reg_table.default_country,
|
|
|
+ hdd_ctx->reg.def_country,
|
|
|
sizeof(country_code_t));
|
|
|
|
|
|
- pr_info("DefaultCountry is %c%c\n",
|
|
|
- default_country[0],
|
|
|
- default_country[1]);
|
|
|
+ CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_INFO,
|
|
|
+ "default country is %c%c\n",
|
|
|
+ default_country[0],
|
|
|
+ default_country[1]);
|
|
|
|
|
|
- return status;
|
|
|
+ return CDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -791,31 +633,31 @@ static int cds_bw20_ch_index_to_bw40_ch_index(int k)
|
|
|
*/
|
|
|
CDF_STATUS cds_set_dfs_region(uint8_t dfs_region)
|
|
|
{
|
|
|
- hdd_context_t *hdd_ctx_ptr = NULL;
|
|
|
+ hdd_context_t *hdd_ctx;
|
|
|
|
|
|
- hdd_ctx_ptr = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
+ hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
|
|
|
- if (NULL == hdd_ctx_ptr)
|
|
|
+ if (NULL == hdd_ctx)
|
|
|
return CDF_STATUS_E_EXISTS;
|
|
|
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
|
|
|
- hdd_ctx_ptr->reg.dfs_region = dfs_region;
|
|
|
+ hdd_ctx->reg.dfs_region = dfs_region;
|
|
|
#else
|
|
|
|
|
|
/* remap the ctl code to dfs region code */
|
|
|
- switch (hdd_ctx_ptr->reg.ctl_5g) {
|
|
|
+ switch (hdd_ctx->reg.ctl_5g) {
|
|
|
case FCC:
|
|
|
- hdd_ctx_ptr->reg.dfs_region = DFS_FCC_DOMAIN;
|
|
|
+ hdd_ctx->reg.dfs_region = DFS_FCC_DOMAIN;
|
|
|
break;
|
|
|
case ETSI:
|
|
|
- hdd_ctx_ptr->reg.dfs_region = DFS_ETSI_DOMAIN;
|
|
|
+ hdd_ctx->reg.dfs_region = DFS_ETSI_DOMAIN;
|
|
|
break;
|
|
|
case MKK:
|
|
|
- hdd_ctx_ptr->reg.dfs_region = DFS_MKK4_DOMAIN;
|
|
|
+ hdd_ctx->reg.dfs_region = DFS_MKK4_DOMAIN;
|
|
|
break;
|
|
|
default:
|
|
|
/* set default dfs_region to FCC */
|
|
|
- hdd_ctx_ptr->reg.dfs_region = DFS_FCC_DOMAIN;
|
|
|
+ hdd_ctx->reg.dfs_region = DFS_FCC_DOMAIN;
|
|
|
break;
|
|
|
}
|
|
|
#endif
|
|
@@ -831,14 +673,14 @@ CDF_STATUS cds_set_dfs_region(uint8_t dfs_region)
|
|
|
*/
|
|
|
CDF_STATUS cds_get_dfs_region(uint8_t *dfs_region)
|
|
|
{
|
|
|
- hdd_context_t *hdd_ctx_ptr = NULL;
|
|
|
+ hdd_context_t *hdd_ctx;
|
|
|
|
|
|
- hdd_ctx_ptr = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
+ hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
|
|
|
- if (NULL == hdd_ctx_ptr)
|
|
|
+ if (NULL == hdd_ctx)
|
|
|
return CDF_STATUS_E_EXISTS;
|
|
|
|
|
|
- *dfs_region = hdd_ctx_ptr->reg.dfs_region;
|
|
|
+ *dfs_region = hdd_ctx->reg.dfs_region;
|
|
|
|
|
|
return CDF_STATUS_SUCCESS;
|
|
|
}
|
|
@@ -856,10 +698,8 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
|
|
|
country_code,
|
|
|
v_CountryInfoSource_t source)
|
|
|
{
|
|
|
- v_CONTEXT_t cds_context = NULL;
|
|
|
hdd_context_t *hdd_ctx = NULL;
|
|
|
struct wiphy *wiphy = NULL;
|
|
|
- int i;
|
|
|
|
|
|
if (NULL == reg_domain_ptr) {
|
|
|
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
@@ -867,7 +707,10 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
|
|
|
return CDF_STATUS_E_FAULT;
|
|
|
}
|
|
|
|
|
|
- *reg_domain_ptr = REGDOMAIN_COUNT;
|
|
|
+ *reg_domain_ptr = 0;
|
|
|
+
|
|
|
+ if (COUNTRY_QUERY == source)
|
|
|
+ return CDF_STATUS_SUCCESS;
|
|
|
|
|
|
if (NULL == country_code) {
|
|
|
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
@@ -875,18 +718,13 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
|
|
|
return CDF_STATUS_E_FAULT;
|
|
|
}
|
|
|
|
|
|
- if (0 == country_info_table.countryCount) {
|
|
|
+ if (cds_is_driver_recovering()) {
|
|
|
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
|
- ("Reg domain table is empty"));
|
|
|
- return CDF_STATUS_E_EMPTY;
|
|
|
+ "SSR in progress, return");
|
|
|
+ return CDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
- cds_context = cds_get_global_context();
|
|
|
-
|
|
|
- if (NULL != cds_context)
|
|
|
- hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
- else
|
|
|
- return CDF_STATUS_E_EXISTS;
|
|
|
+ hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
|
|
|
if (NULL == hdd_ctx) {
|
|
|
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
@@ -896,37 +734,6 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
|
|
|
|
|
|
wiphy = hdd_ctx->wiphy;
|
|
|
|
|
|
- if (cds_is_driver_recovering()) {
|
|
|
- CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
|
- "SSR in progress, return");
|
|
|
- *reg_domain_ptr = temp_reg_domain;
|
|
|
- return CDF_STATUS_SUCCESS;
|
|
|
- }
|
|
|
-
|
|
|
- temp_reg_domain = REGDOMAIN_COUNT;
|
|
|
- for (i = 0; i < country_info_table.countryCount &&
|
|
|
- REGDOMAIN_COUNT == temp_reg_domain; i++) {
|
|
|
- if (memcmp(country_code,
|
|
|
- country_info_table.countryInfo[i].countryCode,
|
|
|
- CDS_COUNTRY_CODE_LEN) == 0) {
|
|
|
-
|
|
|
- temp_reg_domain =
|
|
|
- country_info_table.countryInfo[i].regDomain;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (REGDOMAIN_COUNT == temp_reg_domain) {
|
|
|
- CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
|
- ("Country does not map to any Regulatory domain"));
|
|
|
- temp_reg_domain = REGDOMAIN_WORLD;
|
|
|
- }
|
|
|
-
|
|
|
- if (COUNTRY_QUERY == source) {
|
|
|
- *reg_domain_ptr = temp_reg_domain;
|
|
|
- return CDF_STATUS_SUCCESS;
|
|
|
- }
|
|
|
-
|
|
|
if ((COUNTRY_INIT == source) && (false == init_by_reg_core)) {
|
|
|
init_by_driver = true;
|
|
|
if (('0' != country_code[0]) || ('0' != country_code[1])) {
|
|
@@ -940,7 +747,6 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
|
|
|
NL80211_USER_REG_HINT_USER);
|
|
|
}
|
|
|
|
|
|
- *reg_domain_ptr = temp_reg_domain;
|
|
|
return CDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
@@ -981,7 +787,8 @@ bool cds_is_dsrc_channel(uint16_t center_freq)
|
|
|
* Return: int
|
|
|
*/
|
|
|
static int cds_process_regulatory_data(struct wiphy *wiphy,
|
|
|
- uint8_t band_capability, bool reset)
|
|
|
+ uint8_t band_capability,
|
|
|
+ bool reset)
|
|
|
{
|
|
|
int i, j, m;
|
|
|
int k = 0, n = 0;
|
|
@@ -1028,13 +835,8 @@ static int cds_process_regulatory_data(struct wiphy *wiphy,
|
|
|
n = cds_bw20_ch_index_to_bw40_ch_index(k);
|
|
|
|
|
|
chan = &(wiphy->bands[i]->channels[j]);
|
|
|
- temp_chan_k =
|
|
|
- &(reg_table.regDomains[temp_reg_domain].
|
|
|
- channels[k]);
|
|
|
-
|
|
|
- temp_chan_n =
|
|
|
- &(reg_table.regDomains[temp_reg_domain].
|
|
|
- channels[n]);
|
|
|
+ temp_chan_k = &(reg_channels[k]);
|
|
|
+ temp_chan_n = &(reg_channels[n]);
|
|
|
|
|
|
if ((!reset) &&
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
|
|
@@ -1173,8 +975,7 @@ static int cds_process_regulatory_data(struct wiphy *wiphy,
|
|
|
|
|
|
if (0 == (hdd_ctx->reg.eeprom_rd_ext &
|
|
|
(1 << WHAL_REG_EXT_FCC_CH_144))) {
|
|
|
- temp_chan = &(reg_table.regDomains[temp_reg_domain].
|
|
|
- channels[RF_CHAN_144]);
|
|
|
+ temp_chan = &(reg_channels[RF_CHAN_144]);
|
|
|
temp_chan->enabled =
|
|
|
CHANNEL_STATE_DISABLE;
|
|
|
}
|
|
@@ -1225,8 +1026,6 @@ void __hdd_reg_notifier(struct wiphy *wiphy,
|
|
|
{
|
|
|
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
|
|
|
eCsrBand band_capability = eCSR_BAND_ALL;
|
|
|
- country_code_t country_code;
|
|
|
- int i;
|
|
|
bool vht80_allowed;
|
|
|
bool reset = false;
|
|
|
|
|
@@ -1288,9 +1087,9 @@ void __hdd_reg_notifier(struct wiphy *wiphy,
|
|
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
|
|
|
if (wiphy->regulatory_flags & REGULATORY_CUSTOM_REG)
|
|
|
#else
|
|
|
- if (wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
|
|
|
+ if (wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)
|
|
|
#endif
|
|
|
- reset = true;
|
|
|
+ reset = true;
|
|
|
} else if (NL80211_REGDOM_SET_BY_DRIVER == request->initiator)
|
|
|
hdd_ctx->reg.cc_src = COUNTRY_CODE_SET_BY_DRIVER;
|
|
|
else {
|
|
@@ -1305,31 +1104,11 @@ void __hdd_reg_notifier(struct wiphy *wiphy,
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
- /* first lookup the country in the local database */
|
|
|
- country_code[0] = request->alpha2[0];
|
|
|
- country_code[1] = request->alpha2[1];
|
|
|
-
|
|
|
hdd_ctx->reg.alpha2[0] = request->alpha2[0];
|
|
|
hdd_ctx->reg.alpha2[1] = request->alpha2[1];
|
|
|
|
|
|
cds_update_regulatory_info(hdd_ctx);
|
|
|
|
|
|
- temp_reg_domain = REGDOMAIN_COUNT;
|
|
|
- for (i = 0; i < country_info_table.countryCount &&
|
|
|
- REGDOMAIN_COUNT == temp_reg_domain; i++) {
|
|
|
- if (memcmp(country_code,
|
|
|
- country_info_table.countryInfo[i].countryCode,
|
|
|
- CDS_COUNTRY_CODE_LEN) == 0) {
|
|
|
-
|
|
|
- temp_reg_domain =
|
|
|
- country_info_table.countryInfo[i].regDomain;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (REGDOMAIN_COUNT == temp_reg_domain)
|
|
|
- temp_reg_domain = REGDOMAIN_WORLD;
|
|
|
-
|
|
|
vht80_allowed = hdd_ctx->isVHT80Allowed;
|
|
|
if (cds_process_regulatory_data(wiphy, band_capability,
|
|
|
reset) == 0) {
|
|
@@ -1342,16 +1121,8 @@ void __hdd_reg_notifier(struct wiphy *wiphy,
|
|
|
if (NL80211_REGDOM_SET_BY_DRIVER == request->initiator)
|
|
|
complete(&hdd_ctx->reg_init);
|
|
|
|
|
|
- if (request->alpha2[0] == '0'
|
|
|
- && request->alpha2[1] == '0') {
|
|
|
- sme_generic_change_country_code(hdd_ctx->hHal,
|
|
|
- country_code,
|
|
|
- REGDOMAIN_COUNT);
|
|
|
- } else {
|
|
|
- sme_generic_change_country_code(hdd_ctx->hHal,
|
|
|
- country_code,
|
|
|
- temp_reg_domain);
|
|
|
- }
|
|
|
+ sme_generic_change_country_code(hdd_ctx->hHal,
|
|
|
+ hdd_ctx->reg.alpha2);
|
|
|
|
|
|
cds_fill_and_send_ctl_to_fw(&hdd_ctx->reg);
|
|
|
|
|
@@ -1386,21 +1157,15 @@ void hdd_reg_notifier(struct wiphy *wiphy,
|
|
|
*/
|
|
|
CDF_STATUS cds_regulatory_init(void)
|
|
|
{
|
|
|
- v_CONTEXT_t cds_context = NULL;
|
|
|
hdd_context_t *hdd_ctx = NULL;
|
|
|
struct wiphy *wiphy = NULL;
|
|
|
int ret_val = 0;
|
|
|
struct regulatory *reg_info;
|
|
|
|
|
|
- cds_context = cds_get_global_context();
|
|
|
-
|
|
|
- if (!cds_context)
|
|
|
- return CDF_STATUS_E_FAULT;
|
|
|
-
|
|
|
hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
|
|
|
if (!hdd_ctx) {
|
|
|
CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
|
|
|
- ("Invalid pHddCtx pointer"));
|
|
|
+ "invalid hdd_ctx pointer");
|
|
|
return CDF_STATUS_E_FAULT;
|
|
|
}
|
|
|
|
|
@@ -1410,8 +1175,6 @@ CDF_STATUS cds_regulatory_init(void)
|
|
|
|
|
|
cds_regulatory_wiphy_init(hdd_ctx, reg_info, wiphy);
|
|
|
|
|
|
- temp_reg_domain = REGDOMAIN_WORLD;
|
|
|
-
|
|
|
if (cds_process_regulatory_data(wiphy,
|
|
|
hdd_ctx->config->
|
|
|
nBandCapability, true) != 0) {
|
|
@@ -1428,8 +1191,8 @@ CDF_STATUS cds_regulatory_init(void)
|
|
|
return ret_val;
|
|
|
}
|
|
|
|
|
|
- reg_table.default_country[0] = reg_info->alpha2[0];
|
|
|
- reg_table.default_country[1] = reg_info->alpha2[1];
|
|
|
+ hdd_ctx->reg.def_country[0] = reg_info->alpha2[0];
|
|
|
+ hdd_ctx->reg.def_country[1] = reg_info->alpha2[1];
|
|
|
|
|
|
init_completion(&hdd_ctx->reg_init);
|
|
|
|
|
@@ -1454,8 +1217,6 @@ CDF_STATUS cds_set_reg_domain(void *client_ctxt, v_REGDOMAIN_t reg_domain)
|
|
|
return CDF_STATUS_E_INVAL;
|
|
|
}
|
|
|
|
|
|
- reg_channels = reg_table.regDomains[reg_domain].channels;
|
|
|
-
|
|
|
return CDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|