qcacld-3.0: Unit test update for policy mgr pcl validation

Update unit test command for policy mgr pcl validation to
support new SBS PCL type.

Change-Id: Ib02ce6c69400d0f47307523d690e1d81a8c0ef83
CRs-Fixed: 2998526
This commit is contained in:
Liangwei Dong
2021-07-14 18:22:37 +08:00
committed by Madan Koyyalamudi
父節點 100c310363
當前提交 04e62b143e
共有 5 個文件被更改,包括 538 次插入160 次删除

查看文件

@@ -1160,8 +1160,7 @@ struct policy_mgr_conc_connection_info *policy_mgr_get_conn_info(
* @tx_streams: number of transmit spatial streams
* @rx_streams: number of receive spatial streams
* @chain_mask: chain mask
* @type: connection type
* @sub_type: connection subtype
* @mode: conn mode
* @ch_freq: channel frequency value
* @mac_id: mac id
*
@@ -1174,8 +1173,8 @@ QDF_STATUS
policy_mgr_incr_connection_count_utfw(struct wlan_objmgr_psoc *psoc,
uint32_t vdev_id, uint32_t tx_streams,
uint32_t rx_streams,
uint32_t chain_mask, uint32_t type,
uint32_t sub_type,
uint32_t chain_mask,
enum policy_mgr_con_mode mode,
uint32_t ch_freq, uint32_t mac_id);
/**
@@ -1269,7 +1268,7 @@ enum policy_mgr_pcl_type policy_mgr_get_pcl_from_third_conn_table(
static inline QDF_STATUS policy_mgr_incr_connection_count_utfw(
struct wlan_objmgr_psoc *psoc, uint32_t vdev_id,
uint32_t tx_streams, uint32_t rx_streams,
uint32_t chain_mask, uint32_t type, uint32_t sub_type,
uint32_t chain_mask, enum policy_mgr_con_mode mode,
uint32_t ch_freq, uint32_t mac_id)
{
return QDF_STATUS_SUCCESS;

查看文件

@@ -3105,13 +3105,12 @@ QDF_STATUS policy_mgr_update_connection_info_utfw(
QDF_STATUS policy_mgr_incr_connection_count_utfw(
struct wlan_objmgr_psoc *psoc,
uint32_t vdev_id, uint32_t tx_streams, uint32_t rx_streams,
uint32_t chain_mask, uint32_t type, uint32_t sub_type,
uint32_t chain_mask, enum policy_mgr_con_mode mode,
uint32_t ch_freq, uint32_t mac_id)
{
QDF_STATUS status = QDF_STATUS_E_FAILURE;
uint32_t conn_index = 0;
bool update_conn = true;
enum policy_mgr_con_mode mode;
uint16_t ch_flagext = 0;
struct policy_mgr_psoc_priv_obj *pm_ctx;
@@ -3124,7 +3123,6 @@ QDF_STATUS policy_mgr_incr_connection_count_utfw(
}
policy_mgr_debug("--> filling entry at index[%d]", conn_index);
mode = policy_mgr_get_mode(type, sub_type);
if (mode == PM_STA_MODE || mode == PM_P2P_CLIENT_MODE)
update_conn = false;
@@ -3135,10 +3133,13 @@ QDF_STATUS policy_mgr_incr_connection_count_utfw(
}
if (wlan_reg_is_dfs_for_freq(pm_ctx->pdev, ch_freq))
ch_flagext |= IEEE80211_CHAN_DFS;
policy_mgr_update_conc_list(psoc, conn_index, mode, ch_freq,
HW_MODE_20_MHZ, mac_id, chain_mask,
0, vdev_id, true, update_conn, ch_flagext);
if (mode < PM_MAX_NUM_OF_MODE) {
pm_ctx->no_of_active_sessions[mode]++;
policy_mgr_update_conc_list(psoc, conn_index, mode, ch_freq,
HW_MODE_20_MHZ, mac_id, chain_mask,
0, vdev_id, true, update_conn,
ch_flagext);
}
return QDF_STATUS_SUCCESS;
}
@@ -3147,6 +3148,13 @@ QDF_STATUS policy_mgr_decr_connection_count_utfw(struct wlan_objmgr_psoc *psoc,
uint32_t del_all, uint32_t vdev_id)
{
QDF_STATUS status;
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid pm context");
return QDF_STATUS_E_FAILURE;
}
if (del_all) {
status = policy_mgr_psoc_disable(psoc);
@@ -3160,7 +3168,17 @@ QDF_STATUS policy_mgr_decr_connection_count_utfw(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_FAILURE;
}
} else {
policy_mgr_decr_connection_count(psoc, vdev_id);
enum policy_mgr_con_mode mode =
policy_mgr_get_mode_by_vdev_id(psoc, vdev_id);
if (mode < PM_MAX_NUM_OF_MODE &&
pm_ctx->no_of_active_sessions[mode]) {
pm_ctx->no_of_active_sessions[mode]--;
policy_mgr_decr_connection_count(psoc, vdev_id);
} else {
policy_mgr_err("mode %d unexpected", mode);
return QDF_STATUS_E_FAILURE;
}
}
return QDF_STATUS_SUCCESS;

查看文件

@@ -27,15 +27,16 @@
void clean_report(struct hdd_context *hdd_ctx);
void fill_report(struct hdd_context *hdd_ctx, char *title,
uint32_t first_persona, uint32_t second_persona, uint32_t third_persona,
uint32_t chnl_1st_conn, uint32_t chnl_2nd_conn, uint32_t chnl_3rd_conn,
bool status, enum policy_mgr_pcl_type pcl_type, char *reason,
qdf_freq_t *pcl_freqs);
qdf_freq_t chnl_1st_conn, qdf_freq_t chnl_2nd_conn,
qdf_freq_t chnl_3rd_conn, bool status,
enum policy_mgr_pcl_type pcl_type, char *reason,
uint32_t *pcl_freqs, uint32_t pcl_len);
void print_report(struct hdd_context *hdd_ctx);
void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx);
void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
uint8_t first_chnl, enum policy_mgr_chain_mode first_chain_mask);
qdf_freq_t first_chnl, enum policy_mgr_chain_mode first_chain_mask);
void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
uint8_t first_chnl, uint8_t second_chnl,
qdf_freq_t first_chnl, qdf_freq_t second_chnl,
enum policy_mgr_chain_mode chain_mask, uint8_t use_same_mac);
#else
static inline
@@ -45,10 +46,11 @@ void clean_report(struct hdd_context *hdd_ctx)
static inline
void fill_report(struct hdd_context *hdd_ctx, char *title,
uint32_t first_persona, uint32_t second_persona, uint32_t third_persona,
uint32_t chnl_1st_conn, uint32_t chnl_2nd_conn, uint32_t chnl_3rd_conn,
uint32_t first_persona, uint32_t second_persona,
uint32_t third_persona, qdf_freq_t chnl_1st_conn,
qdf_freq_t chnl_2nd_conn, qdf_freq_t chnl_3rd_conn,
bool status, enum policy_mgr_pcl_type pcl_type, char *reason,
qdf_freq_t *pcl_freqs)
uint32_t *pcl_freqs, uint32_t pcl_len)
{
}
@@ -63,14 +65,17 @@ void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx)
}
static inline
void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
uint8_t first_chnl, enum policy_mgr_chain_mode first_chain_mask)
void wlan_hdd_two_connections_scenario(
struct hdd_context *hdd_ctx,
qdf_freq_t first_chnl,
enum policy_mgr_chain_mode first_chain_mask)
{
}
static inline
void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
uint8_t first_chnl, uint8_t second_chnl,
void wlan_hdd_three_connections_scenario(
struct hdd_context *hdd_ctx,
qdf_freq_t first_chnl, qdf_freq_t second_chnl,
enum policy_mgr_chain_mode chain_mask, uint8_t use_same_mac)
{
}

查看文件

@@ -65,26 +65,11 @@ struct report_t {
bool status;
char result_code[MAX_ALLOWED_CHAR_IN_REPORT];
char reason[MAX_ALLOWED_CHAR_IN_REPORT];
char pcl_freqs[2 * NUM_CHANNELS];
char pcl_freqs[6 * NUM_CHANNELS + 16];
};
static struct report_t report[NUMBER_OF_SCENARIO];
static uint32_t report_idx;
static uint8_t wlan_hdd_valid_type_of_persona(uint32_t sub_type)
{
switch (sub_type) {
case PM_STA_MODE:
return WMI_VDEV_TYPE_STA;
case PM_SAP_MODE:
case PM_P2P_CLIENT_MODE:
case PM_P2P_GO_MODE:
return WMI_VDEV_TYPE_AP;
default:
return WMI_VDEV_TYPE_STA;
}
}
static const char *system_config_to_string(uint8_t idx)
{
switch (idx) {
@@ -114,7 +99,7 @@ void print_report(struct hdd_context *hdd_ctx)
pr_info("+----------Report start -----------+\n");
while (idx < report_idx) {
pr_info("Idx:[%d]\nTitle:%s\nResult:[%s]\n\t1st_person[%s]\n\t2nd_persona[%s]\n\t3rd_persona[%s]\n\tDBS[%s]\n\tsystem_config[%s]\n\treason[%s]\n\tpcl_freqs[%s]\n",
pr_info("Idx:[%d] Title:%s Result:[%s] 1st_person[%s] 2nd_persona[%s] 3rd_persona[%s] DBS[%s] system_config[%s] reason[%s] pcl_freqs[%s]\n",
idx,
report[idx].title, report[idx].result_code,
report[idx].first_persona, report[idx].second_persona,
@@ -128,16 +113,19 @@ void print_report(struct hdd_context *hdd_ctx)
void fill_report(struct hdd_context *hdd_ctx, char *title,
uint32_t first_persona, uint32_t second_persona, uint32_t third_persona,
uint32_t chnl_1st_conn, uint32_t chnl_2nd_conn, uint32_t chnl_3rd_conn,
bool status, enum policy_mgr_pcl_type pcl_type, char *reason,
qdf_freq_t *pcl_freqs)
qdf_freq_t chnl_1st_conn, qdf_freq_t chnl_2nd_conn,
qdf_freq_t chnl_3rd_conn, bool status,
enum policy_mgr_pcl_type pcl_type, char *reason,
uint32_t *pcl_freqs, uint32_t pcl_len)
{
int i;
char buf[4] = {0};
char buf[5] = {0};
uint8_t sys_pref = 0;
if (report_idx >= NUMBER_OF_SCENARIO)
if (report_idx >= NUMBER_OF_SCENARIO) {
pr_info("report buffer overflow %d", report_idx);
return;
}
ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &sys_pref);
@@ -189,9 +177,10 @@ void fill_report(struct hdd_context *hdd_ctx, char *title,
if (pcl_freqs) {
qdf_mem_zero(report[report_idx].pcl_freqs,
sizeof(report[report_idx].pcl_freqs));
for (i = 0; i < NUM_CHANNELS; i++) {
if (pcl_freqs[i] == 0)
break;
snprintf(buf, sizeof(buf), "pcl len %d :", pcl_len);
strlcat(report[report_idx].pcl_freqs, buf,
sizeof(report[report_idx].pcl_freqs));
for (i = 0; i < pcl_len && i < NUM_CHANNELS; i++) {
qdf_mem_zero(buf, sizeof(buf));
snprintf(buf, sizeof(buf), "%d ", pcl_freqs[i]);
strlcat(report[report_idx].pcl_freqs, buf,
@@ -203,10 +192,242 @@ void fill_report(struct hdd_context *hdd_ctx, char *title,
report_idx++;
}
static void _validate_24g(bool *status, uint32_t *first_idx,
uint32_t *pcl_freqs, uint32_t pcl_len,
qdf_freq_t first_connection_chnl,
qdf_freq_t second_connection_chnl,
char *reason, uint32_t reason_length)
{
bool found2g = false;
if (!*status)
return;
for (; *first_idx < pcl_len; (*first_idx)++) {
if (WLAN_REG_IS_24GHZ_CH_FREQ(pcl_freqs[(*first_idx)]))
found2g = true;
else
break;
}
if (!found2g) {
snprintf(reason, reason_length,
"Not 2g ch list");
*status = false;
}
}
static void _validate_5g(bool *status, uint32_t *first_idx,
uint32_t *pcl_freqs, uint32_t pcl_len,
qdf_freq_t first_connection_chnl,
qdf_freq_t second_connection_chnl,
char *reason, uint32_t reason_length)
{
bool found5g = false;
if (!*status)
return;
for (; *first_idx < pcl_len; (*first_idx)++) {
if (WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[*first_idx]) ||
WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[*first_idx])) {
found5g = true;
} else {
break;
}
}
if (!found5g) {
snprintf(reason, reason_length,
"Not 5/6g ch list");
*status = false;
}
}
static void _validate_scc(bool *status, uint32_t *first_idx,
uint32_t *pcl_freqs, uint32_t pcl_len,
qdf_freq_t first_connection_chnl,
qdf_freq_t second_connection_chnl,
char *reason, uint32_t reason_length)
{
if (!*status)
return;
if (!first_connection_chnl) {
snprintf(reason, reason_length,
"scc ch invalid %d",
first_connection_chnl);
*status = false;
return;
}
if (*first_idx >= pcl_len) {
snprintf(reason, reason_length,
"no scc ch");
*status = false;
return;
}
if (pcl_freqs[*first_idx] != first_connection_chnl &&
!(second_connection_chnl &&
pcl_freqs[*first_idx] == second_connection_chnl)) {
snprintf(reason, reason_length,
"1st scc ch is not correct %d expect %d %d",
pcl_freqs[*first_idx],
first_connection_chnl,
second_connection_chnl);
*status = false;
return;
}
(*first_idx)++;
if (second_connection_chnl) {
if (*first_idx >= pcl_len) {
snprintf(reason, reason_length,
"no 2rd scc ch");
*status = false;
return;
}
if (pcl_freqs[*first_idx] != first_connection_chnl &&
pcl_freqs[*first_idx] != second_connection_chnl) {
snprintf(reason, reason_length,
"2rd scc ch is not correct %d expect %d %d",
pcl_freqs[*first_idx],
first_connection_chnl,
second_connection_chnl);
*status = false;
return;
}
(*first_idx)++;
}
}
static void _validate_mcc(bool *status, uint32_t *first_idx,
uint32_t *pcl_freqs, uint32_t pcl_len,
qdf_freq_t first_connection_chnl,
qdf_freq_t second_connection_chnl,
char *reason, uint32_t reason_length)
{
if (!*status)
return;
if (!first_connection_chnl || !second_connection_chnl ||
first_connection_chnl == second_connection_chnl) {
snprintf(reason, reason_length,
"mcc ch invalid %d %d",
first_connection_chnl,
second_connection_chnl);
*status = false;
return;
}
if (*first_idx >= pcl_len) {
snprintf(reason, reason_length,
"no mcc ch");
*status = false;
return;
}
if (pcl_freqs[*first_idx] != first_connection_chnl &&
pcl_freqs[*first_idx] != second_connection_chnl) {
snprintf(reason, reason_length,
"mcc ch is not correct %d",
pcl_freqs[*first_idx]);
*status = false;
return;
}
(*first_idx)++;
if (pcl_freqs[*first_idx] != first_connection_chnl &&
pcl_freqs[*first_idx] != second_connection_chnl) {
snprintf(reason, reason_length,
"mcc ch is not correct %d",
pcl_freqs[*first_idx]);
*status = false;
return;
}
(*first_idx)++;
}
static void _validate_sbs(bool *status, uint32_t *first_idx,
uint32_t *pcl_freqs, uint32_t pcl_len,
qdf_freq_t first_connection_chnl,
qdf_freq_t second_connection_chnl,
char *reason, uint32_t reason_length)
{
bool found_sbs = false;
uint32_t non_sbs_freq = 0;
if (!*status)
return;
if (*first_idx >= pcl_len) {
snprintf(reason, reason_length,
"no sbs ch list");
*status = false;
return;
}
for (; *first_idx < pcl_len; (*first_idx)++) {
if (WLAN_REG_IS_FREQUENCY_VALID_5G_SBS(
pcl_freqs[*first_idx],
first_connection_chnl)) {
found_sbs = true;
} else {
non_sbs_freq = pcl_freqs[*first_idx];
break;
}
}
if (!found_sbs) {
snprintf(reason, reason_length,
"not sbs ch list %d",
non_sbs_freq);
*status = false;
return;
}
}
static void _validate_end(bool *status, uint32_t *first_idx,
uint32_t *pcl_freqs, uint32_t pcl_len,
qdf_freq_t first_connection_chnl,
qdf_freq_t second_connection_chnl,
char *reason, uint32_t reason_length)
{
if (!*status)
return;
if (*first_idx < pcl_len) {
snprintf(reason, reason_length,
"unexpected ch in pcl");
*status = false;
return;
}
}
#define validate_24g _validate_24g( \
&status, &first_idx, pcl_freqs, pcl_len, \
first_connection_chnl, second_connection_chnl, \
reason, reason_length)
#define validate_5g _validate_5g( \
&status, &first_idx, pcl_freqs, pcl_len, \
first_connection_chnl, second_connection_chnl, \
reason, reason_length)
#define validate_scc _validate_scc( \
&status, &first_idx, pcl_freqs, pcl_len, \
first_connection_chnl, second_connection_chnl, \
reason, reason_length)
#define validate_mcc _validate_mcc( \
&status, &first_idx, pcl_freqs, pcl_len, \
first_connection_chnl, second_connection_chnl, \
reason, reason_length)
#define validate_sbs _validate_sbs( \
&status, &first_idx, pcl_freqs, pcl_len, \
first_connection_chnl, second_connection_chnl, \
reason, reason_length)
#define validate_end _validate_end( \
&status, &first_idx, pcl_freqs, pcl_len, \
first_connection_chnl, second_connection_chnl, \
reason, reason_length)
static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
enum policy_mgr_pcl_type pcl_type, qdf_freq_t *pcl_freqs, uint32_t pcl_len,
qdf_freq_t first_connection_chnl, qdf_freq_t second_connection_chnl,
char *reason, uint32_t reason_length)
enum policy_mgr_pcl_type pcl_type, uint32_t *pcl_freqs,
uint32_t pcl_len, qdf_freq_t first_connection_chnl,
qdf_freq_t second_connection_chnl, char *reason,
uint32_t reason_length)
{
bool status = true;
uint32_t first_idx = 0;
@@ -225,7 +446,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
break;
case PM_5G:
for (first_idx = 0; first_idx < pcl_len; first_idx++) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[first_idx])) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[first_idx]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[first_idx])) {
snprintf(reason, reason_length,
"2G channel found");
return false;
@@ -300,7 +522,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
"No SCC found");
return false;
}
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1])) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[pcl_len - 1])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
@@ -325,7 +548,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
}
break;
case PM_5G_SCC_CH:
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0])) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[0])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
@@ -378,7 +602,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
"MCC invalid");
return false;
}
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1])) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[pcl_len - 1])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
@@ -406,7 +631,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
}
break;
case PM_5G_MCC_CH:
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0])) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[0])) {
snprintf(reason, reason_length,
"No 5Ghz chnl");
return false;
@@ -427,7 +653,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
}
break;
case PM_SCC_ON_5_SCC_ON_24_24G:
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) ||
if ((!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[0])) ||
(pcl_freqs[0] != first_connection_chnl &&
pcl_freqs[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
@@ -448,7 +675,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
}
break;
case PM_SCC_ON_5_SCC_ON_24_5G:
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) ||
if ((!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[0])) ||
(pcl_freqs[0] != first_connection_chnl &&
pcl_freqs[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
@@ -462,7 +690,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
"No 24Ghz chnl/scc");
return false;
}
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1])) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[pcl_len - 1])) {
snprintf(reason, reason_length,
"No 5Ghz chnls");
return false;
@@ -476,7 +705,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
"No 24Ghz chnl/scc");
return false;
}
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[1]) ||
if ((!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[1]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[1])) ||
(pcl_freqs[1] != first_connection_chnl &&
pcl_freqs[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
@@ -497,21 +727,24 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
"No 24Ghz chnl/scc");
return false;
}
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[1]) ||
if ((!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[1]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[1])) ||
(pcl_freqs[1] != first_connection_chnl &&
pcl_freqs[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
"No 5Ghz chnl/scc");
return false;
}
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1])) {
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[pcl_len - 1]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[pcl_len - 1])) {
snprintf(reason, reason_length,
"No 5Ghz chnls");
return false;
}
break;
case PM_SCC_ON_5_SCC_ON_24:
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) ||
if ((!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[0]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[0])) ||
(pcl_freqs[0] != first_connection_chnl &&
pcl_freqs[0] != second_connection_chnl)) {
snprintf(reason, reason_length,
@@ -539,7 +772,8 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
"No 24Ghz chnl/scc");
return false;
}
if (!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[1]) ||
if ((!WLAN_REG_IS_5GHZ_CH_FREQ(pcl_freqs[1]) &&
!WLAN_REG_IS_6GHZ_CHAN_FREQ(pcl_freqs[1])) ||
(pcl_freqs[1] != first_connection_chnl &&
pcl_freqs[1] != second_connection_chnl)) {
snprintf(reason, reason_length,
@@ -552,6 +786,65 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
return false;
}
break;
case PM_SBS_CH:
validate_scc;
validate_end;
break;
case PM_SBS_CH_5G:
validate_scc;
validate_5g;
validate_end;
break;
case PM_24G_SCC_CH_SBS_CH:
validate_24g;
validate_scc;
validate_sbs;
validate_end;
break;
case PM_24G_SCC_CH_SBS_CH_5G:
validate_24g;
validate_scc;
validate_sbs;
validate_5g;
validate_end;
break;
case PM_24G_SBS_CH_MCC_CH:
validate_24g;
validate_sbs;
validate_mcc;
validate_end;
break;
case PM_SBS_CH_24G_SCC_CH:
validate_sbs;
validate_24g;
validate_scc;
validate_end;
break;
case PM_SBS_CH_SCC_CH_24G:
validate_sbs;
validate_scc;
validate_24g;
validate_end;
break;
case PM_SCC_CH_SBS_CH_24G:
validate_scc;
validate_sbs;
validate_24g;
validate_end;
break;
case PM_SBS_CH_SCC_CH_5G_24G:
validate_sbs;
validate_scc;
validate_5g;
validate_24g;
validate_end;
break;
case PM_SCC_CH_MCC_CH_SBS_CH_24G:
validate_scc;
validate_5g;
validate_24g;
validate_end;
break;
default:
snprintf(reason, reason_length,
"Unknown option");
@@ -564,26 +857,12 @@ static bool wlan_hdd_validate_pcl(struct hdd_context *hdd_ctx,
return status;
}
static void wlan_hdd_map_subtypes_hdd_wma(enum policy_mgr_con_mode *dst,
enum policy_mgr_con_mode *src)
{
/*
* wma defined sap subtype as 0
* Rest of the mappings are same
* In future, if mapping gets changed then re-map it here
*/
if (*src == PM_SAP_MODE)
*dst = 0;
else
*dst = *src;
}
void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx)
{
enum policy_mgr_con_mode sub_type;
uint8_t weight_list[NUM_CHANNELS] = {0};
uint32_t pcl_len = 0;
qdf_freq_t pcl_freqs[NUM_CHANNELS] = {0};
uint32_t pcl_freqs[NUM_CHANNELS] = {0};
bool status = false;
enum policy_mgr_pcl_type pcl_type;
char reason[20] = {0};
@@ -595,6 +874,7 @@ void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx)
sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
/* flush the entire table first */
policy_mgr_psoc_disable(hdd_ctx->psoc);
ret = policy_mgr_psoc_enable(hdd_ctx->psoc);
if (!QDF_IS_STATUS_SUCCESS(ret)) {
hdd_err("Policy manager initialization failed");
@@ -625,50 +905,48 @@ void wlan_hdd_one_connection_scenario(struct hdd_context *hdd_ctx)
PM_MAX_NUM_OF_MODE,
PM_MAX_NUM_OF_MODE,
0, 0, 0,
status, pcl_type, reason, pcl_freqs);
status, pcl_type, reason, pcl_freqs,
pcl_len);
}
}
void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
uint8_t first_chnl, enum policy_mgr_chain_mode first_chain_mask)
void wlan_hdd_two_connections_scenario(
struct hdd_context *hdd_ctx,
qdf_freq_t first_chnl,
enum policy_mgr_chain_mode first_chain_mask)
{
uint8_t vdevid = 0, tx_stream = 2, rx_stream = 2;
uint8_t type = WMI_VDEV_TYPE_STA, channel_id = first_chnl, mac_id = 1;
uint8_t mac_id = 1;
uint8_t weight_list[NUM_CHANNELS] = {0};
uint32_t pcl_len = 0;
qdf_freq_t pcl_freqs[NUM_CHANNELS];
uint32_t pcl_freqs[NUM_CHANNELS];
enum policy_mgr_chain_mode chain_mask = first_chain_mask;
enum policy_mgr_con_mode sub_type, next_sub_type, dummy_type;
enum policy_mgr_con_mode sub_type, next_sub_type;
enum policy_mgr_pcl_type pcl_type;
enum policy_mgr_one_connection_mode second_index;
char reason[20] = {0};
bool status = false;
QDF_STATUS ret;
struct policy_mgr_sme_cbacks sme_cbacks;
uint8_t system_pref = 0;
ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &system_pref);
for (sub_type = PM_STA_MODE;
sub_type < PM_MAX_NUM_OF_MODE; sub_type++) {
type = wlan_hdd_valid_type_of_persona(sub_type);
sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
/* flush the entire table first */
policy_mgr_psoc_disable(hdd_ctx->psoc);
ret = policy_mgr_psoc_enable(hdd_ctx->psoc);
if (!QDF_IS_STATUS_SUCCESS(ret)) {
hdd_err("Policy manager initialization failed");
return;
}
/* sub_type mapping between HDD and WMA are different */
wlan_hdd_map_subtypes_hdd_wma(&dummy_type, &sub_type);
/* add first connection as STA */
policy_mgr_incr_connection_count_utfw(
hdd_ctx->psoc, vdevid, tx_stream,
rx_stream, chain_mask, type, dummy_type,
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, channel_id),
mac_id);
rx_stream, chain_mask, sub_type,
first_chnl, mac_id);
/* validate one connection is created or no */
if (policy_mgr_get_connection_count(hdd_ctx->psoc) != 1) {
hdd_err("Test failed - No. of connection is not 1");
@@ -697,7 +975,8 @@ void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
weight_list,
QDF_ARRAY_SIZE(weight_list));
status = wlan_hdd_validate_pcl(hdd_ctx,
pcl_type, pcl_freqs, pcl_len, channel_id, 0,
pcl_type, pcl_freqs, pcl_len,
first_chnl, 0,
reason, sizeof(reason));
if ((pcl_type == PM_MAX_PCL_TYPE) && (pcl_freqs[0] == 0)) {
next_sub_type++;
@@ -706,42 +985,46 @@ void wlan_hdd_two_connections_scenario(struct hdd_context *hdd_ctx,
fill_report(hdd_ctx, "2 connections", sub_type,
next_sub_type,
PM_MAX_NUM_OF_MODE, first_chnl,
0, 0, status, pcl_type, reason, pcl_freqs);
0, 0, status, pcl_type, reason,
pcl_freqs, pcl_len);
next_sub_type++;
}
policy_mgr_decr_connection_count_utfw(
hdd_ctx->psoc, false, vdevid);
}
}
void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
uint8_t first_chnl, uint8_t second_chnl,
qdf_freq_t first_chnl, qdf_freq_t second_chnl,
enum policy_mgr_chain_mode chain_mask, uint8_t use_same_mac)
{
uint8_t vdevid_1 = 0, tx_stream_1 = 2, rx_stream_1 = 2;
uint8_t vdevid_2 = 1, tx_stream_2 = 2, rx_stream_2 = 2;
uint8_t channel_id_1 = first_chnl, channel_id_2 = second_chnl;
uint8_t mac_id_1, mac_id_2;
uint8_t type_1 = WMI_VDEV_TYPE_STA, type_2 = WMI_VDEV_TYPE_STA;
uint8_t weight_list[NUM_CHANNELS] = {0};
uint32_t pcl_len = 0;
qdf_freq_t pcl_freqs[NUM_CHANNELS];
uint32_t pcl_freqs[NUM_CHANNELS];
enum policy_mgr_chain_mode chain_mask_1;
enum policy_mgr_chain_mode chain_mask_2;
enum policy_mgr_con_mode sub_type_1, sub_type_2, next_sub_type;
enum policy_mgr_con_mode dummy_type_1, dummy_type_2;
enum policy_mgr_pcl_type pcl_type;
enum policy_mgr_two_connection_mode third_index;
char reason[20] = {0};
bool status = false;
QDF_STATUS ret;
struct policy_mgr_sme_cbacks sme_cbacks;
uint8_t system_pref = 0;
ucfg_policy_mgr_get_sys_pref(hdd_ctx->psoc, &system_pref);
/* let's set the chain_mask, mac_ids*/
if (chain_mask == POLICY_MGR_TWO_TWO) {
mac_id_1 = 1;
mac_id_2 = 1;
if (use_same_mac) {
mac_id_1 = 1;
mac_id_2 = 1;
} else {
mac_id_1 = 1;
mac_id_2 = 2;
}
chain_mask_1 = POLICY_MGR_TWO_TWO;
chain_mask_2 = POLICY_MGR_TWO_TWO;
} else if (use_same_mac == 1) {
@@ -759,24 +1042,19 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
for (sub_type_1 = PM_STA_MODE;
sub_type_1 < PM_MAX_NUM_OF_MODE; sub_type_1++) {
type_1 = wlan_hdd_valid_type_of_persona(sub_type_1);
sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss;
/* flush the entire table first */
policy_mgr_psoc_disable(hdd_ctx->psoc);
ret = policy_mgr_psoc_enable(hdd_ctx->psoc);
if (!QDF_IS_STATUS_SUCCESS(ret)) {
hdd_err("Policy manager initialization failed");
return;
}
/* sub_type mapping between HDD and WMA are different */
wlan_hdd_map_subtypes_hdd_wma(&dummy_type_1, &sub_type_1);
/* add first connection as STA */
policy_mgr_incr_connection_count_utfw(
hdd_ctx->psoc, vdevid_1, tx_stream_1, rx_stream_1,
chain_mask_1, type_1, dummy_type_1,
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
channel_id_1), mac_id_1);
chain_mask_1, sub_type_1,
first_chnl, mac_id_1);
/* validate one connection is created or no */
if (policy_mgr_get_connection_count(hdd_ctx->psoc) != 1) {
hdd_err("Test fail - No. of connection not 1");
@@ -785,17 +1063,10 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
for (sub_type_2 = PM_STA_MODE;
sub_type_2 < PM_MAX_NUM_OF_MODE; sub_type_2++) {
type_2 = wlan_hdd_valid_type_of_persona(sub_type_2);
/* sub_type mapping between HDD and WMA are different */
wlan_hdd_map_subtypes_hdd_wma(&dummy_type_2,
&sub_type_2);
policy_mgr_incr_connection_count_utfw(
hdd_ctx->psoc, vdevid_2, tx_stream_2,
rx_stream_2, chain_mask_2, type_2,
dummy_type_2,
wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev,
channel_id_2),
mac_id_2);
rx_stream_2, chain_mask_2, sub_type_2,
second_chnl, mac_id_2);
/* validate two connections are created or no */
if (policy_mgr_get_connection_count(hdd_ctx->psoc)
!= 2) {
@@ -826,7 +1097,7 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
QDF_ARRAY_SIZE(weight_list));
status = wlan_hdd_validate_pcl(hdd_ctx,
pcl_type, pcl_freqs, pcl_len,
channel_id_1, channel_id_2,
first_chnl, second_chnl,
reason, sizeof(reason));
if ((pcl_type == PM_MAX_PCL_TYPE) &&
(pcl_freqs[0] == 0)) {
@@ -837,13 +1108,17 @@ void wlan_hdd_three_connections_scenario(struct hdd_context *hdd_ctx,
sub_type_1, sub_type_2,
next_sub_type, first_chnl,
second_chnl, 0, status,
pcl_type, reason, pcl_freqs);
pcl_type, reason, pcl_freqs,
pcl_len);
next_sub_type++;
}
/* remove entry to make a room for next iteration */
policy_mgr_decr_connection_count(hdd_ctx->psoc,
vdevid_2);
policy_mgr_decr_connection_count_utfw(
hdd_ctx->psoc, false, vdevid_2);
}
policy_mgr_decr_connection_count_utfw(
hdd_ctx->psoc, false, vdevid_1);
next_sub_type = PM_STA_MODE;
}
}

