diff options
| author | Manishekar Chandrasekaran <cmshekar@codeaurora.org> | 2016-08-09 18:52:50 +0530 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-08-18 09:11:47 -0700 |
| commit | d3ee9756dcfecb6445186402e2a2d1788c57877d (patch) | |
| tree | c49dcd934f09fc7bbd33816e277f5183b2612f46 | |
| parent | cf6ce2c055d48e2c86770cadd0a6e3341aef8803 (diff) | |
qcacld-3.0: Ensure MAS commands to be made PDEV specific
Make MAS (MCC Adaptive Scheduler) commands to be PDEV
specific.
Two instances of OCS (Off Channel Scheduler) can exist
in the FW (one per MAC) and FW provides the option of
enabling and disabling MAS on a per MAC basis. But,
Host does not have enable/disable option for individual
MACs. So, the agreement with the FW is for the Host to
send down a ‘pdev id’ of 0. When ‘pdev id’ of 0 is used,
FW treats this as a SOC level command and applies the
same value to both MACs. So, irrespective of the value
of ‘WMI_SERVICE_DEPRECATED_REPLACE’ in the WMI service
bit map, the pdev id needs to be ‘0’ (SOC level) for
the WMI command
WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID.
WMI command WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID to set
the MCC quota is sent down as channel – value pairs.
The value being channel time quota and the channel being
sent down is a home channel. The additional requirement
from FW is that all the channels in a single WMI command
belong to the same MAC. FW asserts if the WMI command
mixes and matches home channels associated with
different MACs. So, although the PDEV ID is not part of
the WMI command struct, the cmd is in a sense PDEV
specific.
There is no change in the WMI command
WMI_RESMGR_SET_CHAN_LATENCY_CMDID to make it PDEV
specific since this WMI command always send only one
channel-latency pair to the FW. So, there shouldn’t be
any problem of FW receiving home channels associated
with different MACs, for this WMI command.
Change-Id: Ie22800e07bbeef65c43f9171de828533b982a06b
CRs-Fixed: 1052652
| -rw-r--r-- | core/cds/inc/cds_concurrency.h | 4 | ||||
| -rw-r--r-- | core/cds/src/cds_concurrency.c | 288 | ||||
| -rw-r--r-- | core/wma/src/wma_data.c | 17 |
3 files changed, 184 insertions, 125 deletions
diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h index e04698a8749e..bb992eff76f9 100644 --- a/core/cds/inc/cds_concurrency.h +++ b/core/cds/inc/cds_concurrency.h @@ -774,6 +774,10 @@ QDF_STATUS cds_register_sap_restart_channel_switch_cb( void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t)); QDF_STATUS cds_deregister_sap_restart_channel_switch_cb(void); #endif +QDF_STATUS cds_get_mac_id_by_session_id(uint8_t session_id, uint8_t *mac_id); +QDF_STATUS cds_get_mcc_session_id_on_mac(uint8_t mac_id, uint8_t session_id, + uint8_t *mcc_session_id); +uint8_t cds_get_mcc_operating_channel(uint8_t session_id); QDF_STATUS cds_get_pcl_for_existing_conn(enum cds_con_mode mode, uint8_t *pcl_ch, uint32_t *len, uint8_t *weight_list, uint32_t weight_len); diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index 71320408e2f3..c8781fc0a37a 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -7284,8 +7284,7 @@ int32_t cds_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapater, uint32_t set_value) { uint8_t first_adapter_operating_channel = 0; - uint8_t second_adapter_opertaing_channel = 0; - hdd_adapter_t *sta_adapter = NULL; + uint8_t second_adapter_operating_channel = 0; int32_t ret = 0; /* success */ uint32_t concurrent_state = cds_get_concurrency_mode(); @@ -7324,63 +7323,32 @@ int32_t cds_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapater, */ set_value = set_value | first_adapter_operating_channel; /* Find out the 2nd MCC adapter and its operating channel */ - if (hostapd_adapater->device_mode == QDF_STA_MODE) { - /* - * iwpriv cmd was issued on wlan0; - * get p2p0 vdev channel - */ - if ((concurrent_state & QDF_P2P_CLIENT_MASK) != 0) { - /* The 2nd MCC vdev is P2P client */ - sta_adapter = hdd_get_adapter( - hostapd_adapater->pHddCtx, - QDF_P2P_CLIENT_MODE); - } else { - /* The 2nd MCC vdev is P2P GO */ - sta_adapter = hdd_get_adapter( - hostapd_adapater->pHddCtx, - QDF_P2P_GO_MODE); - } - } else { - /* - * iwpriv cmd was issued on p2p0; - * get wlan0 vdev channel - */ - sta_adapter = hdd_get_adapter(hostapd_adapater->pHddCtx, - QDF_STA_MODE); - } - if (sta_adapter != NULL) { - second_adapter_opertaing_channel = - hdd_get_operating_channel - ( - sta_adapter->pHddCtx, - sta_adapter->device_mode - ); - cds_info("2nd vdev channel No. is:%d", - second_adapter_opertaing_channel); - - if (second_adapter_opertaing_channel == 0 || - first_adapter_operating_channel == 0) { - cds_err("Invalid channel"); - return -EINVAL; - } - /* - * Now move the time quota and channel number of the - * 1st adapter to bits 23-16 and bits 15-8 of the bit - * vector, respectively. - */ - set_value = set_value << 8; - /* - * Store the channel number for 2nd MCC vdev at bits - * 7-0 of set_value - */ - set_value = set_value | - second_adapter_opertaing_channel; - ret = wma_cli_set_command(hostapd_adapater->sessionId, - WMA_VDEV_MCC_SET_TIME_QUOTA, - set_value, VDEV_CMD); - } else { - cds_err("NULL adapter handle. Exit"); + second_adapter_operating_channel = + cds_get_mcc_operating_channel( + hostapd_adapater->sessionId); + + cds_info("2nd vdev channel No. is:%d", + second_adapter_operating_channel); + + if (second_adapter_operating_channel == 0 || + first_adapter_operating_channel == 0) { + cds_err("Invalid channel"); + return -EINVAL; } + /* + * Now move the time quota and channel number of the + * 1st adapter to bits 23-16 and bits 15-8 of the bit + * vector, respectively. + */ + set_value = set_value << 8; + /* + * Store the channel number for 2nd MCC vdev at bits + * 7-0 of set_value + */ + set_value = set_value | second_adapter_operating_channel; + ret = wma_cli_set_command(hostapd_adapater->sessionId, + WMA_VDEV_MCC_SET_TIME_QUOTA, + set_value, VDEV_CMD); } else { cds_info("MCC is not active. Exit w/o setting latency"); } @@ -7434,9 +7402,8 @@ int32_t cds_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter, uint32_t set_value) { uint8_t first_adapter_operating_channel = 0; - uint8_t second_adapter_opertaing_channel = 0; + uint8_t second_adapter_operating_channel = 0; uint32_t concurrent_state = 0; - hdd_adapter_t *sta_adapter = NULL; int32_t ret = 0; /* success */ /* @@ -7475,66 +7442,36 @@ int32_t cds_go_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter, * the lower 8-bits of bit vector. */ set_value = set_value | first_adapter_operating_channel; - if (hostapd_adapter->device_mode == - QDF_STA_MODE) { - /* iwpriv cmd issued on wlan0; get p2p0 vdev chan */ - if ((concurrent_state & QDF_P2P_CLIENT_MASK) != 0) { - /* The 2nd MCC vdev is P2P client */ - sta_adapter = hdd_get_adapter - ( - hostapd_adapter->pHddCtx, - QDF_P2P_CLIENT_MODE - ); - } else { - /* The 2nd MCC vdev is P2P GO */ - sta_adapter = hdd_get_adapter - ( - hostapd_adapter->pHddCtx, - QDF_P2P_GO_MODE - ); - } - } else { - /* iwpriv cmd issued on p2p0; get channel for wlan0 */ - sta_adapter = hdd_get_adapter - ( - hostapd_adapter->pHddCtx, - QDF_STA_MODE - ); - } - if (sta_adapter != NULL) { - second_adapter_opertaing_channel = - hdd_get_operating_channel - ( - sta_adapter->pHddCtx, - sta_adapter->device_mode - ); - cds_info("2nd vdev channel No. is:%d", - second_adapter_opertaing_channel); - - if (second_adapter_opertaing_channel == 0 || - first_adapter_operating_channel == 0) { - cds_err("Invalid channel"); - return -EINVAL; - } - /* - * Move the time quota and operating channel number - * for the first adapter to bits 23-16 & bits 15-8 - * of set_value vector, respectively. - */ - set_value = set_value << 8; - /* - * Store the channel number for 2nd MCC vdev at bits - * 7-0 of set_value vector as per the bit format above. - */ - set_value = set_value | - second_adapter_opertaing_channel; - ret = wma_cli_set_command(hostapd_adapter->sessionId, - WMA_VDEV_MCC_SET_TIME_QUOTA, - set_value, VDEV_CMD); - } else { - cds_err("NULL adapter handle. Exit"); + /* Find out the 2nd MCC adapter and its operating channel */ + second_adapter_operating_channel = + cds_get_mcc_operating_channel( + hostapd_adapter->sessionId); + + cds_info("2nd vdev channel No. is:%d", + second_adapter_operating_channel); + + if (second_adapter_operating_channel == 0 || + first_adapter_operating_channel == 0) { + cds_err("Invalid channel"); + return -EINVAL; } + + /* + * Move the time quota and operating channel number + * for the first adapter to bits 23-16 & bits 15-8 + * of set_value vector, respectively. + */ + set_value = set_value << 8; + /* + * Store the channel number for 2nd MCC vdev at bits + * 7-0 of set_value vector as per the bit format above. + */ + set_value = set_value | + second_adapter_operating_channel; + ret = wma_cli_set_command(hostapd_adapter->sessionId, + WMA_VDEV_MCC_SET_TIME_QUOTA, + set_value, VDEV_CMD); } else { cds_info("MCC is not active. Exit w/o setting latency"); } @@ -8950,6 +8887,121 @@ void cds_dump_connection_status_info(void) } /** + * cds_get_mac_id_by_session_id() - Get MAC ID for a given session ID + * @session_id: Session ID + * @mac_id: Pointer to the MAC ID + * + * Gets the MAC ID for a given session ID + * + * Return: QDF_STATUS + */ +QDF_STATUS cds_get_mac_id_by_session_id(uint8_t session_id, uint8_t *mac_id) +{ + cds_context_type *cds_ctx; + uint32_t i; + + cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); + if (!cds_ctx) { + cds_err("Invalid CDS Context"); + return QDF_STATUS_E_FAILURE; + } + + qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock); + for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { + if ((conc_connection_list[i].vdev_id == session_id) && + (conc_connection_list[i].in_use)) { + *mac_id = conc_connection_list[i].mac; + qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); + return QDF_STATUS_SUCCESS; + } + } + qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); + return QDF_STATUS_E_FAILURE; +} + +/** + * cds_get_mcc_session_id_on_mac() - Get MCC session's ID + * @mac_id: MAC ID on which MCC session needs to be found + * @session_id: Session with which MCC combination needs to be found + * @mcc_session_id: Pointer to the MCC session ID + * + * Get the session ID of the MCC interface + * + * Return: QDF_STATUS + */ +QDF_STATUS cds_get_mcc_session_id_on_mac(uint8_t mac_id, uint8_t session_id, + uint8_t *mcc_session_id) +{ + cds_context_type *cds_ctx; + uint32_t i; + uint8_t chan = conc_connection_list[session_id].chan; + + cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); + if (!cds_ctx) { + cds_err("Invalid CDS Context"); + return QDF_STATUS_E_FAILURE; + } + + qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock); + for (i = 0; i < MAX_NUMBER_OF_CONC_CONNECTIONS; i++) { + if (conc_connection_list[i].mac != mac_id) + continue; + if (conc_connection_list[i].vdev_id == session_id) + continue; + /* Inter band or intra band MCC */ + if ((conc_connection_list[i].chan != chan) && + (conc_connection_list[i].in_use)) { + *mcc_session_id = conc_connection_list[i].vdev_id; + qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); + return QDF_STATUS_SUCCESS; + } + } + qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); + return QDF_STATUS_E_FAILURE; +} + +/** + * cds_get_mcc_operating_channel() - Get the MCC channel + * @session_id: Session ID with which MCC is being done + * + * Gets the MCC channel for a given session ID. + * + * Return: '0' (INVALID_CHANNEL_ID) or valid channel number + */ +uint8_t cds_get_mcc_operating_channel(uint8_t session_id) +{ + uint8_t mac_id, mcc_session_id; + QDF_STATUS status; + uint8_t chan; + cds_context_type *cds_ctx; + + cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); + if (!cds_ctx) { + cds_err("Invalid CDS Context"); + return INVALID_CHANNEL_ID; + } + + status = cds_get_mac_id_by_session_id(session_id, &mac_id); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("failed to get MAC ID"); + return INVALID_CHANNEL_ID; + } + + status = cds_get_mcc_session_id_on_mac(mac_id, session_id, + &mcc_session_id); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("failed to get MCC session ID"); + return INVALID_CHANNEL_ID; + } + + qdf_mutex_acquire(&cds_ctx->qdf_conc_list_lock); + chan = conc_connection_list[mcc_session_id].chan; + qdf_mutex_release(&cds_ctx->qdf_conc_list_lock); + + return chan; +} + +/** * cds_set_do_hw_mode_change_flag() - Set flag to indicate hw mode change * @flag: Indicate if hw mode change is required or not * diff --git a/core/wma/src/wma_data.c b/core/wma/src/wma_data.c index 10ddf1dae559..a0ef65830b2b 100644 --- a/core/wma/src/wma_data.c +++ b/core/wma/src/wma_data.c @@ -1013,14 +1013,17 @@ QDF_STATUS wma_set_enable_disable_mcc_adaptive_scheduler(uint32_t return QDF_STATUS_E_FAULT; } - /* In WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID fw cannot - * determine the PDEV on its own, Host needs to specify the PDEV - * ID in the command. + /* + * Since there could be up to two instances of OCS in FW (one per MAC), + * FW provides the option of enabling and disabling MAS on a per MAC + * basis. But, Host does not have enable/disable option for individual + * MACs. So, FW agreed for the Host to send down a 'pdev id' of 0. + * When 'pdev id' of 0 is used, FW treats this as a SOC level command + * and applies the same value to both MACs. Irrespective of the value + * of 'WMI_SERVICE_DEPRECATED_REPLACE', the pdev id needs to be '0' + * (SOC level) for WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID */ - if (wma->wlan_resource_config.use_pdev_id) - pdev_id = WMA_MAC_TO_PDEV_MAP(0); - else - pdev_id = WMI_PDEV_ID_SOC; + pdev_id = WMI_PDEV_ID_SOC; return wmi_unified_set_enable_disable_mcc_adaptive_scheduler_cmd( wma->wmi_handle, mcc_adaptive_scheduler, pdev_id); |
