qcacmn: Move partial offload regulatory under macro
Create macro WLAN_REG_PARTIAL_OFFLOAD and move partial offload regulatory code under it. Change-Id: If37798abb86deee0bef6e339577da797342c31a4
This commit is contained in:

committed by
Madan Koyyalamudi

parent
b297cc18f2
commit
ac8933ef2e
@@ -1478,10 +1478,12 @@ struct wlan_lmac_if_reg_rx_ops {
|
||||
QDF_STATUS (*reg_set_chan_144)(struct wlan_objmgr_pdev *pdev,
|
||||
bool enable_ch_144);
|
||||
bool (*reg_get_chan_144)(struct wlan_objmgr_pdev *pdev);
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS (*reg_program_default_cc)(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn);
|
||||
QDF_STATUS (*reg_get_current_regdomain)(struct wlan_objmgr_pdev *pdev,
|
||||
struct cur_regdmn_info *cur_regdmn);
|
||||
#endif
|
||||
QDF_STATUS (*reg_enable_dfs_channels)(struct wlan_objmgr_pdev *pdev,
|
||||
bool dfs_enable);
|
||||
QDF_STATUS (*reg_modify_pdev_chan_range)(struct
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -338,6 +338,30 @@ static inline void wlan_lmac_if_register_6g_edge_chan_supp(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
/**
|
||||
* wlan_lmac_if_umac_reg_rx_ops_register_po() - Function to register Reg RX ops
|
||||
* for Partial Offload
|
||||
* rx_ops: Pointer to wlan_lmac_if_dfs_rx_ops
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
static void wlan_lmac_if_umac_reg_rx_ops_register_po(
|
||||
struct wlan_lmac_if_rx_ops *rx_ops)
|
||||
{
|
||||
rx_ops->reg_rx_ops.reg_program_default_cc =
|
||||
ucfg_reg_program_default_cc;
|
||||
|
||||
rx_ops->reg_rx_ops.reg_get_current_regdomain =
|
||||
wlan_reg_get_curr_regdomain;
|
||||
}
|
||||
#else
|
||||
static void wlan_lmac_if_umac_reg_rx_ops_register_po(
|
||||
struct wlan_lmac_if_rx_ops *rx_ops)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static void wlan_lmac_if_umac_reg_rx_ops_register(
|
||||
struct wlan_lmac_if_rx_ops *rx_ops)
|
||||
{
|
||||
@@ -376,11 +400,7 @@ static void wlan_lmac_if_umac_reg_rx_ops_register(
|
||||
rx_ops->reg_rx_ops.reg_get_chan_144 =
|
||||
ucfg_reg_get_en_chan_144;
|
||||
|
||||
rx_ops->reg_rx_ops.reg_program_default_cc =
|
||||
ucfg_reg_program_default_cc;
|
||||
|
||||
rx_ops->reg_rx_ops.reg_get_current_regdomain =
|
||||
wlan_reg_get_curr_regdomain;
|
||||
wlan_lmac_if_umac_reg_rx_ops_register_po(rx_ops);
|
||||
|
||||
rx_ops->reg_rx_ops.reg_enable_dfs_channels =
|
||||
ucfg_reg_enable_dfs_channels;
|
||||
|
@@ -2768,6 +2768,7 @@ static void reg_store_regulatory_ext_info_to_socpriv(
|
||||
regulat_info->reg_dmn_pair;
|
||||
soc_reg->mas_chan_params[phy_id].reg_6g_superid =
|
||||
regulat_info->domain_code_6g_super_id;
|
||||
soc_reg->mas_chan_params[phy_id].max_bw_5g = regulat_info->max_bw_5g;
|
||||
qdf_mem_copy(soc_reg->mas_chan_params[phy_id].current_country,
|
||||
regulat_info->alpha2,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
@@ -3928,7 +3929,7 @@ QDF_STATUS reg_process_master_chan_list(
|
||||
num_5g_reg_rules = regulat_info->num_5g_reg_rules;
|
||||
reg_update_max_bw_per_rule(num_5g_reg_rules,
|
||||
reg_rule_5g, max_bw_5g);
|
||||
|
||||
soc_reg->mas_chan_params[phy_id].max_bw_5g = regulat_info->max_bw_5g;
|
||||
reg_rules = &soc_reg->mas_chan_params[phy_id].reg_rules;
|
||||
reg_reset_reg_rules(reg_rules);
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -2056,13 +2056,6 @@ QDF_STATUS reg_get_num_reg_dmn_pairs(int *num_reg_dmn)
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_get_default_country(uint16_t *default_country)
|
||||
{
|
||||
*default_country = CTRY_UNITED_STATES;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bool reg_etsi13_regdmn(uint8_t reg_dmn)
|
||||
{
|
||||
return reg_dmn == ETSI13;
|
||||
@@ -2076,6 +2069,14 @@ bool reg_fcc_regdmn(uint8_t reg_dmn)
|
||||
(reg_dmn == FCC16));
|
||||
}
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS reg_get_default_country(uint16_t *default_country)
|
||||
{
|
||||
*default_country = CTRY_UNITED_STATES;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bool reg_en302_502_regdmn(uint16_t regdmn)
|
||||
{
|
||||
return ((regdmn == ETSI11_WORLD) ||
|
||||
@@ -2083,3 +2084,4 @@ bool reg_en302_502_regdmn(uint16_t regdmn)
|
||||
(regdmn == ETSI14_WORLD) ||
|
||||
(regdmn == ETSI15_WORLD));
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -222,8 +222,6 @@ QDF_STATUS reg_get_num_countries(int *num_countries);
|
||||
|
||||
QDF_STATUS reg_get_num_reg_dmn_pairs(int *num_reg_dmn);
|
||||
|
||||
QDF_STATUS reg_get_default_country(uint16_t *default_country);
|
||||
|
||||
/**
|
||||
* reg_etsi13_regdmn () - Checks if the reg domain is ETSI13 or not
|
||||
* @reg_dmn: reg domain
|
||||
@@ -240,6 +238,9 @@ bool reg_etsi13_regdmn(uint8_t reg_dmn);
|
||||
*/
|
||||
bool reg_fcc_regdmn(uint8_t reg_dmn);
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS reg_get_default_country(uint16_t *default_country);
|
||||
|
||||
/**
|
||||
* reg_en302_502_regdmn() - Check if the reg domain is en302_502 applicable.
|
||||
* @reg_dmn: Regulatory domain pair ID.
|
||||
@@ -248,3 +249,4 @@ bool reg_fcc_regdmn(uint8_t reg_dmn);
|
||||
*/
|
||||
bool reg_en302_502_regdmn(uint16_t reg_dmn);
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -32,6 +33,51 @@
|
||||
#include "reg_priv_objs.h"
|
||||
#include "reg_utils.h"
|
||||
|
||||
#ifdef CONFIG_REG_CLIENT
|
||||
/**
|
||||
* reg_update_alpha2_from_domain() - Get country alpha2 code from reg domain
|
||||
* @reg_info: pointer to hold alpha2 code
|
||||
*
|
||||
* This function is used to populate alpha2 of @reg_info with:
|
||||
* (a) "00" (REG_WORLD_ALPHA2) for WORLD domain and
|
||||
* (b) alpha2 of first country matching with non WORLD domain.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void
|
||||
reg_update_alpha2_from_domain(struct cur_regulatory_info *reg_info)
|
||||
{
|
||||
uint16_t i;
|
||||
int num_countries;
|
||||
|
||||
if (reg_is_world_ctry_code(reg_info->reg_dmn_pair)) {
|
||||
qdf_mem_copy(reg_info->alpha2, REG_WORLD_ALPHA2,
|
||||
sizeof(reg_info->alpha2));
|
||||
return;
|
||||
}
|
||||
|
||||
reg_get_num_countries(&num_countries);
|
||||
|
||||
for (i = 0; i < (uint16_t)num_countries; i++)
|
||||
if (g_all_countries[i].reg_dmn_pair_id ==
|
||||
reg_info->reg_dmn_pair)
|
||||
break;
|
||||
|
||||
if (i == (uint16_t)num_countries)
|
||||
return;
|
||||
|
||||
qdf_mem_copy(reg_info->alpha2, g_all_countries[i].alpha2,
|
||||
sizeof(g_all_countries[i].alpha2));
|
||||
reg_info->ctry_code = g_all_countries[i].country_code;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
reg_update_alpha2_from_domain(struct cur_regulatory_info *reg_info)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS reg_is_country_code_valid(uint8_t *alpha2)
|
||||
{
|
||||
uint16_t i;
|
||||
@@ -272,50 +318,6 @@ static inline QDF_STATUS reg_get_reginfo_from_country_code_and_regdmn_pair(
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_REG_CLIENT
|
||||
/**
|
||||
* reg_update_alpha2_from_domain() - Get country alpha2 code from reg domain
|
||||
* @reg_info: pointer to hold alpha2 code
|
||||
*
|
||||
* This function is used to populate alpha2 of @reg_info with:
|
||||
* (a) "00" (REG_WORLD_ALPHA2) for WORLD domain and
|
||||
* (b) alpha2 of first country matching with non WORLD domain.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void
|
||||
reg_update_alpha2_from_domain(struct cur_regulatory_info *reg_info)
|
||||
{
|
||||
uint16_t i;
|
||||
int num_countries;
|
||||
|
||||
if (reg_is_world_ctry_code(reg_info->reg_dmn_pair)) {
|
||||
qdf_mem_copy(reg_info->alpha2, REG_WORLD_ALPHA2,
|
||||
sizeof(reg_info->alpha2));
|
||||
return;
|
||||
}
|
||||
|
||||
reg_get_num_countries(&num_countries);
|
||||
|
||||
for (i = 0; i < (uint16_t)num_countries; i++)
|
||||
if (g_all_countries[i].reg_dmn_pair_id ==
|
||||
reg_info->reg_dmn_pair)
|
||||
break;
|
||||
|
||||
if (i == (uint16_t)num_countries)
|
||||
return;
|
||||
|
||||
qdf_mem_copy(reg_info->alpha2, g_all_countries[i].alpha2,
|
||||
sizeof(g_all_countries[i].alpha2));
|
||||
reg_info->ctry_code = g_all_countries[i].country_code;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
reg_update_alpha2_from_domain(struct cur_regulatory_info *reg_info)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline QDF_STATUS reg_get_reginfo_from_regdmn_pair(
|
||||
struct cur_regulatory_info *reg_info,
|
||||
uint16_t regdmn_pair)
|
||||
@@ -398,3 +400,4 @@ QDF_STATUS reg_get_cur_reginfo(struct cur_regulatory_info *reg_info,
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif /* WLAN_REG_PARTIAL_OFFLOAD */
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -37,6 +38,7 @@ extern const uint32_t reg_2g_sub_dmn_code[];
|
||||
extern const uint32_t reg_5g_sub_dmn_code[];
|
||||
#endif
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
/**
|
||||
* reg_is_country_code_valid() - Check if the given country code is valid
|
||||
* @alpha2: Country string
|
||||
@@ -104,4 +106,12 @@ QDF_STATUS reg_get_rdpair_from_country_code(uint16_t cc,
|
||||
*/
|
||||
QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id,
|
||||
uint16_t *regdmn_pair);
|
||||
#endif
|
||||
#else
|
||||
static inline
|
||||
QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id,
|
||||
uint16_t *regdmn_pair)
|
||||
{
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
#endif /* WLAN_REG_PARTIAL_OFFLOAD */
|
||||
#endif /* __REG_DB_PARSER_H */
|
||||
|
@@ -1227,7 +1227,9 @@ QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_get_max_5g_bw_from_country_code(uint16_t cc,
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS reg_get_max_5g_bw_from_country_code(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t cc,
|
||||
uint16_t *max_bw_5g)
|
||||
{
|
||||
uint16_t i;
|
||||
@@ -1249,7 +1251,8 @@ QDF_STATUS reg_get_max_5g_bw_from_country_code(uint16_t cc,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_get_max_5g_bw_from_regdomain(uint16_t regdmn,
|
||||
QDF_STATUS reg_get_max_5g_bw_from_regdomain(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn,
|
||||
uint16_t *max_bw_5g)
|
||||
{
|
||||
uint16_t i;
|
||||
@@ -1270,6 +1273,52 @@ QDF_STATUS reg_get_max_5g_bw_from_regdomain(uint16_t regdmn,
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* reg_get_max_bw_5g_for_fo() - get max_5g_bw for FullOffload
|
||||
* @pdev: PDEV object
|
||||
*
|
||||
* API to get max_bw_5g from pdev object
|
||||
*
|
||||
* Return: @max_bw_5g
|
||||
*/
|
||||
static uint16_t reg_get_max_bw_5G_for_fo(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(pdev);
|
||||
struct wlan_regulatory_psoc_priv_obj *soc_reg;
|
||||
uint8_t pdev_id;
|
||||
uint8_t phy_id;
|
||||
struct wlan_lmac_if_reg_tx_ops *reg_tx_ops;
|
||||
|
||||
soc_reg = reg_get_psoc_obj(psoc);
|
||||
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
||||
reg_tx_ops = reg_get_psoc_tx_ops(psoc);
|
||||
if (reg_tx_ops->get_phy_id_from_pdev_id)
|
||||
reg_tx_ops->get_phy_id_from_pdev_id(psoc, pdev_id, &phy_id);
|
||||
else
|
||||
phy_id = pdev_id;
|
||||
|
||||
return soc_reg->mas_chan_params[phy_id].max_bw_5g;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_get_max_5g_bw_from_country_code(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t cc,
|
||||
uint16_t *max_bw_5g)
|
||||
{
|
||||
*max_bw_5g = reg_get_max_bw_5G_for_fo(pdev);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_get_max_5g_bw_from_regdomain(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn,
|
||||
uint16_t *max_bw_5g)
|
||||
{
|
||||
*max_bw_5g = reg_get_max_bw_5G_for_fo(pdev);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
void reg_get_current_dfs_region(struct wlan_objmgr_pdev *pdev,
|
||||
enum dfs_reg *dfs_reg)
|
||||
@@ -1432,6 +1481,7 @@ uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev,
|
||||
max_chan_range);
|
||||
}
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn)
|
||||
{
|
||||
@@ -1487,7 +1537,15 @@ QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
pdev_priv_obj->ctry_code = cc;
|
||||
|
||||
} else {
|
||||
reg_get_rdpair_from_regdmn_id(regdmn, ®dmn_pair);
|
||||
err = reg_get_rdpair_from_regdmn_id(regdmn, ®dmn_pair);
|
||||
if (err == QDF_STATUS_E_FAILURE) {
|
||||
reg_err("Failed to get regdmn idx for regdmn pair: %x",
|
||||
regdmn);
|
||||
qdf_mem_free(reg_info->reg_rules_2g_ptr);
|
||||
qdf_mem_free(reg_info->reg_rules_5g_ptr);
|
||||
qdf_mem_free(reg_info);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
err = reg_get_cur_reginfo(reg_info, country_index, regdmn_pair);
|
||||
if (err == QDF_STATUS_E_FAILURE) {
|
||||
@@ -1511,18 +1569,88 @@ QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev,
|
||||
/**
|
||||
* reg_program_chan_list_po() - API to program channel list in Partial Offload
|
||||
* @psoc: Pointer to psoc object manager
|
||||
* @pdev: Pointer to pdev object
|
||||
* @rd: Pointer to cc_regdmn_s structure
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
static QDF_STATUS reg_program_chan_list_po(struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
struct cc_regdmn_s *rd)
|
||||
{
|
||||
struct cur_regulatory_info *reg_info;
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
uint16_t country_index = -1, regdmn_pair = -1;
|
||||
QDF_STATUS err;
|
||||
|
||||
reg_info = (struct cur_regulatory_info *)qdf_mem_malloc
|
||||
(sizeof(struct cur_regulatory_info));
|
||||
if (!reg_info)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
reg_info->psoc = psoc;
|
||||
reg_info->phy_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
||||
|
||||
if (rd->flags == CC_IS_SET) {
|
||||
reg_get_rdpair_from_country_code(rd->cc.country_code,
|
||||
&country_index,
|
||||
®dmn_pair);
|
||||
} else if (rd->flags == ALPHA_IS_SET) {
|
||||
reg_get_rdpair_from_country_iso(rd->cc.alpha,
|
||||
&country_index,
|
||||
®dmn_pair);
|
||||
} else if (rd->flags == REGDMN_IS_SET) {
|
||||
err = reg_get_rdpair_from_regdmn_id(
|
||||
rd->cc.regdmn.reg_2g_5g_pair_id,
|
||||
®dmn_pair);
|
||||
if (err == QDF_STATUS_E_FAILURE) {
|
||||
reg_err("Failed to get regdmn idx for regdmn pair: %x",
|
||||
rd->cc.regdmn.reg_2g_5g_pair_id);
|
||||
qdf_mem_free(reg_info->reg_rules_2g_ptr);
|
||||
qdf_mem_free(reg_info->reg_rules_5g_ptr);
|
||||
qdf_mem_free(reg_info);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
err = reg_get_cur_reginfo(reg_info, country_index, regdmn_pair);
|
||||
if (err == QDF_STATUS_E_FAILURE) {
|
||||
reg_err("Unable to set country code\n");
|
||||
qdf_mem_free(reg_info->reg_rules_2g_ptr);
|
||||
qdf_mem_free(reg_info->reg_rules_5g_ptr);
|
||||
qdf_mem_free(reg_info);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
reg_info->offload_enabled = false;
|
||||
reg_process_master_chan_list(reg_info);
|
||||
|
||||
qdf_mem_free(reg_info->reg_rules_2g_ptr);
|
||||
qdf_mem_free(reg_info->reg_rules_5g_ptr);
|
||||
qdf_mem_free(reg_info);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#else
|
||||
static QDF_STATUS reg_program_chan_list_po(struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
struct cc_regdmn_s *rd)
|
||||
{
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif /* WLAN_REG_PARTIAL_OFFLOAD */
|
||||
|
||||
QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev,
|
||||
struct cc_regdmn_s *rd)
|
||||
{
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
struct wlan_lmac_if_reg_tx_ops *tx_ops;
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
uint8_t pdev_id;
|
||||
uint8_t phy_id;
|
||||
QDF_STATUS err;
|
||||
|
||||
pdev_priv_obj = reg_get_pdev_obj(pdev);
|
||||
if (!pdev_priv_obj) {
|
||||
@@ -1564,44 +1692,7 @@ QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev,
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
reg_info = (struct cur_regulatory_info *)qdf_mem_malloc
|
||||
(sizeof(struct cur_regulatory_info));
|
||||
if (!reg_info)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
reg_info->psoc = psoc;
|
||||
reg_info->phy_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
||||
|
||||
if (rd->flags == CC_IS_SET) {
|
||||
reg_get_rdpair_from_country_code(rd->cc.country_code,
|
||||
&country_index,
|
||||
®dmn_pair);
|
||||
} else if (rd->flags == ALPHA_IS_SET) {
|
||||
reg_get_rdpair_from_country_iso(rd->cc.alpha,
|
||||
&country_index,
|
||||
®dmn_pair);
|
||||
} else if (rd->flags == REGDMN_IS_SET) {
|
||||
reg_get_rdpair_from_regdmn_id(rd->cc.regdmn.reg_2g_5g_pair_id,
|
||||
®dmn_pair);
|
||||
}
|
||||
|
||||
err = reg_get_cur_reginfo(reg_info, country_index, regdmn_pair);
|
||||
if (err == QDF_STATUS_E_FAILURE) {
|
||||
reg_err("Unable to set country code\n");
|
||||
qdf_mem_free(reg_info->reg_rules_2g_ptr);
|
||||
qdf_mem_free(reg_info->reg_rules_5g_ptr);
|
||||
qdf_mem_free(reg_info);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
reg_info->offload_enabled = false;
|
||||
reg_process_master_chan_list(reg_info);
|
||||
|
||||
qdf_mem_free(reg_info->reg_rules_2g_ptr);
|
||||
qdf_mem_free(reg_info->reg_rules_5g_ptr);
|
||||
qdf_mem_free(reg_info);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
return reg_program_chan_list_po(psoc, pdev, rd);
|
||||
}
|
||||
|
||||
QDF_STATUS reg_get_current_cc(struct wlan_objmgr_pdev *pdev,
|
||||
@@ -2476,6 +2567,7 @@ QDF_STATUS reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev,
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
bool reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
struct cur_regdmn_info cur_reg_dmn;
|
||||
@@ -2489,6 +2581,7 @@ bool reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev)
|
||||
|
||||
return reg_en302_502_regdmn(cur_reg_dmn.regdmn_pair_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
QDF_STATUS reg_get_phybitmap(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t *phybitmap)
|
||||
|
@@ -201,25 +201,29 @@ QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
/**
|
||||
* reg_get_ctry_idx_max_bw_from_country_code() - Get the max 5G bandwidth
|
||||
* from country code
|
||||
* @pdev: Pointer to pdev
|
||||
* @cc: Country Code
|
||||
* @max_bw_5g: Max 5G bandwidth supported by the country
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
|
||||
QDF_STATUS reg_get_max_5g_bw_from_country_code(uint16_t cc,
|
||||
QDF_STATUS reg_get_max_5g_bw_from_country_code(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t cc,
|
||||
uint16_t *max_bw_5g);
|
||||
|
||||
/**
|
||||
* reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth
|
||||
* supported by the regdomain
|
||||
* @pdev: Pointer to pdev
|
||||
* @orig_regdmn: Regdomain pair value
|
||||
* @max_bw_5g: Max 5G bandwidth supported by the country
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
|
||||
QDF_STATUS reg_get_max_5g_bw_from_regdomain(uint16_t regdmn,
|
||||
QDF_STATUS reg_get_max_5g_bw_from_regdomain(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn,
|
||||
uint16_t *max_bw_5g);
|
||||
|
||||
/**
|
||||
@@ -279,16 +283,6 @@ uint8_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
|
||||
uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t chan_num);
|
||||
|
||||
/**
|
||||
* reg_program_default_cc() - Program default country code
|
||||
* @pdev: Pdev pointer
|
||||
* @regdmn: Regdomain value
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn);
|
||||
|
||||
/**
|
||||
* reg_get_current_cc() - Get current country code
|
||||
* @pdev: Pdev pointer
|
||||
@@ -736,6 +730,17 @@ qdf_freq_t reg_max_5ghz_chan_freq(void);
|
||||
*/
|
||||
QDF_STATUS reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, bool enable);
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
/**
|
||||
* reg_program_default_cc() - Program default country code
|
||||
* @pdev: Pdev pointer
|
||||
* @regdmn: Regdomain value
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn);
|
||||
|
||||
/**
|
||||
* reg_is_regdmn_en302502_applicable() - Find if ETSI EN302_502 radar pattern
|
||||
* is applicable in current regulatory domain.
|
||||
@@ -744,6 +749,7 @@ QDF_STATUS reg_enable_dfs_channels(struct wlan_objmgr_pdev *pdev, bool enable);
|
||||
* Return: True if en302_502 is applicable, else false.
|
||||
*/
|
||||
bool reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* reg_modify_pdev_chan_range() - Compute current channel list
|
||||
|
@@ -205,6 +205,37 @@ static QDF_STATUS reg_set_non_offload_country(struct wlan_objmgr_pdev *pdev,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
/**
|
||||
* reg_restore_def_country_for_po() - API to restore country code to default
|
||||
* value if given country is invalid for Partial Offload
|
||||
* @offload_enabled: Is offload enabled
|
||||
* @country: Country code
|
||||
* @cc_country: Country code array
|
||||
* Return- void
|
||||
*/
|
||||
static void reg_restore_def_country_for_po(bool offload_enabled,
|
||||
uint8_t *country,
|
||||
uint8_t cc_country[]){
|
||||
if (!offload_enabled && !reg_is_world_alpha2(country)) {
|
||||
QDF_STATUS status;
|
||||
|
||||
status = reg_is_country_code_valid(country);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
reg_err("Unable to set country code: %s\n", country);
|
||||
reg_err("Restoring to world domain");
|
||||
qdf_mem_copy(cc_country, REG_WORLD_ALPHA2,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void reg_restore_def_country_for_po(bool offload_enabled,
|
||||
uint8_t *country,
|
||||
uint8_t cc_country[]){
|
||||
}
|
||||
#endif
|
||||
|
||||
QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *country)
|
||||
{
|
||||
@@ -254,18 +285,9 @@ QDF_STATUS reg_set_country(struct wlan_objmgr_pdev *pdev,
|
||||
qdf_mem_copy(cc.country, country, REG_ALPHA2_LEN + 1);
|
||||
cc.pdev_id = pdev_id;
|
||||
|
||||
if (!psoc_reg->offload_enabled && !reg_is_world_alpha2(country)) {
|
||||
QDF_STATUS status;
|
||||
|
||||
status = reg_is_country_code_valid(country);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
reg_err("Unable to set country code: %s\n", country);
|
||||
reg_err("Restoring to world domain");
|
||||
qdf_mem_copy(cc.country, REG_WORLD_ALPHA2,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
}
|
||||
}
|
||||
|
||||
reg_restore_def_country_for_po(psoc_reg->offload_enabled,
|
||||
country,
|
||||
cc.country);
|
||||
|
||||
if (reg_is_world_alpha2(cc.country))
|
||||
psoc_reg->world_country_pending[phy_id] = true;
|
||||
|
@@ -1529,6 +1529,7 @@ enum direction {
|
||||
* @client_type: type of client
|
||||
* @rnr_tpe_usable: if RNR TPE octet is usable for country
|
||||
* @unspecified_ap_usable: if not set, AP usable for country
|
||||
* @max_bw_5g: Maximum 5g Bandwidth
|
||||
*/
|
||||
struct mas_chan_params {
|
||||
enum dfs_reg dfs_region;
|
||||
@@ -1557,6 +1558,7 @@ struct mas_chan_params {
|
||||
bool rnr_tpe_usable;
|
||||
bool unspecified_ap_usable;
|
||||
#endif
|
||||
uint16_t max_bw_5g;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -467,24 +467,30 @@ QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
/**
|
||||
* wlan_reg_get_ctry_idx_max_bw_from_country_code() - Get the max 5G
|
||||
* bandwidth from country code
|
||||
* @pdev: pdev pointer
|
||||
* @cc: Country Code
|
||||
* @max_bw_5g: Max 5G bandwidth supported by the country
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(uint16_t cc,
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t cc,
|
||||
uint16_t *max_bw_5g);
|
||||
|
||||
/**
|
||||
* wlan_reg_get_max_5g_bw_from_regdomain() - Get the max 5G bandwidth
|
||||
* supported by the regdomain
|
||||
* @pdev: pdev pointer
|
||||
* @orig_regdmn: Regdomain Pair value
|
||||
* @max_bw_5g: Max 5G bandwidth supported by the country
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn,
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn,
|
||||
uint16_t *max_bw_5g);
|
||||
|
||||
/**
|
||||
@@ -1052,6 +1058,7 @@ wlan_reg_get_tx_ops(struct wlan_objmgr_psoc *psoc);
|
||||
QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
|
||||
struct cur_regdmn_info *cur_regdmn);
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
/**
|
||||
* wlan_reg_is_regdmn_en302502_applicable() - Find if ETSI EN302_502 radar
|
||||
* pattern is applicable in the current regulatory domain.
|
||||
@@ -1062,6 +1069,7 @@ QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
|
||||
* False: otherwise.
|
||||
*/
|
||||
bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wlan_reg_modify_pdev_chan_range() - Compute current channel list for the
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -188,8 +189,17 @@ QDF_STATUS ucfg_reg_unregister_event_handler(uint8_t vdev_id, reg_event_cb cb,
|
||||
void *arg);
|
||||
QDF_STATUS ucfg_reg_init_handler(uint8_t pdev_id);
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
/**
|
||||
* ucfg_reg_program_default_cc() - Program default country code
|
||||
* @pdev: Pdev pointer
|
||||
* @regdmn: Regdomain value
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS ucfg_reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ucfg_reg_program_cc() - Program user country code or regdomain
|
||||
|
@@ -67,22 +67,26 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
|
||||
return reg_read_current_country(psoc, country);
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(uint16_t cc,
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_country_code(
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t cc,
|
||||
uint16_t *max_bw_5g)
|
||||
{
|
||||
/*
|
||||
* Get the max 5G bandwidth from country code
|
||||
*/
|
||||
return reg_get_max_5g_bw_from_country_code(cc, max_bw_5g);
|
||||
return reg_get_max_5g_bw_from_country_code(pdev, cc, max_bw_5g);
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn,
|
||||
QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn,
|
||||
uint16_t *max_bw_5g)
|
||||
{
|
||||
/*
|
||||
* Get the max 5G bandwidth from regdomain pair value
|
||||
*/
|
||||
return reg_get_max_5g_bw_from_regdomain(regdmn, max_bw_5g);
|
||||
return reg_get_max_5g_bw_from_regdomain(pdev, regdmn, max_bw_5g);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_REG_CLIENT
|
||||
@@ -921,10 +925,12 @@ qdf_freq_t wlan_reg_ch_to_freq(uint32_t ch_enum)
|
||||
return reg_ch_to_freq(ch_enum);
|
||||
}
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
bool wlan_reg_is_regdmn_en302502_applicable(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
return reg_is_regdmn_en302502_applicable(pdev);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wlan_reg_modify_pdev_chan_range() - Compute current channel list for the
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -98,11 +99,13 @@ QDF_STATUS ucfg_reg_get_regd_rules(struct wlan_objmgr_pdev *pdev,
|
||||
return reg_get_regd_rules(pdev, reg_rules);
|
||||
}
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS ucfg_reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn)
|
||||
{
|
||||
return reg_program_default_cc(pdev, regdmn);
|
||||
}
|
||||
#endif
|
||||
|
||||
QDF_STATUS ucfg_reg_program_cc(struct wlan_objmgr_pdev *pdev,
|
||||
struct cc_regdmn_s *rd)
|
||||
|
@@ -2424,6 +2424,7 @@ QDF_STATUS wmi_unified_vdev_set_qdepth_thresh_cmd_send(
|
||||
wmi_unified_t wmi_handle,
|
||||
struct set_qdepth_thresh_params *param);
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
/**
|
||||
* wmi_unified_pdev_set_regdomain_params_cmd_send() - WMI set regdomain
|
||||
* function
|
||||
@@ -2435,6 +2436,7 @@ QDF_STATUS wmi_unified_vdev_set_qdepth_thresh_cmd_send(
|
||||
QDF_STATUS wmi_unified_pdev_set_regdomain_cmd_send(
|
||||
wmi_unified_t wmi_handle,
|
||||
struct pdev_set_regdomain_params *param);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wmi_unified_set_beacon_filter_cmd_send() - WMI set beacon filter function
|
||||
|
@@ -1460,6 +1460,7 @@ wmi_unified_vdev_set_qdepth_thresh_cmd_send(
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef WLAN_REG_PARTIAL_OFFLOAD
|
||||
QDF_STATUS wmi_unified_pdev_set_regdomain_cmd_send(
|
||||
wmi_unified_t wmi_handle,
|
||||
struct pdev_set_regdomain_params *param)
|
||||
@@ -1470,6 +1471,7 @@ QDF_STATUS wmi_unified_pdev_set_regdomain_cmd_send(
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
QDF_STATUS
|
||||
wmi_unified_set_beacon_filter_cmd_send(
|
||||
|
Reference in New Issue
Block a user