qcacld-3.0: Modify set hw mode sequence on channel switch scenarios

Modify the set hardware mode command sequence during channel switch
in the case of SAP/P2P-GO and STA/P2P-CLI as per the latest FW
requirements. This is primarily to accommodate the time take for
calibration during hardware mode change which could lead to
momentary data stalls.

The new sequence is as follows:
    1. Send (E)CSA
    2. Do vdev restart/vdev up
    3. For DBS downgrade:
       a. PM will initiate HW mode change to DBS right away
    4. For single MAC upgrade:
       a. Opportunistic timer is started, PM will check if MCC
          upgrade can be done on timer expiry

The old sequence is as follows:
    For MCC upgrade:
        1. Send (E)CSA
        2. Opportunistic timer is started
        3. vdev restart is initiated on the new channel
        4. PM will check if MCC upgrade can be done on timer expiry
    For single mac upgrade:
        1. Send (E)CSA
        2. PM will initiate HW mode change to DBS right away
        3. vdev restart is initiated on the new channel

Change-Id: I4bce2ee176cae43b6a46c47216ed7ab47a82a54c
CRs-Fixed: 1006992
This commit is contained in:
Manishekar Chandrasekaran
2016-04-22 12:19:04 +05:30
committed by Gerrit - the friendly Code Review server
parent 7edffe037b
commit cb0521722b
18 changed files with 298 additions and 550 deletions

View File

@@ -506,128 +506,6 @@ wlansap_roam_process_ch_change_success(tpAniSirGlobal mac_ctx,
*ret_status = QDF_STATUS_E_FAILURE;
}
/**
* wlansap_set_hw_mode_on_channel_switch() - Set hw mode before channel switch
* @sap_ctx: Global SAP context
* @target_channel: Target channel
*
* Sets hw mode, if needed, before doing a channel switch
*
* Return: None
*/
static QDF_STATUS wlansap_set_hw_mode_on_channel_switch(tpAniSirGlobal mac_ctx,
ptSapContext sap_ctx,
uint32_t target_channel)
{
QDF_STATUS status = QDF_STATUS_E_FAILURE, qdf_status;
cds_context_type *cds_ctx;
enum cds_conc_next_action action;
cds_ctx = cds_get_context(QDF_MODULE_ID_QDF);
if (!cds_ctx) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
FL("Invalid CDS Context"));
return status;
}
qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock);
action = cds_get_pref_hw_mode_for_chan(sap_ctx->sessionId,
target_channel);
if ((action != CDS_DBS_DOWNGRADE) && (action != CDS_MCC_UPGRADE)) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
FL("Invalid action: %d"), action);
goto done;
}
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
FL("action:%d session id:%d"),
action, sap_ctx->sessionId);
/* For MCC, opportunistic timer will be trigerred. We do not
* want to do hw mode change here to avoid the ping pong effect.
* e.g., If a new connection is immediately coming up, we could be
* moving in and out of MCC. The timer after DBS_OPPORTUNISTIC_TIME
* seconds will check if the driver can move to MCC or not.
*
* 1. Start opportunistic timer
* 2. Do vdev restart on the new channel
* 3. PM will check if MCC upgrade can be done after timer expiry
*/
if (action == CDS_MCC_UPGRADE) {
qdf_mc_timer_stop(&cds_ctx->dbs_opportunistic_timer);
qdf_status = qdf_mc_timer_start(
&cds_ctx->dbs_opportunistic_timer,
DBS_OPPORTUNISTIC_TIME *
1000);
if (!QDF_IS_STATUS_SUCCESS(qdf_status))
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
FL("Failed to start dbs opportunistic timer"));
else
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG,
FL("opportunistic timer for MCC upgrade"));
goto done;
}
/* For DBS, we want to move right away to DBS mode. Else, we could
* be doing MCC momentarily.
*
* 1. PM will initiate HW mode change to DBS rightaway
* 2. Do vdev restart on the new channel
*/
status = cds_next_actions(sap_ctx->sessionId, action,
SIR_UPDATE_REASON_CHANNEL_SWITCH);
if (!QDF_IS_STATUS_SUCCESS(status)) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
FL("no set hw mode command was issued"));
goto done;
}
done:
qdf_mutex_release(&cds_ctx->qdf_conc_list_lock);
/* success must be returned only when a set hw mode was done */
return status;
}
/**
* wlansap_update_hw_mode() - Set the hw mode for the new channel switch
* @hal: HAL pointer
* @sap_ctx: SAP context
*
* Sets the hw mode, if needed, for the driver based on the new channel
* to which the vdev is going to switch to
*
* Return: None
*/
void wlansap_update_hw_mode(tHalHandle hal, ptSapContext sap_ctx)
{
QDF_STATUS status = QDF_STATUS_E_FAILURE;
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
tCsrRoamInfo roam_info = {0};
if (mac_ctx->policy_manager_enabled &&
wma_is_hw_dbs_capable() == true) {
status = wlansap_set_hw_mode_on_channel_switch(mac_ctx, sap_ctx,
mac_ctx->sap.SapDfsInfo.target_channel);
}
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
FL("status:%d"), status);
/*
* If no set hw mode was done, proceed as before by doing set channel.
* If set hw mode was done, perform the following in the callback so
* that the set channel operations are done after the driver moves to
* the required hw mode.
*/
if (!QDF_IS_STATUS_SUCCESS(status)) {
csr_roam_call_callback(mac_ctx, sap_ctx->sessionId,
&roam_info, 0,
eCSR_ROAM_STATUS_UPDATE_HW_MODE,
eCSR_ROAM_RESULT_UPDATE_HW_MODE);
}
}
/**
* wlansap_roam_process_dfs_chansw_update() - handles the case for
* eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS in wlansap_roam_callback()
@@ -1097,10 +975,6 @@ wlansap_roam_callback(void *ctx, tCsrRoamInfo *csr_roam_info, uint32_t roamId,
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("Received Chan Sw Update Notification"));
break;
case eCSR_ROAM_STATUS_UPDATE_HW_MODE:
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("Received HW mode update notification"));
break;
case eCSR_ROAM_SET_CHANNEL_RSP:
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("Received set channel response"));
@@ -1316,26 +1190,8 @@ wlansap_roam_callback(void *ctx, tCsrRoamInfo *csr_roam_info, uint32_t roamId,
&qdf_ret_status);
break;
case eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS:
/* eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS indicates the
* completion of sending (E)CSA IEs. After these IEs are sent,
* in eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS state, check
* for DBS downgrade/MCC upgrade is done.
* (1) From this state
* eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS, on MCC upgrade,
* transition immediately happens to the state
* eCSR_ROAM_RESULT_UPDATE_HW_MODE, where the vdev restart
* happens internally.
* (2) From this state,
* eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS, on DBS downgrade,
* transition happens to the state
* eCSR_ROAM_RESULT_UPDATE_HW_MODE to do vdev restart only after
* SME received the set HW mode response.
*/
wlansap_update_hw_mode(hal, sap_ctx);
break;
case eCSR_ROAM_RESULT_UPDATE_HW_MODE:
wlansap_roam_process_dfs_chansw_update(hal, sap_ctx,
&qdf_ret_status);
&qdf_ret_status);
break;
case eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS:
wlansap_roam_process_ch_change_success(mac_ctx, sap_ctx,