qcacmn: Enforce MCC to SCC for 3-port combinations

This update is for moving of AP/GO to enforce SCC for 3-port
combinations AP+AP+STA and AP+GO+STA.

Change-Id: I878b56cd8215f0d0f846af62fa2033b268e96317
CRs-Fixed: 2127091
This commit is contained in:
Rachit Kankane 2017-09-15 19:38:49 +05:30 • committed by snandini
commit a07e4b97d4
3 changed files with 94 additions and 92 deletions

View file

@ -597,12 +597,15 @@ static bool policy_mgr_is_restart_sap_allowed(
struct wlan_objmgr_psoc *psoc,
uint32_t mcc_to_scc_switch)
{
uint32_t sta_ap_bit_mask = QDF_STA_MASK | QDF_SAP_MASK;
uint32_t sta_go_bit_mask = QDF_STA_MASK | QDF_P2P_GO_MASK;
if ((mcc_to_scc_switch == QDF_MCC_TO_SCC_SWITCH_DISABLE) ||
!policy_mgr_concurrent_open_sessions_running(psoc) ||
!((policy_mgr_get_concurrency_mode(psoc) ==
(QDF_STA_MASK | QDF_SAP_MASK)) ||
(policy_mgr_get_concurrency_mode(psoc) ==
(QDF_STA_MASK | QDF_P2P_GO_MASK)))) {
!(((policy_mgr_get_concurrency_mode(psoc) & sta_ap_bit_mask)
== sta_ap_bit_mask) ||
((policy_mgr_get_concurrency_mode(psoc) & sta_go_bit_mask)
== sta_go_bit_mask))) {
policy_mgr_err("MCC switch disabled or not concurrent STA/SAP, STA/GO");
return false;
}
@ -653,10 +656,11 @@ void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
struct wlan_objmgr_psoc *psoc;
struct policy_mgr_psoc_priv_obj *pm_ctx = NULL;
struct sta_ap_intf_check_work_ctx *work_info = NULL;
uint32_t mcc_to_scc_switch;
uint32_t mcc_to_scc_switch, cc_count = 0, i;
QDF_STATUS status;
uint8_t channel, sec_ch;
uint8_t operating_channel, vdev_id;
uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS];
uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS];
work_info = (struct sta_ap_intf_check_work_ctx *) data;
if (!work_info) {
@ -684,19 +688,18 @@ void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
if (!policy_mgr_is_restart_sap_allowed(psoc, mcc_to_scc_switch))
goto end;
if (policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel,
&vdev_id,
PM_SAP_MODE)) {
policy_mgr_debug("SAP operating at channel:%d",
operating_channel);
} else if (policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel,
&vdev_id,
PM_P2P_GO_MODE)) {
policy_mgr_debug("GO operating at channel:%d",
operating_channel);
} else {
cc_count = policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel[cc_count],
&vdev_id[cc_count],
PM_SAP_MODE);
policy_mgr_debug("Number of concurrent SAP: %d", cc_count);
cc_count = cc_count + policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel[cc_count],
&vdev_id[cc_count],
PM_P2P_GO_MODE);
policy_mgr_debug("Number of beaconing entities (SAP + GO):%d",
cc_count);
if (!cc_count) {
policy_mgr_err("Could not retrieve SAP/GO operating channel&vdevid");
goto end;
}
@ -705,16 +708,18 @@ void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data)
policy_mgr_err("SAP restart get channel callback in NULL");
goto end;
}
status = pm_ctx->hdd_cbacks.
wlan_hdd_get_channel_for_sap_restart(psoc, vdev_id,
&channel, &sec_ch);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to switch SAP channel");
goto end;
for (i = 0; i < cc_count; i++) {
status = pm_ctx->hdd_cbacks.
wlan_hdd_get_channel_for_sap_restart(psoc,
vdev_id[i], &channel, &sec_ch);
if (status == QDF_STATUS_SUCCESS) {
policy_mgr_info("SAP restarts due to MCC->SCC switch, old chan :%d new chan: %d"
, operating_channel[i], channel);
break;
}
}
policy_mgr_info("SAP restarts due to MCC->SCC switch, old chan :%d new chan: %d",
operating_channel, channel);
if (status != QDF_STATUS_SUCCESS)
policy_mgr_err("Failed to switch SAP channel");
end:
if (work_info) {
qdf_mem_free(work_info);
@ -842,20 +847,12 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
return;
}
if (policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel,
&vdev_id,
PM_SAP_MODE)) {
policy_mgr_debug("SAP operating at channel:%d",
operating_channel);
} else if (policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel,
&vdev_id,
PM_P2P_GO_MODE)) {
policy_mgr_debug("GO operating at channel:%d",
operating_channel);
if (policy_mgr_get_mode_specific_conn_info(psoc, &operating_channel,
&vdev_id, PM_STA_MODE)) {
policy_mgr_debug("STA operating Channel: %u",
operating_channel);
} else {
policy_mgr_err("Could not get SAP/GO operating channel&vdevid");
policy_mgr_err("Could not get STA operating channel&vdevid");
return;
}
@ -871,8 +868,7 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
}
if ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) &&
policy_mgr_valid_sta_channel_check(psoc,
operating_channel)
policy_mgr_valid_sta_channel_check(psoc, operating_channel)
&& !pm_ctx->sta_ap_intf_check_work_info) {
struct sta_ap_intf_check_work_ctx *work_info;
work_info = qdf_mem_malloc(

View file

@ -1404,24 +1404,23 @@ bool policy_mgr_is_ibss_conn_exist(struct wlan_objmgr_psoc *psoc,
return status;
}
bool policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc,
uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc,
uint8_t *channel, uint8_t *vdev_id,
enum policy_mgr_con_mode mode)
{
uint32_t count, index = 0;
uint32_t count = 0, index = 0;
uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
bool status = false;
struct policy_mgr_psoc_priv_obj *pm_ctx;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return false;
return count;
}
if (NULL == channel || NULL == vdev_id) {
policy_mgr_err("Null pointer error");
return false;
return count;
}
count = policy_mgr_mode_specific_connection_count(
@ -1429,28 +1428,23 @@ bool policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc,
qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
if (count == 0) {
policy_mgr_debug("No mode:[%d] connection", mode);
status = false;
} else if (count == 1) {
*channel = pm_conc_connection_list[list[index]].chan;
*vdev_id =
pm_conc_connection_list[list[index]].vdev_id;
status = true;
} else {
/*
* Todo Currently the first SAP connection info is
* returned. Modify this to accommodate SAP+SAP+STA
* and SAP+SAP+P2P
*/
*channel = pm_conc_connection_list[list[index]].chan;
*vdev_id =
for (index = 0; index < count; index++) {
channel[index] =
pm_conc_connection_list[list[index]].chan;
vdev_id[index] =
pm_conc_connection_list[list[index]].vdev_id;
policy_mgr_debug("Multiple mode:[%d] connections, picking first one",
mode);
status = true;
}
policy_mgr_debug("Multiple mode:[%d] connections", mode);
}
qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
return status;
return count;
}
bool policy_mgr_max_concurrent_connections_reached(
@ -2472,7 +2466,9 @@ bool policy_mgr_is_dnsc_set(struct wlan_objmgr_vdev *vdev)
QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
uint8_t channel, bool *ok)
{
uint8_t operating_channel = 0, vdev_id = 0;
uint32_t cc_count = 0, i;
uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS];
uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS];
struct wlan_objmgr_vdev *vdev;
if (!channel || !ok) {
@ -2480,27 +2476,31 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
return QDF_STATUS_E_INVAL;
}
if (policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel,
&vdev_id,
PM_SAP_MODE))
policy_mgr_debug("SAP mode active");
else if (policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel,
&vdev_id,
PM_P2P_GO_MODE))
policy_mgr_debug("P2P_GO_MODE mode active");
else {
cc_count = policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel[cc_count],
&vdev_id[cc_count],
PM_SAP_MODE);
policy_mgr_debug("Number of SAP modes: %d", cc_count);
cc_count = cc_count + policy_mgr_get_mode_specific_conn_info(psoc,
&operating_channel[cc_count],
&vdev_id[cc_count],
PM_P2P_GO_MODE);
policy_mgr_debug("Number of beaconing entities (SAP + GO):%d",
cc_count);
if (!cc_count) {
*ok = true;
return QDF_STATUS_SUCCESS;
}
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
for (i = 0; i < cc_count; i++) {
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
vdev_id[i],
WLAN_POLICY_MGR_ID);
if (!vdev) {
policy_mgr_err("vdev is NULL");
return QDF_STATUS_E_INVAL;
}
if (!vdev) {
policy_mgr_err("vdev for vdev_id:%d is NULL",
vdev_id[i]);
return QDF_STATUS_E_INVAL;
}
/**
* If channel passed is same as AP/GO operating channel, then
@ -2511,18 +2511,24 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
* return true.
*/
/* TODO: To be enhanced for SBS */
if (policy_mgr_is_dnsc_set(vdev)) {
if (operating_channel == channel)
if (policy_mgr_is_dnsc_set(vdev)) {
if (operating_channel[i] == channel) {
*ok = true;
wlan_objmgr_vdev_release_ref(vdev,
WLAN_POLICY_MGR_ID);
break;
} else if (WLAN_REG_IS_SAME_BAND_CHANNELS(
operating_channel[i], channel)) {
*ok = false;
wlan_objmgr_vdev_release_ref(vdev,
WLAN_POLICY_MGR_ID);
break;
}
} else {
*ok = true;
else if (WLAN_REG_IS_SAME_BAND_CHANNELS(operating_channel,
channel))
*ok = false;
else
*ok = true;
} else {
*ok = true;
}
wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID);
}
wlan_objmgr_vdev_release_ref(vdev, WLAN_POLICY_MGR_ID);
return QDF_STATUS_SUCCESS;
}

View file

@ -410,15 +410,15 @@ QDF_STATUS policy_mgr_reset_sap_mandatory_channels(
* policy_mgr_get_mode_specific_conn_info() - Get active mode specific
* channel and vdev id
* @psoc: PSOC object information
* @channel: Mode specific channel
* @vdev_id: Mode specific vdev id
* @channel: Mode specific channel (list)
* @vdev_id: Mode specific vdev id (list)
* @mode: Connection Mode
*
* Get active mode specific channel and vdev id
*
* Return: true for success, else false
* Return: number of connection found as per given mode
*/
bool policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc,
uint32_t policy_mgr_get_mode_specific_conn_info(struct wlan_objmgr_psoc *psoc,
uint8_t *channel, uint8_t *vdev_id,
enum policy_mgr_con_mode mode);