From ee57247afe09dbdf6003c52b172dbe5b974568d5 Mon Sep 17 00:00:00 2001 From: Krunal Soni Date: Thu, 11 Feb 2016 11:48:53 -0800 Subject: [PATCH] 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 --- core/cds/inc/cds_concurrency.h | 3 + core/cds/src/cds_concurrency.c | 81 +++++++++++++++++++ .../src/pe/lim/lim_process_message_queue.c | 62 ++------------ 3 files changed, 90 insertions(+), 56 deletions(-) diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h index 8bfa5663bb53..98cfafba73ad 100644 --- a/core/cds/inc/cds_concurrency.h +++ b/core/cds/inc/cds_concurrency.h @@ -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 */ diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index adf5108a2aae..38f17b9287a3 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -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; +} diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index 664c5233cde2..4064a074ce6f 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -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);