qcacmn: Prune PCL to active channels only for P2P GO

Prune the PCL to have only active channels for P2P GO mode.
Change-Id: Ifade00b3ccfcecff16a49e9e9aa5e077d5f9629b
CRs-Fixed: 2029007
This commit is contained in:
Tushnim Bhattacharyya
2017-04-04 17:23:26 -07:00
committed by Sandeep Puligilla
parent 5def1a815a
commit 7abd54674e
2 changed files with 40 additions and 0 deletions

View File

@@ -53,6 +53,8 @@ extern enum cds_band_type cds_chan_to_band(uint32_t chan);
#define WLAN_REG_IS_CHANNEL_VALID_5G_SBS(curchan, newchan) \
CDS_IS_CHANNEL_VALID_5G_SBS(curchan, newchan)
#define wlan_reg_is_dfs_ch(psoc, ch) CDS_IS_DFS_CH(ch)
#define wlan_reg_is_passive_or_disable_ch(ch) \
CDS_IS_PASSIVE_OR_DISABLE_CH(ch)
#define WLAN_REG_MAX_24GHZ_CH_NUM CDS_MAX_24GHZ_CHANNEL_NUMBER
#define reg_chan_to_freq(chan_num) cds_chan_to_freq(chan_num)
#define reg_freq_to_chan(freq) cds_freq_to_chan(freq)

View File

@@ -139,6 +139,31 @@ void policy_mgr_update_with_safe_channel_list(uint8_t *pcl_channels,
return;
}
static QDF_STATUS policy_mgr_modify_pcl_based_on_enabled_channels(
uint8_t *pcl_list_org,
uint8_t *weight_list_org,
uint32_t *pcl_len_org)
{
uint32_t i, pcl_len = 0;
uint8_t pcl_list[QDF_MAX_NUM_CHAN];
uint8_t weight_list[QDF_MAX_NUM_CHAN];
for (i = 0; i < *pcl_len_org; i++) {
if (!wlan_reg_is_passive_or_disable_ch(pcl_list_org[i])) {
pcl_list[pcl_len] = pcl_list_org[i];
weight_list[pcl_len++] = weight_list_org[i];
}
}
qdf_mem_zero(pcl_list_org, QDF_ARRAY_SIZE(pcl_list_org));
qdf_mem_zero(weight_list_org, QDF_ARRAY_SIZE(weight_list_org));
qdf_mem_copy(pcl_list_org, pcl_list, pcl_len);
qdf_mem_copy(weight_list_org, weight_list, pcl_len);
*pcl_len_org = pcl_len;
return QDF_STATUS_SUCCESS;
}
uint8_t policy_mgr_get_channel(struct wlan_objmgr_psoc *psoc,
enum policy_mgr_con_mode mode, uint32_t *vdev_id)
{
@@ -293,6 +318,19 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc,
}
if (mode == PM_P2P_GO_MODE) {
status = policy_mgr_modify_pcl_based_on_enabled_channels(
pcl_channels, pcl_weight, len);
if (QDF_IS_STATUS_ERROR(status)) {
policy_mgr_err("failed to get modified pcl for GO");
return status;
}
policy_mgr_debug("modified pcl len:%d", *len);
for (i = 0; i < *len; i++)
policy_mgr_debug("chan:%d weight:%d",
pcl_channels[i], pcl_weight[i]);
}
return QDF_STATUS_SUCCESS;
}