From 35b251d495dd68d575949fa0048587efa039a1c4 Mon Sep 17 00:00:00 2001 From: "Agrawal, Ashish" Date: Thu, 8 Sep 2016 19:21:03 +0530 Subject: [PATCH] qcacld-3.0: Pass tx_pkt_fail_cnt_threshold to FW qcacld-2.0 to qcacld-3.0 propagation Add data structures to save tx_pkt_fail_cnt_threshold and changes to pass the same to FW. Change-Id: I46dc401c26c3eeeb41b345d0fe1b4406394971fb CRs-Fixed: 1020078 --- core/mac/inc/sir_api.h | 9 ++++++ core/mac/src/include/sir_params.h | 1 + core/sme/inc/sme_api.h | 2 ++ core/sme/src/common/sme_api.c | 46 +++++++++++++++++++++++++++++++ core/wma/src/wma_main.c | 44 +++++++++++++++++++++++++++++ 5 files changed, 102 insertions(+) diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 3a8c353bde25..ca07329a20f8 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -6586,4 +6586,13 @@ struct sir_encrypt_decrypt_rsp_params { uint8_t *data; }; +/** + * struct sme_tx_fail_cnt_threshold - tx failure count for disconnect to fw + * @session_id: Session id + * @tx_fail_cnt_threshold: Tx failure count to do disconnect + */ +struct sme_tx_fail_cnt_threshold { + uint8_t session_id; + uint32_t tx_fail_cnt_threshold; +}; #endif /* __SIR_API_H */ diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index bff7c7b1bc6c..83838f5f5eb5 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -636,6 +636,7 @@ typedef struct sSirMbMsgP2p { #define SIR_HAL_SET_DTIM_PERIOD (SIR_HAL_ITC_MSG_TYPES_BEGIN + 363) #define SIR_HAL_ENCRYPT_DECRYPT_MSG (SIR_HAL_ITC_MSG_TYPES_BEGIN + 364) +#define SIR_HAL_UPDATE_TX_FAIL_CNT_TH (SIR_HAL_ITC_MSG_TYPES_BEGIN + 367) #define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF) /* CFG message types */ diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 3990ebab984b..52a56ab335b3 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1327,4 +1327,6 @@ QDF_STATUS sme_encrypt_decrypt_msg(tHalHandle hal, QDF_STATUS sme_set_cts2self_for_p2p_go(tHalHandle hal); void sme_set_prefer_80MHz_over_160MHz(tHalHandle hal, bool sta_prefer_80MHz_over_160MHz); +QDF_STATUS sme_update_tx_fail_cnt_threshold(tHalHandle hal_handle, + uint8_t session_id, uint32_t tx_fail_count); #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 6ba4d8a89717..490a1453d00d 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -16805,3 +16805,49 @@ QDF_STATUS sme_set_cts2self_for_p2p_go(tHalHandle hal_handle) } return QDF_STATUS_SUCCESS; } +/** + * sme_update_tx_fail_cnt_threshold() - update tx fail count Threshold + * @hal: Handle returned by mac_open + * @session_id: Session ID on which tx fail count needs to be updated to FW + * @tx_fail_count: Count for tx fail threshold after which FW will disconnect + * + * This function is used to set tx fail count threshold to firmware. + * firmware will issue disocnnect with peer device once this threshold is + * reached. + * + * Return: Return QDF_STATUS, otherwise appropriate failure code + */ +QDF_STATUS sme_update_tx_fail_cnt_threshold(tHalHandle hal_handle, + uint8_t session_id, uint32_t tx_fail_count) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct sme_tx_fail_cnt_threshold *tx_fail_cnt; + cds_msg_t msg; + + tx_fail_cnt = qdf_mem_malloc(sizeof(*tx_fail_cnt)); + if (NULL == tx_fail_cnt) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: fail to alloc filter_param", __func__); + return QDF_STATUS_E_FAILURE; + } + sms_log(mac_ctx, LOG1, + FL("session_id %d tx_fail_count: %d"), + session_id, tx_fail_count); + tx_fail_cnt->session_id = session_id; + tx_fail_cnt->tx_fail_cnt_threshold = tx_fail_count; + + qdf_mem_zero(&msg, sizeof(cds_msg_t)); + msg.type = SIR_HAL_UPDATE_TX_FAIL_CNT_TH; + msg.reserved = 0; + msg.bodyptr = tx_fail_cnt; + status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); + + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("Not able to post Tx fail count message to WDA")); + qdf_mem_free(tx_fail_cnt); + } + + return status; +} diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 98eadc66cbb8..c83f1eace036 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -5914,6 +5914,46 @@ static QDF_STATUS wma_update_wep_default_key(tp_wma_handle wma, return QDF_STATUS_SUCCESS; } + +/** + * wma_update_tx_fail_cnt_th() - Set threshold for TX pkt fail + * @wma_handle: WMA handle + * @tx_fail_cnt_th: sme_tx_fail_cnt_threshold parameter + * + * This function is used to set Tx pkt fail count threshold, + * FW will do disconnect with station once this threshold is reached. + * + * Return: VOS_STATUS_SUCCESS on success, error number otherwise + */ +static QDF_STATUS wma_update_tx_fail_cnt_th(tp_wma_handle wma, + struct sme_tx_fail_cnt_threshold *tx_fail_cnt_th) +{ + u_int8_t vdev_id; + u_int32_t tx_fail_disconn_th; + int ret = -EIO; + + if (!wma || !wma->wmi_handle) { + WMA_LOGE(FL("WMA is closed, can not issue Tx pkt fail count threshold")); + return QDF_STATUS_E_INVAL; + } + vdev_id = tx_fail_cnt_th->session_id; + tx_fail_disconn_th = tx_fail_cnt_th->tx_fail_cnt_threshold; + WMA_LOGD("Set TX pkt fail count threshold vdevId %d count %d", + vdev_id, tx_fail_disconn_th); + + + ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, + WMI_VDEV_PARAM_DISCONNECT_TH, + tx_fail_disconn_th); + + if (ret) { + WMA_LOGE(FL("Failed to send TX pkt fail count threshold command")); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + /** * wma_mc_process_msg() - process wma messages and call appropriate function. * @cds_context: cds context @@ -6725,6 +6765,10 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *msg) wma_encrypt_decrypt_msg(wma_handle, msg->bodyptr); qdf_mem_free(msg->bodyptr); break; + case SIR_HAL_UPDATE_TX_FAIL_CNT_TH: + wma_update_tx_fail_cnt_th(wma_handle, msg->bodyptr); + qdf_mem_free(msg->bodyptr); + break; default: WMA_LOGD("unknow msg type %x", msg->type); /* Do Nothing? MSG Body should be freed at here */