qcacmn: Support 11d for non-offload platform
Support 11d for non-offload platform by maintaining count of beacons encountered for each country code and choosing country code with max votes as device's country code. Change-Id: I83b66e980854eded17e254386561fa32b1f8c4ac CRs-Fixed: 2154048
This commit is contained in:

gecommit door
snandini

bovenliggende
e6d32a9f38
commit
ca6152167b
@@ -843,7 +843,8 @@ QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev,
|
||||
reg_channels = pdev_priv_obj->cur_chan_list;
|
||||
|
||||
for (i = 0, count = 0; i < NUM_CHANNELS; i++) {
|
||||
if (reg_channels[i].state) {
|
||||
if (reg_channels[i].state &&
|
||||
reg_channels[i].state != REGULATORY_CHAN_DISABLED) {
|
||||
ch_list[count].chan_num =
|
||||
reg_channels[i].chan_num;
|
||||
ch_list[count++].tx_power =
|
||||
@@ -1376,6 +1377,22 @@ QDF_STATUS reg_set_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bool reg_is_world_alpha2(uint8_t *alpha2)
|
||||
{
|
||||
if ((alpha2[0] == '0') && (alpha2[1] == '0'))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool reg_is_us_alpha2(uint8_t *alpha2)
|
||||
{
|
||||
if ((alpha2[0] == 'U') && (alpha2[1] == 'S'))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *country)
|
||||
{
|
||||
@@ -1430,6 +1447,55 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *country)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_reg;
|
||||
struct set_country country_code;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
struct cc_regdmn_s rd;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!country) {
|
||||
reg_err("country code is NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
psoc = wlan_pdev_get_psoc(pdev);
|
||||
psoc_reg = reg_get_psoc_obj(psoc);
|
||||
if (!IS_VALID_PSOC_REG_OBJ(psoc_reg)) {
|
||||
reg_err("psoc reg component is NULL");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
if (!qdf_mem_cmp(psoc_reg->cur_country,
|
||||
country, REG_ALPHA2_LEN)) {
|
||||
reg_debug("country is not different");
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
reg_info("programming new 11d country:%c%c to firmware",
|
||||
country[0], country[1]);
|
||||
|
||||
qdf_mem_copy(country_code.country,
|
||||
country, REG_ALPHA2_LEN + 1);
|
||||
country_code.pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
||||
|
||||
psoc_reg->new_11d_ctry_pending = true;
|
||||
|
||||
if (psoc_reg->offload_enabled) {
|
||||
reg_err("reg offload, 11d offload too!");
|
||||
status = QDF_STATUS_E_FAULT;
|
||||
} else {
|
||||
qdf_mem_copy(rd.cc.alpha, country, REG_ALPHA2_LEN + 1);
|
||||
rd.flags = ALPHA_IS_SET;
|
||||
reg_program_chan_list(pdev, &rd);
|
||||
status = QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_reset_country(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_reg;
|
||||
@@ -1864,9 +1930,16 @@ static void reg_populate_band_channels(enum channel_enum start_chan,
|
||||
|
||||
if (found_rule_ptr) {
|
||||
mas_chan_list[chan_enum].max_bw = bw;
|
||||
|
||||
reg_fill_channel_info(chan_enum, found_rule_ptr,
|
||||
mas_chan_list, min_bw);
|
||||
/* Disable 2.4 Ghz channels that dont have 20 mhz bw */
|
||||
if (start_chan == MIN_24GHZ_CHANNEL &&
|
||||
20 > mas_chan_list[chan_enum].max_bw) {
|
||||
mas_chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
mas_chan_list[chan_enum].state =
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3967,6 +4040,23 @@ QDF_STATUS reg_save_new_11d_country(struct wlan_objmgr_psoc *psoc,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bool reg_11d_original_enabled_on_host(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
|
||||
psoc_priv_obj =
|
||||
wlan_objmgr_psoc_get_comp_private_obj(psoc,
|
||||
WLAN_UMAC_COMP_REGULATORY);
|
||||
|
||||
if (NULL == psoc_priv_obj) {
|
||||
reg_err("reg psoc private obj is NULL");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
return (psoc_priv_obj->enable_11d_supp_original &&
|
||||
!psoc_priv_obj->is_11d_offloaded);
|
||||
}
|
||||
|
||||
bool reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
|
@@ -164,6 +164,22 @@ QDF_STATUS reg_read_current_country(struct wlan_objmgr_psoc *psoc,
|
||||
QDF_STATUS reg_set_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country);
|
||||
|
||||
/**
|
||||
* reg_is_world_alpha2 - is reg world mode
|
||||
* @alpha2: country code pointer
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool reg_is_world_alpha2(uint8_t *alpha2);
|
||||
|
||||
/**
|
||||
* reg_is_us_alpha2 - is US country code
|
||||
* @alpha2: country code pointer
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool reg_is_us_alpha2(uint8_t *alpha2);
|
||||
|
||||
/**
|
||||
* reg_set_country() - Set the current regulatory country
|
||||
* @pdev: pdev device for country information
|
||||
@@ -173,6 +189,15 @@ QDF_STATUS reg_set_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
*/
|
||||
QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev, uint8_t *country);
|
||||
|
||||
/**
|
||||
* reg_set_11d_country() - Set the 11d regulatory country
|
||||
* @pdev: pdev device for country information
|
||||
* @country: country value
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_set_11d_country(struct wlan_objmgr_pdev *pdev, uint8_t *country);
|
||||
|
||||
/**
|
||||
* reg_reset_country() - Reset the regulatory country to default
|
||||
* @psoc: The physical SoC to reset country for
|
||||
@@ -336,6 +361,14 @@ enum country_src reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
|
||||
QDF_STATUS reg_save_new_11d_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country);
|
||||
|
||||
/**
|
||||
* reg_11d_original_enabled_on_host() - whether 11d original enabled on host
|
||||
* @psoc: psoc ptr
|
||||
*
|
||||
* Return: bool
|
||||
*/
|
||||
bool reg_11d_original_enabled_on_host(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* reg_11d_enabled_on_host() - know whether 11d enabled on host
|
||||
* @psoc: psoc ptr
|
||||
|
@@ -372,6 +372,21 @@ uint32_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
|
||||
*/
|
||||
uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan);
|
||||
/**
|
||||
* wlan_reg_is_world() - reg is world mode
|
||||
* @country: The country information
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_world(uint8_t *country);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_us() - reg is us country
|
||||
* @country: The country information
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_us(uint8_t *country);
|
||||
|
||||
/**
|
||||
* wlan_reg_set_country() - Set the current regulatory country
|
||||
@@ -381,7 +396,17 @@ uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *country);
|
||||
uint8_t *country);
|
||||
|
||||
/**
|
||||
* wlan_reg_set_11d_country() - Set the 11d regulatory country
|
||||
* @pdev: The physical dev to set current country for
|
||||
* @country: The country information to configure
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *country);
|
||||
|
||||
/**
|
||||
* wlan_reg_register_chan_change_callback () - add chan change cbk
|
||||
@@ -404,6 +429,15 @@ void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
*/
|
||||
void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk);
|
||||
|
||||
/**
|
||||
* wlan_reg_11d_original_enabled_on_host() - 11d original enabled don host
|
||||
* @psoc: psoc ptr
|
||||
*
|
||||
* Return: bool
|
||||
*/
|
||||
bool wlan_reg_11d_original_enabled_on_host(struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* wlan_reg_11d_enabled_on_host() - 11d enabled don host
|
||||
* @psoc: psoc ptr
|
||||
|
@@ -451,6 +451,22 @@ QDF_STATUS wlan_reg_set_country(struct wlan_objmgr_pdev *pdev,
|
||||
return reg_set_country(pdev, country);
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *country)
|
||||
{
|
||||
return reg_set_11d_country(pdev, country);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_world(uint8_t *country)
|
||||
{
|
||||
return reg_is_world_alpha2(country);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_us(uint8_t *country)
|
||||
{
|
||||
return reg_is_us_alpha2(country);
|
||||
}
|
||||
|
||||
void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk,
|
||||
void *arg)
|
||||
@@ -465,6 +481,11 @@ void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_unregister_chan_change_callback(psoc, cbk);
|
||||
}
|
||||
|
||||
bool wlan_reg_11d_original_enabled_on_host(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return reg_11d_original_enabled_on_host(psoc);
|
||||
}
|
||||
|
||||
bool wlan_reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
return reg_11d_enabled_on_host(psoc);
|
||||
|
Verwijs in nieuw issue
Block a user