qcacld-3.0: Use regulatory module API to get valid channel list

Update policy manager to use regulatory module API to get valid
channel list instead of MLME config item.

Change-Id: I2fa24c73892746de68ece00e50fd55d6135b7753
CRs-fixed: 2545120
This commit is contained in:
Manikandan Mohan 2019-09-26 18:26:52 -07:00 • committed by nshrivas
commit 01d71c3f79
7 changed files with 86 additions and 85 deletions

View file

@ -1398,8 +1398,6 @@ typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc,
* @sme_change_mcc_beacon_interval: Set MCC beacon interval to FW
*/
struct policy_mgr_sme_cbacks {
QDF_STATUS (*sme_get_valid_channels)(uint32_t *ch_freq_list,
uint32_t *list_len);
void (*sme_get_nss_for_vdev)(enum QDF_OPMODE,
uint8_t *nss_2g, uint8_t *nss_5g);
QDF_STATUS (*sme_soc_set_dual_mac_config)(

View file

@ -2006,7 +2006,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
QDF_STATUS status = QDF_STATUS_E_FAILURE;
uint32_t num_channels = 0;
uint32_t sbs_num_channels = 0;
uint32_t chan_index = 0, chan_index_24 = 0, chan_index_5 = 0;
uint32_t chan_index_24 = 0, chan_index_5 = 0;
bool skip_dfs_channel = false;
bool is_etsi13_srd_chan_allowed_in_mas_mode = true;
uint32_t i = 0, j = 0;
@ -2039,10 +2039,10 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_SUCCESS;
}
channel_list = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t));
channel_list_24 = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t));
channel_list_5 = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t));
sbs_channel_list = qdf_mem_malloc(QDF_MAX_NUM_CHAN * sizeof(uint32_t));
channel_list = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t));
channel_list_24 = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t));
channel_list_5 = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t));
sbs_channel_list = qdf_mem_malloc(NUM_CHANNELS * sizeof(uint32_t));
if (!channel_list || !channel_list_24 || !channel_list_5 ||
!sbs_channel_list) {
status = QDF_STATUS_E_NOMEM;
@ -2078,46 +2078,25 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
}
/* Let's divide the list in 2.4 & 5 Ghz lists */
while ((chan_index < QDF_MAX_NUM_CHAN) && (channel_list[chan_index] <=
wlan_reg_chan_to_freq(pm_ctx->pdev, 11)) &&
(chan_index_24 < QDF_MAX_NUM_CHAN))
channel_list_24[chan_index_24++] = channel_list[chan_index++];
for (i = 0; i < num_channels; i++) {
if (wlan_reg_is_24ghz_ch_freq(channel_list[i])) {
channel_list_24[chan_index_24++] = channel_list[i];
} else if (wlan_reg_is_5ghz_ch_freq(channel_list[i])) {
if ((true == skip_dfs_channel) &&
wlan_reg_is_dfs_for_freq(pm_ctx->pdev,
channel_list[i]))
continue;
if (chan_index < QDF_MAX_NUM_CHAN && channel_list[chan_index] ==
wlan_reg_chan_to_freq(pm_ctx->pdev, 12) &&
chan_index_24 < QDF_MAX_NUM_CHAN) {
channel_list_24[chan_index_24++] = channel_list[chan_index++];
if ((chan_index < QDF_MAX_NUM_CHAN) &&
(channel_list[chan_index] ==
wlan_reg_chan_to_freq(pm_ctx->pdev, 13)) &&
(chan_index_24 < QDF_MAX_NUM_CHAN)) {
channel_list_24[chan_index_24++] =
channel_list[chan_index++];
if ((chan_index < QDF_MAX_NUM_CHAN) &&
(channel_list[chan_index] ==
wlan_reg_chan_to_freq(pm_ctx->pdev, 14)) &&
(chan_index_24 < QDF_MAX_NUM_CHAN))
channel_list_24[chan_index_24++] =
channel_list[chan_index++];
}
}
if (!is_etsi13_srd_chan_allowed_in_mas_mode &&
wlan_reg_is_etsi13_srd_chan_for_freq(
pm_ctx->pdev, channel_list[i]))
continue;
while (chan_index < num_channels &&
chan_index < QDF_MAX_NUM_CHAN &&
chan_index_5 < QDF_MAX_NUM_CHAN) {
if ((true == skip_dfs_channel) &&
wlan_reg_is_dfs_for_freq(pm_ctx->pdev,
channel_list[chan_index])) {
chan_index++;
continue;
channel_list_5[chan_index_5++] = channel_list[i];
} else if (wlan_reg_is_6ghz_chan_freq(channel_list[i])) {
/* Add to 5G list untill 6G conc support is enabled */
channel_list_5[chan_index_5++] = channel_list[i];
}
if (!is_etsi13_srd_chan_allowed_in_mas_mode &&
wlan_reg_is_etsi13_srd_chan_for_freq(
pm_ctx->pdev, channel_list[chan_index])) {
chan_index++;
continue;
}
channel_list_5[chan_index_5++] = channel_list[chan_index++];
}
num_channels = 0;
@ -2139,20 +2118,20 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
* When the weight to be assigned to the group is known along with the
* number of channels, the weights are directly assigned to the
* pcl_weights list. But, the channel list is populated using
* policy_mgr_get_connection_channels(), the order of weights to be used
* is passed as an argument to the function
* policy_mgr_get_connection_channels() using
* 'enum policy_mgr_pcl_group_id' which indicates the next available
* weights to be used and policy_mgr_get_connection_channels() will take
* care of the weight assignments.
* policy_mgr_get_connection_channels(), the order of weights to be used
* is passed as an argument to the function
* policy_mgr_get_connection_channels() using
* 'enum policy_mgr_pcl_group_id' which indicates the next available
* weights to be used and policy_mgr_get_connection_channels() will take
* care of the weight assignments.
*
* e.g., 'enum policy_mgr_pcl_group_id' value of
* POLICY_MGR_PCL_GROUP_ID2_ID3 indicates that the next available groups
* for weight assignment are WEIGHT_OF_GROUP2_PCL_CHANNELS and
* WEIGHT_OF_GROUP3_PCL_CHANNELS and that the
* weight WEIGHT_OF_GROUP1_PCL_CHANNELS was already allocated.
* So, in the same example, when order is
* POLICY_MGR_PCL_ORDER_24G_THEN_5G,
* e.g., 'enum policy_mgr_pcl_group_id' value of
* POLICY_MGR_PCL_GROUP_ID2_ID3 indicates that the next available groups
* for weight assignment are WEIGHT_OF_GROUP2_PCL_CHANNELS and
* WEIGHT_OF_GROUP3_PCL_CHANNELS and that the
* weight WEIGHT_OF_GROUP1_PCL_CHANNELS was already allocated.
* So, in the same example, when order is
* POLICY_MGR_PCL_ORDER_24G_THEN_5G,
* policy_mgr_get_connection_channels() will assign the weight
* WEIGHT_OF_GROUP2_PCL_CHANNELS to 2.4GHz channels and assign the
* weight WEIGHT_OF_GROUP3_PCL_CHANNELS to 5GHz channels.

View file

@ -336,7 +336,7 @@ struct policy_mgr_psoc_priv_obj {
struct policy_mgr_tdls_cbacks tdls_cbacks;
struct policy_mgr_cdp_cbacks cdp_cbacks;
struct policy_mgr_dp_cbacks dp_cbacks;
uint32_t sap_mandatory_channels[QDF_MAX_NUM_CHAN];
uint32_t sap_mandatory_channels[NUM_CHANNELS];
uint32_t sap_mandatory_channels_len;
bool do_hw_mode_change;
bool do_sap_unsafe_ch_check;
@ -352,7 +352,7 @@ struct policy_mgr_psoc_priv_obj {
struct dual_mac_config dual_mac_cfg;
uint32_t hw_mode_change_in_progress;
struct policy_mgr_user_cfg user_cfg;
uint32_t unsafe_channel_list[QDF_MAX_NUM_CHAN];
uint32_t unsafe_channel_list[NUM_CHANNELS];
uint16_t unsafe_channel_count;
struct sta_ap_intf_check_work_ctx *sta_ap_intf_check_work_info;
uint8_t cur_conc_system_pref;
@ -361,6 +361,8 @@ struct policy_mgr_psoc_priv_obj {
send_mode_change_event_cb mode_change_cb;
uint32_t user_config_sap_ch_freq;
struct policy_mgr_cfg cfg;
uint32_t valid_ch_freq_list[NUM_CHANNELS];
uint32_t valid_ch_freq_list_count;
};
/**

View file

@ -558,8 +558,6 @@ QDF_STATUS policy_mgr_register_sme_cb(struct wlan_objmgr_psoc *psoc,
pm_ctx->sme_cbacks.sme_get_nss_for_vdev =
sme_cbacks->sme_get_nss_for_vdev;
pm_ctx->sme_cbacks.sme_get_valid_channels =
sme_cbacks->sme_get_valid_channels;
pm_ctx->sme_cbacks.sme_nss_update_request =
sme_cbacks->sme_nss_update_request;
pm_ctx->sme_cbacks.sme_pdev_set_hw_mode =

View file

@ -158,11 +158,43 @@ void policy_mgr_decr_session_set_pcl(struct wlan_objmgr_psoc *psoc,
return;
}
void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
struct regulatory_channel *chan_list,
struct avoid_freq_ind_data *avoid_freq_ind,
void *arg)
/**
* policy_mgr_update_valid_ch_freq_list() - Update policy manager valid ch list
* @pm_ctx: policy manager context data
* @ch_list: Regulatory channel list
*
* When regulatory component channel list is updated this internal function is
* called to update policy manager copy of valid channel list.
*
* Return: QDF_STATUS_SUCCESS on success other qdf error status code
*/
static void
policy_mgr_update_valid_ch_freq_list(struct policy_mgr_psoc_priv_obj *pm_ctx,
struct regulatory_channel *reg_ch_list)
{
uint32_t i, j = 0, ch;
enum channel_state state;
for (i = 0; i < NUM_CHANNELS; i++) {
ch = reg_ch_list[i].chan_num;
state = wlan_reg_get_channel_state(pm_ctx->pdev, ch);
if (state != CHANNEL_STATE_DISABLE &&
state != CHANNEL_STATE_INVALID) {
pm_ctx->valid_ch_freq_list[j] =
reg_ch_list[i].center_freq;
j++;
}
}
pm_ctx->valid_ch_freq_list_count = j;
}
void
policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc,
struct wlan_objmgr_pdev *pdev,
struct regulatory_channel *chan_list,
struct avoid_freq_ind_data *avoid_freq_ind,
void *arg)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
uint32_t i;
@ -173,6 +205,8 @@ void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc,
return;
}
policy_mgr_update_valid_ch_freq_list(pm_ctx, chan_list);
if (!avoid_freq_ind) {
policy_mgr_debug("avoid_freq_ind NULL");
return;
@ -2063,7 +2097,6 @@ QDF_STATUS policy_mgr_get_valid_chans_int(struct wlan_objmgr_psoc *psoc,
uint32_t *ch_freq_list,
uint32_t *list_len)
{
QDF_STATUS status;
struct policy_mgr_psoc_priv_obj *pm_ctx;
*list_len = 0;
@ -2073,20 +2106,15 @@ QDF_STATUS policy_mgr_get_valid_chans_int(struct wlan_objmgr_psoc *psoc,
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
if (!pm_ctx->sme_cbacks.sme_get_valid_channels) {
policy_mgr_err("sme_get_valid_chans callback is NULL");
return QDF_STATUS_E_FAILURE;
if (!pm_ctx->valid_ch_freq_list_count) {
policy_mgr_err("Invalid PM valid channel list");
return QDF_STATUS_E_INVAL;
}
*list_len = QDF_MAX_NUM_CHAN;
status = pm_ctx->sme_cbacks.sme_get_valid_channels(
ch_freq_list, list_len);
if (QDF_IS_STATUS_ERROR(status)) {
policy_mgr_err("Error in getting valid channels");
*list_len = 0;
return status;
}
*list_len = pm_ctx->valid_ch_freq_list_count;
qdf_mem_copy(ch_freq_list, pm_ctx->valid_ch_freq_list,
pm_ctx->valid_ch_freq_list_count *
sizeof(pm_ctx->valid_ch_freq_list[0]));
policy_mgr_remove_dsrc_channels(ch_freq_list, list_len, pm_ctx->pdev);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2015-2019 The Linux Foundation. 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
@ -634,7 +634,6 @@ void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx)
ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &system_pref);
sme_cbacks.sme_get_valid_channels = sme_get_valid_channels;
sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
/* flush the entire table first */
ret = policy_mgr_psoc_enable(hdd_ctx->psoc);
@ -695,7 +694,6 @@ void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
sub_type < PM_MAX_NUM_OF_MODE; sub_type++) {
type = wlan_hdd_valid_type_of_persona(sub_type);
sme_cbacks.sme_get_valid_channels = sme_get_valid_channels;
sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
/* flush the entire table first */
ret = policy_mgr_psoc_enable(hdd_ctx->psoc);
@ -802,7 +800,6 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
type_1 = wlan_hdd_valid_type_of_persona(sub_type_1);
sme_cbacks.sme_get_valid_channels = sme_get_valid_channels;
sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
/* flush the entire table first */
ret = policy_mgr_psoc_enable(hdd_ctx->psoc);

View file

@ -1194,7 +1194,6 @@ QDF_STATUS sme_start(mac_handle_t mac_handle)
break;
}
sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
sme_cbacks.sme_get_valid_channels = sme_get_valid_channels;
sme_cbacks.sme_nss_update_request = sme_nss_update_request;
sme_cbacks.sme_pdev_set_hw_mode = sme_pdev_set_hw_mode;
sme_cbacks.sme_pdev_set_pcl = sme_pdev_set_pcl;