qcacmn: Define a new regulatory API for frequency check

Given country from country IE and operating class, check
whether a channel frequency belongs to that pair.

Change-Id: I9bf711b2c52ad230a3066113a5aa7b8959219754
CRs-Fixed: 2620767
This commit is contained in:
Amar Singhal 2020-02-12 12:07:12 -08:00 • committed by nshrivas
commit 70259d6252
4 changed files with 75 additions and 1 deletions

View file

@ -526,6 +526,32 @@ void reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
op_class,
chan_num);
}
bool reg_country_opclass_freq_check(struct wlan_objmgr_pdev *pdev,
const uint8_t country[3],
uint8_t op_class,
qdf_freq_t chan_freq)
{
const struct reg_dmn_op_class_map_t *op_class_tbl;
uint8_t i;
op_class_tbl = reg_get_class_from_country((uint8_t *)country);
while (op_class_tbl && op_class_tbl->op_class) {
if (op_class_tbl->op_class == op_class) {
for (i = 0; (i < REG_MAX_CHANNELS_PER_OPERATING_CLASS &&
op_class_tbl->channels[i]); i++) {
if (op_class_tbl->channels[i] *
FREQ_TO_CHAN_SCALE +
op_class_tbl->start_freq == chan_freq)
return true;
}
}
op_class_tbl++;
}
return false;
}
#endif
uint16_t reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,
@ -781,4 +807,5 @@ QDF_STATUS reg_get_opclass_details(struct wlan_objmgr_pdev *pdev,
return QDF_STATUS_SUCCESS;
}
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
*
*
* Permission to use, copy, modify, and/or distribute this software for
@ -145,6 +145,21 @@ void reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
uint16_t behav_limit,
uint8_t *op_class,
uint8_t *chan_num);
/**
* reg_country_opclass_freq_check() - check for frequency in (tbl, oper class)
*
* @pdev: pdev pointer
* @country: country from country IE
* @op_class: operating class
* @chan_freq: channel frequency in mhz
*
* Return: bool
*/
bool reg_country_opclass_freq_check(struct wlan_objmgr_pdev *pdev,
const uint8_t country[3],
uint8_t op_class,
qdf_freq_t chan_freq);
#endif
/**
@ -243,6 +258,14 @@ reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
{
}
static inline bool
reg_country_opclass_freq_check(struct wlan_objmgr_pdev *pdev,
const uint8_t country[3],
uint8_t op_class,
uint16_t chan_freq)
{
}
#endif
static inline uint16_t reg_get_op_class_width(struct wlan_objmgr_pdev *pdev,

View file

@ -1171,6 +1171,21 @@ void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
uint8_t *op_class,
uint8_t *chan_num);
/**
* wlan_reg_country_opclass_freq_check() - checks frequency in (ctry, op class)
* pair
* @pdev: pdev ptr
* @country: country information
* @op_class: operating class
* @chan_freq: channel frequency
*
* Return: bool
*/
bool wlan_reg_country_opclass_freq_check(struct wlan_objmgr_pdev *pdev,
const uint8_t country[3],
uint8_t op_class,
qdf_freq_t chan_freq);
/**
* wlan_reg_get_5g_bonded_channel_and_state_for_freq()- Return the channel
* state for a 5G or 6G channel frequency based on the channel width and

View file

@ -1009,6 +1009,15 @@ void wlan_reg_freq_to_chan_op_class(struct wlan_objmgr_pdev *pdev,
chan_num);
}
bool wlan_reg_country_opclass_freq_check(struct wlan_objmgr_pdev *pdev,
const uint8_t country[3],
uint8_t op_class,
qdf_freq_t chan_freq)
{
return reg_country_opclass_freq_check(pdev, country,
op_class, chan_freq);
}
enum channel_state
wlan_reg_get_5g_bonded_channel_and_state_for_freq(struct wlan_objmgr_pdev *pdev,
uint16_t freq,