qcacmn: Do not allow connection if STA VLP not supported

If country code for AP and STA are same and if STA does not
support VLP mode for a particular channel and if AP power
type is misconfigured to VLP mode, do not allow connection
to that AP as per regulatory guidelines.

Change-Id: Ie3bb980df25a15c4d9d7e566663e28950414f733
CRs-Fixed: 3362142
This commit is contained in:
Asutosh Mohapatra 2023-10-11 23:23:29 +05:30 • committed by Ravindra Konda
commit 82bd127e2d
4 changed files with 38 additions and 3 deletions

View file

@ -374,20 +374,36 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
}
#ifdef CONFIG_REG_CLIENT
#ifdef CONFIG_BAND_6GHZ
QDF_STATUS
reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t *ap_ctry, uint8_t *sta_ctry,
enum reg_6g_ap_type *pwr_type_6g,
bool *ctry_code_match,
enum reg_6g_ap_type ap_pwr_type)
{
*pwr_type_6g = REG_INDOOR_AP;
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
reg_debug("Country IE:%c%c, STA country:%c%c", ap_ctry[0],
ap_ctry[1], sta_ctry[0], sta_ctry[1]);
*pwr_type_6g = REG_INDOOR_AP;
pdev_priv_obj = reg_get_pdev_obj(pdev);
if (!pdev_priv_obj) {
reg_err("pdev priv obj null");
return QDF_STATUS_E_FAILURE;
}
reg_debug("STA country: %c%c, AP country: %c%c, AP power type: %d",
sta_ctry[0], sta_ctry[1], ap_ctry[0], ap_ctry[1],
ap_pwr_type);
if (!qdf_mem_cmp(ap_ctry, sta_ctry, REG_ALPHA2_LEN)) {
*ctry_code_match = true;
if (ap_pwr_type == REG_VERY_LOW_POWER_AP) {
if (!pdev_priv_obj->reg_rules.num_of_6g_client_reg_rules[ap_pwr_type]) {
reg_err("VLP not supported, can't connect");
return QDF_STATUS_E_NOSUPPORT;
}
}
return QDF_STATUS_SUCCESS;
}
@ -425,6 +441,18 @@ reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
#else
QDF_STATUS
reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t *ap_ctry, uint8_t *sta_ctry,
enum reg_6g_ap_type *pwr_type_6g,
bool *ctry_code_match,
enum reg_6g_ap_type ap_pwr_type)
{
return QDF_STATUS_SUCCESS;
}
#endif
#endif
#ifdef CONFIG_CHAN_NUM_API

View file

@ -300,6 +300,8 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
#ifdef CONFIG_REG_CLIENT
/**
* reg_get_6g_power_type_for_ctry() - Return power type for 6G based on cntry IE
* @psoc: pointer to psoc
* @pdev: pointer to pdev
* @ap_ctry: ptr to country string in country IE
* @sta_ctry: ptr to sta programmed country
* @pwr_type_6g: ptr to 6G power type
@ -309,6 +311,7 @@ QDF_STATUS reg_get_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
*/
QDF_STATUS
reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t *ap_ctry, uint8_t *sta_ctry,
enum reg_6g_ap_type *pwr_type_6g,
bool *ctry_code_match,

View file

@ -543,6 +543,8 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
/**
* wlan_reg_get_6g_power_type_for_ctry() - Return power type for 6G based
* on country IE
* @psoc: pointer to psoc
* @pdev: pointer to pdev
* @ap_ctry: ptr to country string in country IE
* @sta_ctry: ptr to sta programmed country
* @pwr_type_6g: ptr to 6G power type
@ -552,6 +554,7 @@ QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
*/
QDF_STATUS
wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t *ap_ctry, uint8_t *sta_ctry,
enum reg_6g_ap_type *pwr_type_6g,
bool *ctry_code_match,

View file

@ -88,12 +88,13 @@ QDF_STATUS wlan_reg_get_max_5g_bw_from_regdomain(uint16_t regdmn,
#ifdef CONFIG_REG_CLIENT
QDF_STATUS
wlan_reg_get_6g_power_type_for_ctry(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
uint8_t *ap_ctry, uint8_t *sta_ctry,
enum reg_6g_ap_type *pwr_type_6g,
bool *ctry_code_match,
enum reg_6g_ap_type ap_pwr_type)
{
return reg_get_6g_power_type_for_ctry(psoc, ap_ctry, sta_ctry,
return reg_get_6g_power_type_for_ctry(psoc, pdev, ap_ctry, sta_ctry,
pwr_type_6g, ctry_code_match,
ap_pwr_type);
}