qcacld-3.0: Fix follow-up comments for csa changes in STA/CLI case

Move cdf/cds module related operation from
lim_handle_hw_mode_change_on_csa to cdf_handle_hw_mode_change_on_csa
to keep majority of cdf/cds operation in one place.

Change-Id: I5af9ee941f8430be49cf2e467f9eac77dc09dde4
CRs-Fixed: 972184
This commit is contained in:
Krunal Soni 2016-02-11 11:48:53 -08:00 • committed by Vishwajith Upendra
commit ee57247afe
3 changed files with 90 additions and 56 deletions

View file

@ -657,4 +657,7 @@ QDF_STATUS qdf_reset_connection_update(void);
QDF_STATUS qdf_set_connection_update(void);
QDF_STATUS qdf_init_connection_update(void);
QDF_STATUS cds_stop_start_opportunistic_timer(void);
QDF_STATUS cds_handle_hw_mode_change_on_csa(uint16_t session_id,
uint8_t channel, uint8_t *bssid, void *dst, void *src,
uint32_t numbytes);
#endif /* __CDS_CONCURRENCY_H */

View file

@ -8015,3 +8015,84 @@ QDF_STATUS cds_stop_start_opportunistic_timer(void)
return status;
}
/**
* cds_handle_hw_mode_change_on_csa() - handle hw mode change for csa
* @session_id: SME session id
* @channel: given channel
* @bssid: pointer to bssid
* @dst: pointer to dest buffer
* @src: pointer to src buffer
* @numbytes: number of bytes to copy from src to dst
*
* Use this function to decide whether the hw mode upgrage or downgrade
* is required based on session_id and given channel
*
* Return: QDF_STATUS
*/
QDF_STATUS cds_handle_hw_mode_change_on_csa(uint16_t session_id,
uint8_t channel, uint8_t *bssid, void *dst, void *src,
uint32_t numbytes)
{
enum cds_conc_next_action action;
QDF_STATUS status;
/*
* Since all the write to the policy manager table happens in the
* MC thread context and this channel change event is also processed
* in the MC thread context, explicit lock/unlock of qdf_conc_list_lock
* is not done here
*/
action = cds_get_pref_hw_mode_for_chan(session_id, channel);
if (action == CDS_NOP) {
cds_info("no need for hw mode change");
/* Proceed with processing csa params. So, not freeing it */
return QDF_STATUS_SUCCESS;
}
cds_info("session:%d action:%d", session_id, action);
/*
* 1. Start opportunistic timer
* 2. Do vdev restart on the new channel (by the caller)
* 3. PM will check if MCC upgrade can be done after timer expiry
*/
if (action == CDS_MCC_UPGRADE) {
status = cds_stop_start_opportunistic_timer();
if (QDF_IS_STATUS_SUCCESS(status))
cds_info("opportunistic timer for MCC upgrade");
/*
* After opportunistic timer is triggered, we can go ahead
* with processing the csa params. So, not freeing the memory
* through 'err' label.
*/
return QDF_STATUS_SUCCESS;
}
/*
* CDS_DBS_DOWNGRADE:
* 1. PM will initiate HW mode change to DBS rightaway
* 2. Do vdev restart on the new channel (on getting hw mode resp)
*/
status = cds_next_actions(session_id, action,
CDS_UPDATE_REASON_CHANNEL_SWITCH_STA);
if (!QDF_IS_STATUS_SUCCESS(status)) {
cds_err("no set hw mode command was issued");
/* Proceed with processing csa params. So, not freeing it */
return QDF_STATUS_SUCCESS;
} else {
if ((NULL == dst) || (NULL == src)) {
cds_err("given buffers are null, can't copy csa param");
return QDF_STATUS_E_FAILURE;
}
/* Save the csa params to be used after DBS downgrade */
qdf_mem_copy(dst, src, numbytes);
cds_info("saved csa params for dbs downgrade for bssid %pM",
bssid);
/* Returning error so that csa params are not processed here */
status = QDF_STATUS_E_FAILURE;
}
return status;
}

View file

@ -1174,7 +1174,6 @@ static QDF_STATUS lim_handle_hw_mode_change_on_csa(tpAniSirGlobal mac_ctx,
tpDphHashNode sta_ds = NULL;
uint8_t session_id;
uint16_t aid = 0;
enum cds_conc_next_action action;
QDF_STATUS status = QDF_STATUS_E_FAILURE;
lim_log(mac_ctx, LOG1, FL("handle hw mode change for csa"));
@ -1200,62 +1199,13 @@ static QDF_STATUS lim_handle_hw_mode_change_on_csa(tpAniSirGlobal mac_ctx,
goto err;
}
/* Since all the write to the policy manager table happens in the
* MC thread context and this channel change event is also processed
* in the MC thread context, explicit lock/unlock of qdf_conc_list_lock
* is not done here
*/
action = cds_get_pref_hw_mode_for_chan(session_entry->smeSessionId,
csa_params->channel);
status = cds_handle_hw_mode_change_on_csa(session_entry->smeSessionId,
csa_params->channel, csa_params->bssId,
&session_entry->saved_csa_params, csa_params,
sizeof(session_entry->saved_csa_params));
if (action == CDS_NOP) {
lim_log(mac_ctx, LOG1, FL("no need for hw mode change"));
/* Proceed with processing csa params. So, not freeing it */
return QDF_STATUS_SUCCESS;
}
lim_log(mac_ctx, LOG1, FL("session:%d action:%d"),
session_entry->smeSessionId, action);
/* 1. Start opportunistic timer
* 2. Do vdev restart on the new channel (by the caller)
* 3. PM will check if MCC upgrade can be done after timer expiry
*/
if (action == CDS_MCC_UPGRADE) {
status = cds_stop_start_opportunistic_timer();
if (QDF_IS_STATUS_SUCCESS(status))
lim_log(mac_ctx, LOG1,
FL("opportunistic timer for MCC upgrade"));
/* After opportunistic timer is triggered, we can go ahead
* with processing the csa params. So, not freeing the memory
* through 'err' label.
*/
return QDF_STATUS_SUCCESS;
}
/* CDS_DBS_DOWNGRADE:
* 1. PM will initiate HW mode change to DBS rightaway
* 2. Do vdev restart on the new channel (on getting hw mode resp)
*/
status = cds_next_actions(session_entry->smeSessionId, action,
CDS_UPDATE_REASON_CHANNEL_SWITCH_STA);
if (!QDF_IS_STATUS_SUCCESS(status)) {
lim_log(mac_ctx, LOGE, FL("no set hw mode command was issued"));
/* Proceed with processing csa params. So, not freeing it */
return QDF_STATUS_SUCCESS;
} else {
/* Save the csa params to be used after DBS downgrade */
qdf_mem_copy(&session_entry->saved_csa_params, csa_params,
sizeof(session_entry->saved_csa_params));
lim_log(mac_ctx, LOG1,
FL("saved csa params for dbs downgrade for %pM"),
session_entry->saved_csa_params.bssId);
/* Returning error so that csa params are not processed here */
status = QDF_STATUS_E_FAILURE;
}
if (QDF_IS_STATUS_SUCCESS(status))
return status;
err:
qdf_mem_free(csa_params);