查看文件

@@ -6718,13 +6718,13 @@ static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
(apps_args[2] < 0) || (apps_args[3] < 0) ||
(apps_args[4] < 0) || (apps_args[5] < 0) ||
(apps_args[6] < 0) || (apps_args[7] < 0)) {
(apps_args[6] < 0)) {
hdd_err("Invalid input params received for the IOCTL");
return 0;
}
policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
apps_args[0], apps_args[1], apps_args[2], apps_args[3],
apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
apps_args[4], apps_args[5], apps_args[6]);
}
break;
@@ -6843,43 +6843,124 @@ static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
case WE_POLICY_MANAGER_SCENARIO_CMD:
{
#define FREQ_2G_A 2437
#define FREQ_2G_B 2462
#define FREQ_5G_LOW 5180
#define FREQ_5G_HIGH 5745
#define FREQ_6G_A 5975
#define FREQ_6G_B 6135
clean_report(hdd_ctx);
if (apps_args[0] == 1) {
wlan_hdd_one_connection_scenario(hdd_ctx);
} else if (apps_args[0] == 2) {
wlan_hdd_two_connections_scenario(hdd_ctx,
6, POLICY_MGR_TWO_TWO);
wlan_hdd_two_connections_scenario(hdd_ctx,
36, POLICY_MGR_TWO_TWO);
wlan_hdd_two_connections_scenario(hdd_ctx,
6, POLICY_MGR_ONE_ONE);
wlan_hdd_two_connections_scenario(hdd_ctx,
36, POLICY_MGR_ONE_ONE);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_2G_A, POLICY_MGR_TWO_TWO);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_2G_A, POLICY_MGR_ONE_ONE);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_5G_LOW, POLICY_MGR_ONE_ONE);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_5G_LOW, POLICY_MGR_TWO_TWO);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_5G_HIGH, POLICY_MGR_ONE_ONE);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_5G_HIGH, POLICY_MGR_TWO_TWO);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_6G_A, POLICY_MGR_ONE_ONE);
wlan_hdd_two_connections_scenario(
hdd_ctx, FREQ_6G_A, POLICY_MGR_TWO_TWO);
} else if (apps_args[0] == 3) {
/* MCC on same band with 2x2 same mac*/
wlan_hdd_three_connections_scenario(hdd_ctx,
6, 11, POLICY_MGR_TWO_TWO, 0);
/* MCC on diff band with 2x2 same mac*/
wlan_hdd_three_connections_scenario(hdd_ctx,
6, 36, POLICY_MGR_TWO_TWO, 0);
/* MCC on diff band with 1x1 diff mac */
wlan_hdd_three_connections_scenario(hdd_ctx,
36, 6, POLICY_MGR_ONE_ONE, 0);
/* MCC on diff band with 1x1 same mac */
wlan_hdd_three_connections_scenario(hdd_ctx,
36, 6, POLICY_MGR_ONE_ONE, 1);
/* SCC on same band with 2x2 same mac */
wlan_hdd_three_connections_scenario(hdd_ctx,
36, 36, POLICY_MGR_TWO_TWO, 0);
/* SCC on same band with 1x1 same mac */
wlan_hdd_three_connections_scenario(hdd_ctx,
36, 36, POLICY_MGR_ONE_ONE, 1);
/* MCC on same band with 2x2 same mac */
wlan_hdd_three_connections_scenario(hdd_ctx,
36, 149, POLICY_MGR_TWO_TWO, 0);
/* MCC on same band with 1x1 same mac */
wlan_hdd_three_connections_scenario(hdd_ctx,
36, 149, POLICY_MGR_ONE_ONE, 1);
/* PM_STA_SAP_SCC_24_1x1 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_2G_A,
POLICY_MGR_ONE_ONE, 1);
/* PM_STA_SAP_SCC_24_2x2 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_2G_A,
POLICY_MGR_TWO_TWO, 1);
/* PM_STA_SAP_MCC_24_1x1 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_2G_B,
POLICY_MGR_ONE_ONE, 1);
/* PM_STA_SAP_MCC_24_2x2 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_2G_B,
POLICY_MGR_TWO_TWO, 1);
/* PM_STA_SAP_SCC_5_1x1 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_5G_LOW,
POLICY_MGR_ONE_ONE, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_HIGH, FREQ_5G_HIGH,
POLICY_MGR_ONE_ONE, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_6G_A, FREQ_6G_A,
POLICY_MGR_ONE_ONE, 1);
/* PM_STA_SAP_SCC_5_2x2 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_5G_LOW,
POLICY_MGR_TWO_TWO, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_HIGH, FREQ_5G_HIGH,
POLICY_MGR_TWO_TWO, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_6G_A, FREQ_6G_A,
POLICY_MGR_TWO_TWO, 1);
/* PM_STA_SAP_MCC_5_1x1 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_5G_HIGH,
POLICY_MGR_ONE_ONE, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_6G_A,
POLICY_MGR_ONE_ONE, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_6G_A, FREQ_6G_B,
POLICY_MGR_ONE_ONE, 1);
/* PM_STA_SAP_MCC_5_2x2 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_5G_HIGH,
POLICY_MGR_TWO_TWO, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_6G_A,
POLICY_MGR_TWO_TWO, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_6G_A, FREQ_6G_B,
POLICY_MGR_TWO_TWO, 1);
/* PM_STA_SAP_MCC_24_5_1x1 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_5G_HIGH,
POLICY_MGR_ONE_ONE, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_6G_A,
POLICY_MGR_ONE_ONE, 1);
/* PM_STA_SAP_MCC_24_5_2x2 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_5G_HIGH,
POLICY_MGR_TWO_TWO, 1);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_6G_A,
POLICY_MGR_TWO_TWO, 1);
/* PM_STA_SAP_DBS_1x1 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_5G_HIGH,
POLICY_MGR_ONE_ONE, 0);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_6G_A,
POLICY_MGR_ONE_ONE, 0);
/* PM_STA_SAP_DBS_2x2 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_5G_HIGH,
POLICY_MGR_TWO_TWO, 0);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_2G_A, FREQ_6G_A,
POLICY_MGR_TWO_TWO, 0);
/* PM_STA_SAP_SBS_5_1x1 or PM_STA_SAP_SBS_5_2x2 */
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_5G_HIGH,
POLICY_MGR_ONE_ONE, 0);
wlan_hdd_three_connections_scenario(
hdd_ctx, FREQ_5G_LOW, FREQ_6G_A,
POLICY_MGR_ONE_ONE, 0);
}
print_report(hdd_ctx);
}