qcacmn: Add DBS to DBS switch for vdev Down

Add DBS to DBS switch in opportunistic timer
handler when vdev prioritization enabled.

Change-Id: I902316d7f64427bcadf1131cc0b822d23fc172fa
CRs-Fixed: 2338092
This commit is contained in:
Liangwei Dong 2018-05-25 05:55:37 -04:00 • committed by nshrivas
commit 4bf807e8f4
4 changed files with 64 additions and 19 deletions

View file

@ -1150,16 +1150,30 @@ struct policy_mgr_wma_cbacks {
};
/**
* policy_mgr_need_opportunistic_upgrade() - Tells us if we really
* need an upgrade to 2x2
* @psoc: PSOC object information
* This function returns if updrade to 2x2 is needed
*
* Return: PM_NOP = upgrade is not needed, otherwise upgrade is
* needed
*/
* policy_mgr_need_opportunistic_upgrade - check whether needs to change current
* HW mode to single mac 2x2 or the other DBS mode(for Dual DBS HW only).
* @psoc: PSOC object information
* @reason: enum policy_mgr_conn_update_reason
*
* This function is to check whether needs to change to single Mac mode.
* when opportunistic timer fired. But a special case for Dual DBS HW, this
* function will check DBS to DBS change is required or not:
* 1. For Dual DBS HW, if user set vdev priority list, we may need to do
* DBS to DBS switching.
* eg. P2P GO (2g) < SAP (5G) < STA (2g) in DBS2.
* If STA down, we need to switch to DBS1: P2P GO (2g) < SAP (5g).
* So, for opportunistic checking, we need to add DBS ->DBS checking
* as well.
* 2. Reason code :
* DBS -> Single MAC : POLICY_MGR_UPDATE_REASON_OPPORTUNISTIC
* DBS -> DBS : POLICY_MGR_UPDATE_REASON_PRI_VDEV_CHANGE
*
* return: PM_NOP, upgrade is not needed, otherwise new action type
* and reason code be returned.
*/
enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade(
struct wlan_objmgr_psoc *psoc);
struct wlan_objmgr_psoc *psoc,
enum policy_mgr_conn_update_reason *reason);
/**
* policy_mgr_next_actions() - initiates actions needed on current

View file

@ -751,6 +751,10 @@ enum policy_mgr_band {
* @POLICY_MGR_UPDATE_REASON_NSS_UPDATE: NSS update
* @POLICY_MGR_UPDATE_REASON_CHANNEL_SWITCH: Channel switch
* @POLICY_MGR_UPDATE_REASON_CHANNEL_SWITCH_STA: Channel switch for STA
* @POLICY_MGR_UPDATE_REASON_PRI_VDEV_CHANGE: In Dual DBS HW, if the vdev based
* 2x2 preference enabled, the vdev down may cause prioritized active
* vdev change, then DBS hw mode may needs to change from one DBS mode
* to the other DBS mode. This reason code indicates such condition.
*/
enum policy_mgr_conn_update_reason {
POLICY_MGR_UPDATE_REASON_SET_OPER_CHAN,
@ -764,6 +768,7 @@ enum policy_mgr_conn_update_reason {
POLICY_MGR_UPDATE_REASON_CHANNEL_SWITCH,
POLICY_MGR_UPDATE_REASON_CHANNEL_SWITCH_STA,
POLICY_MGR_UPDATE_REASON_PRE_CAC,
POLICY_MGR_UPDATE_REASON_PRI_VDEV_CHANGE,
};
/**

View file

@ -105,7 +105,7 @@ QDF_STATUS policy_mgr_check_n_start_opportunistic_timer(
policy_mgr_err("PM ctx not valid. Oppurtunistic timer cannot start");
return QDF_STATUS_E_FAILURE;
}
if (policy_mgr_need_opportunistic_upgrade(psoc)) {
if (policy_mgr_need_opportunistic_upgrade(psoc, NULL)) {
/* let's start the timer */
qdf_mc_timer_stop(&pm_ctx->dbs_opportunistic_timer);
status = qdf_mc_timer_start(
@ -182,10 +182,12 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc,
}
enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade(
struct wlan_objmgr_psoc *psoc)
struct wlan_objmgr_psoc *psoc,
enum policy_mgr_conn_update_reason *reason)
{
uint32_t conn_index;
enum policy_mgr_conc_next_action upgrade = PM_NOP;
enum policy_mgr_conc_next_action preferred_dbs_action;
uint8_t mac = 0;
struct policy_mgr_hw_mode_params hw_mode;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
@ -194,22 +196,22 @@ enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade(
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
goto done;
goto exit;
}
if (policy_mgr_is_hw_dbs_capable(psoc) == false) {
policy_mgr_err("driver isn't dbs capable, no further action needed");
goto done;
goto exit;
}
status = policy_mgr_get_current_hw_mode(psoc, &hw_mode);
if (!QDF_IS_STATUS_SUCCESS(status)) {
policy_mgr_err("policy_mgr_get_current_hw_mode failed");
goto done;
goto exit;
}
if (!hw_mode.dbs_cap) {
policy_mgr_debug("current HW mode is non-DBS capable");
goto done;
goto exit;
}
qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
@ -248,6 +250,8 @@ enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade(
}
/* Let's request for single MAC mode */
upgrade = PM_SINGLE_MAC;
if (reason)
*reason = POLICY_MGR_UPDATE_REASON_OPPORTUNISTIC;
/* Is there any connection had an initial connection with 2x2 */
for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
conn_index++) {
@ -261,6 +265,26 @@ enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade(
qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
done:
if (upgrade == PM_NOP && hw_mode.dbs_cap &&
policy_mgr_is_2x2_1x1_dbs_capable(psoc)) {
preferred_dbs_action =
policy_mgr_get_preferred_dbs_action_table(
psoc, INVALID_VDEV_ID, 0, 0);
if (hw_mode.action_type == PM_DBS1 &&
preferred_dbs_action == PM_DBS2) {
upgrade = PM_DBS2_DOWNGRADE;
if (reason)
*reason =
POLICY_MGR_UPDATE_REASON_PRI_VDEV_CHANGE;
} else if (hw_mode.action_type == PM_DBS2 &&
preferred_dbs_action == PM_DBS1) {
upgrade = PM_DBS1_DOWNGRADE;
if (reason)
*reason =
POLICY_MGR_UPDATE_REASON_PRI_VDEV_CHANGE;
}
}
exit:
return upgrade;
}
@ -1908,6 +1932,7 @@ void policy_mgr_check_and_stop_opportunistic_timer(
struct policy_mgr_psoc_priv_obj *pm_ctx;
enum policy_mgr_conc_next_action action = PM_NOP;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
enum policy_mgr_conn_update_reason reason;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
@ -1917,11 +1942,11 @@ void policy_mgr_check_and_stop_opportunistic_timer(
if (QDF_TIMER_STATE_RUNNING ==
pm_ctx->dbs_opportunistic_timer.state) {
qdf_mc_timer_stop(&pm_ctx->dbs_opportunistic_timer);
action = policy_mgr_need_opportunistic_upgrade(psoc);
action = policy_mgr_need_opportunistic_upgrade(psoc, &reason);
if (action) {
qdf_event_reset(&pm_ctx->opportunistic_update_done_evt);
status = policy_mgr_next_actions(psoc, id, action,
POLICY_MGR_UPDATE_REASON_OPPORTUNISTIC);
reason);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed in policy_mgr_next_actions");
return;

View file

@ -1394,6 +1394,7 @@ void pm_dbs_opportunistic_timer_handler(void *data)
enum policy_mgr_conc_next_action action = PM_NOP;
uint32_t session_id;
struct wlan_objmgr_psoc *psoc = (struct wlan_objmgr_psoc *)data;
enum policy_mgr_conn_update_reason reason;
if (!psoc) {
policy_mgr_err("Invalid Context");
@ -1401,13 +1402,13 @@ void pm_dbs_opportunistic_timer_handler(void *data)
}
/* if we still need it */
action = policy_mgr_need_opportunistic_upgrade(psoc);
action = policy_mgr_need_opportunistic_upgrade(psoc, &reason);
policy_mgr_debug("action:%d", action);
if (!action)
return;
session_id = pm_get_vdev_id_of_first_conn_idx(psoc);
policy_mgr_next_actions(psoc, session_id, action,
POLICY_MGR_UPDATE_REASON_OPPORTUNISTIC);
reason);
}
/**