qcacmn: Add APIs to query min and max chanwidth supported by channel

1. Add reg_get_min_chwidth to return the max chanwidth supported by
regulatory given the primary frequency and the pdev.

2. Add reg_get_max_chwidth to return the max chanwidth supported by
regulatory given the primary frequency and the pdev.

3. Add dispatcher functions for both

Change-Id: Ia21198fe778d32b1673e5dd30c8cd621cded2c45
CRs-Fixed: 3098311
这个提交包含在:
Ananya Barat
2022-02-08 15:28:01 +05:30
提交者 Madan Koyyalamudi
父节点 8d8e72cf71
当前提交 6ee7701aab
修改 4 个文件,包含 101 行新增6 行删除

查看文件

@@ -2246,32 +2246,77 @@ bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq)
FIVE_GIG_ENDING_EDGE_FREQ);
}
bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
static struct regulatory_channel *
reg_get_reg_chan(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
struct regulatory_channel *cur_chan_list;
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
enum channel_enum chan_enum;
pdev_priv_obj = reg_get_pdev_obj(pdev);
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
reg_err("reg pdev priv obj is NULL");
return false;
return NULL;
}
chan_enum = reg_get_chan_enum_for_freq(freq);
if (chan_enum == INVALID_CHANNEL) {
reg_err_rl("Invalid chan enum %d", chan_enum);
return false;
return NULL;
}
cur_chan_list = pdev_priv_obj->cur_chan_list;
if (cur_chan_list[chan_enum].state == CHANNEL_STATE_DISABLE) {
reg_err("Channel %u is not enabled for this pdev", freq);
return NULL;
}
return (cur_chan_list[chan_enum].chan_flags &
return &cur_chan_list[chan_enum];
}
bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
struct regulatory_channel *reg_chan;
reg_chan = reg_get_reg_chan(pdev, freq);
if (!reg_chan) {
reg_err("reg channel is NULL");
return false;
}
return (reg_chan->chan_flags &
REGULATORY_CHAN_INDOOR_ONLY);
}
uint16_t reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
struct regulatory_channel *reg_chan;
reg_chan = reg_get_reg_chan(pdev, freq);
if (!reg_chan) {
reg_err("reg channel is NULL");
return 0;
}
return reg_chan->min_bw;
}
uint16_t reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
{
struct regulatory_channel *reg_chan;
reg_chan = reg_get_reg_chan(pdev, freq);
if (!reg_chan) {
reg_err("reg channel is NULL");
return 0;
}
return reg_chan->max_bw;
}
#ifdef CONFIG_REG_CLIENT
bool reg_is_freq_indoor_in_secondary_list(struct wlan_objmgr_pdev *pdev,
qdf_freq_t freq)

查看文件

@@ -456,6 +456,24 @@ bool reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq);
*/
bool reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
/**
* reg_get_min_chwidth() - Return min chanwidth supported by freq.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Min chwidth supported by freq as per regulatory DB.
*/
uint16_t reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
/**
* reg_get_max_chwidth() - Return max chanwidth supported by freq.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Max chwidth supported by freq as per regulatory DB.
*/
uint16_t reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
#ifdef CONFIG_REG_CLIENT
/**
* reg_is_freq_indoor_in_secondary_list() - Check if the input frequency is

查看文件

@@ -122,6 +122,26 @@ bool wlan_reg_is_range_overlap_5g(qdf_freq_t low_freq, qdf_freq_t high_freq);
*/
bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
/**
* wlan_reg_get_min_chwidth() - Return min chanwidth supported by freq.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Min chwidth supported by freq as per regulatory DB.
*/
uint16_t wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev,
qdf_freq_t freq);
/**
* wlan_reg_get_max_chwidth() - Return max chanwidth supported by freq.
* @pdev: Pointer to pdev.
* @freq: Channel frequency.
*
* Return: Max chwidth supported by freq as per regulatory DB.
*/
uint16_t wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev,
qdf_freq_t freq);
/**
* wlan_reg_get_next_lower_bandwidth() - Get next lower bandwdith
* @ch_width: channel bandwdith

查看文件

@@ -832,6 +832,18 @@ bool wlan_reg_is_freq_indoor(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
return reg_is_freq_indoor(pdev, freq);
}
uint16_t wlan_reg_get_min_chwidth(struct wlan_objmgr_pdev *pdev,
qdf_freq_t freq)
{
return reg_get_min_chwidth(pdev, freq);
}
uint16_t wlan_reg_get_max_chwidth(struct wlan_objmgr_pdev *pdev,
qdf_freq_t freq)
{
return reg_get_max_chwidth(pdev, freq);
}
enum phy_ch_width
wlan_reg_get_next_lower_bandwidth(enum phy_ch_width ch_width)
{