From 9f9dfdc2b410969e07ad9f304e36d1cfd32e0411 Mon Sep 17 00:00:00 2001 From: Mainak Sen Date: Tue, 10 Nov 2020 12:55:36 +0530 Subject: [PATCH] qcacmn: Get dp vdev from HTT vdev id in MEC notify In HTT MEC notification, wifi vdev should be mapped from vdev_id provided in HTT WBM completion status word Change-Id: Ic0a440efdbdc1ee99f27fb4797ee068599d06268 --- dp/wifi3.0/dp_tx.c | 62 +++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 852e0e4870..11fa9d1c5a 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -4305,6 +4305,7 @@ dp_tx_comp_process_desc_list(struct dp_soc *soc, /** * dp_tx_process_htt_completion() - Tx HTT Completion Indication Handler + * @soc: Handle to DP soc structure * @tx_desc: software descriptor head pointer * @status : Tx completion status from HTT descriptor * @ring_id: ring number @@ -4314,18 +4315,47 @@ dp_tx_comp_process_desc_list(struct dp_soc *soc, * Return: none */ static -void dp_tx_process_htt_completion(struct dp_tx_desc_s *tx_desc, uint8_t *status, +void dp_tx_process_htt_completion(struct dp_soc *soc, + struct dp_tx_desc_s *tx_desc, uint8_t *status, uint8_t ring_id) { uint8_t tx_status; struct dp_pdev *pdev; struct dp_vdev *vdev; - struct dp_soc *soc; struct hal_tx_completion_status ts = {0}; uint32_t *htt_desc = (uint32_t *)status; struct dp_peer *peer; struct cdp_tid_tx_stats *tid_stats = NULL; struct htt_soc *htt_handle; + uint8_t vdev_id; + + tx_status = HTT_TX_WBM_COMPLETION_V2_TX_STATUS_GET(htt_desc[0]); + htt_handle = (struct htt_soc *)soc->htt_handle; + htt_wbm_event_record(htt_handle->htt_logger_handle, tx_status, status); + + /* + * There can be scenario where WBM consuming descriptor enqueued + * from TQM2WBM first and TQM completion can happen before MEC + * notification comes from FW2WBM. Avoid access any field of tx + * descriptor in case of MEC notify. + */ + if (tx_status == HTT_TX_FW2WBM_TX_STATUS_MEC_NOTIFY) { + /* + * Get vdev id from HTT status word in case of MEC + * notification + */ + vdev_id = HTT_TX_WBM_COMPLETION_V2_VDEV_ID_GET(htt_desc[3]); + if (qdf_unlikely(vdev_id >= MAX_VDEV_CNT)) + return; + + vdev = dp_vdev_get_ref_by_id(soc, vdev_id, + DP_MOD_ID_HTT_COMP); + if (!vdev) + return; + dp_tx_mec_handler(vdev, status); + dp_vdev_unref_delete(soc, vdev, DP_MOD_ID_HTT_COMP); + return; + } /* * If the descriptor is already freed in vdev_detach, @@ -4333,20 +4363,19 @@ void dp_tx_process_htt_completion(struct dp_tx_desc_s *tx_desc, uint8_t *status, */ if ((tx_desc->vdev_id == DP_INVALID_VDEV_ID) && !tx_desc->flags) { QDF_TRACE(QDF_MODULE_ID_DP, - QDF_TRACE_LEVEL_INFO, - "Descriptor freed in vdev_detach %d", - tx_desc->id); + QDF_TRACE_LEVEL_INFO, + "Descriptor freed in vdev_detach %d", + tx_desc->id); return; } pdev = tx_desc->pdev; - soc = pdev->soc; if (qdf_unlikely(tx_desc->pdev->is_pdev_down)) { QDF_TRACE(QDF_MODULE_ID_DP, - QDF_TRACE_LEVEL_INFO, - "pdev in down state %d", - tx_desc->id); + QDF_TRACE_LEVEL_INFO, + "pdev in down state %d", + tx_desc->id); dp_tx_comp_free_buf(soc, tx_desc); dp_tx_desc_release(tx_desc, tx_desc->pool_id); return; @@ -4354,14 +4383,12 @@ void dp_tx_process_htt_completion(struct dp_tx_desc_s *tx_desc, uint8_t *status, qdf_assert(tx_desc->pdev); - vdev = dp_vdev_get_ref_by_id(soc, tx_desc->vdev_id, - DP_MOD_ID_HTT_COMP); + vdev_id = tx_desc->vdev_id; + vdev = dp_vdev_get_ref_by_id(soc, vdev_id, + DP_MOD_ID_HTT_COMP); if (!vdev) return; - tx_status = HTT_TX_WBM_COMPLETION_V2_TX_STATUS_GET(htt_desc[0]); - htt_handle = (struct htt_soc *)soc->htt_handle; - htt_wbm_event_record(htt_handle->htt_logger_handle, tx_status, status); switch (tx_status) { case HTT_TX_FW2WBM_TX_STATUS_OK: @@ -4424,11 +4451,6 @@ void dp_tx_process_htt_completion(struct dp_tx_desc_s *tx_desc, uint8_t *status, dp_tx_inspect_handler(soc, vdev, tx_desc, status); break; } - case HTT_TX_FW2WBM_TX_STATUS_MEC_NOTIFY: - { - dp_tx_mec_handler(vdev, status); - break; - } default: QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, "%s Invalid HTT tx_status %d\n", @@ -4582,7 +4604,7 @@ more_data: uint8_t htt_tx_status[HAL_TX_COMP_HTT_STATUS_LEN]; hal_tx_comp_get_htt_desc(tx_comp_hal_desc, htt_tx_status); - dp_tx_process_htt_completion(tx_desc, + dp_tx_process_htt_completion(soc, tx_desc, htt_tx_status, ring_id); } else { tx_desc->peer_id =