From 407d6d84b8eb7f428fe59995b551f5cdcdf36fc4 Mon Sep 17 00:00:00 2001 From: Ajit Pal Singh Date: Fri, 2 Aug 2019 23:50:35 +0530 Subject: [PATCH] qcacld-3.0: Deduct HTT credit from TXQ group also In HL data path, when HTT credits are used outside the HL scheduler, credits are getting deducted form target_tx credit only. When CONFIG_FEATURE_HL_GROUP_CREDIT_FLOW_CONTROL is enabled, credits should be deducted from TXQ group also. Change-Id: Ice4160043fc1d812686f8ce7ee310110299d2276 CRs-Fixed: 2485819 --- core/dp/htt/htt_h2t.c | 20 +++++--------------- core/dp/ol/inc/ol_txrx_htt_api.h | 20 ++++++++++++++++++++ core/dp/txrx/ol_tx_send.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/core/dp/htt/htt_h2t.c b/core/dp/htt/htt_h2t.c index 31445546655f..01e72292558c 100644 --- a/core/dp/htt/htt_h2t.c +++ b/core/dp/htt/htt_h2t.c @@ -296,9 +296,7 @@ QDF_STATUS htt_h2t_ver_req_msg(struct htt_pdev_t *pdev) SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); HTT_SEND_HTC_PKT(pdev, pkt); - if ((pdev->cfg.is_high_latency) && - (!pdev->cfg.default_tx_comp_req)) - ol_tx_target_credit_update(pdev->txrx_pdev, -1); + ol_tx_deduct_one_credit(pdev->txrx_pdev); return QDF_STATUS_SUCCESS; } @@ -749,9 +747,7 @@ htt_h2t_rx_ring_cfg_msg_hl(struct htt_pdev_t *pdev) htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); #endif - if ((pdev->cfg.is_high_latency) && - (!pdev->cfg.default_tx_comp_req)) - ol_tx_target_credit_update(pdev->txrx_pdev, -1); + ol_tx_deduct_one_credit(pdev->txrx_pdev); return QDF_STATUS_SUCCESS; } @@ -860,9 +856,7 @@ htt_h2t_dbg_stats_get(struct htt_pdev_t *pdev, htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); #endif - if ((pdev->cfg.is_high_latency) && - (!pdev->cfg.default_tx_comp_req)) - ol_tx_target_credit_update(pdev->txrx_pdev, -1); + ol_tx_deduct_one_credit(pdev->txrx_pdev); return 0; } @@ -914,9 +908,7 @@ A_STATUS htt_h2t_sync_msg(struct htt_pdev_t *pdev, uint8_t sync_cnt) SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); HTT_SEND_HTC_PKT(pdev, pkt); - if ((pdev->cfg.is_high_latency) && - (!pdev->cfg.default_tx_comp_req)) - ol_tx_target_credit_update(pdev->txrx_pdev, -1); + ol_tx_deduct_one_credit(pdev->txrx_pdev); return A_OK; } @@ -985,9 +977,7 @@ htt_h2t_aggr_cfg_msg(struct htt_pdev_t *pdev, htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); #endif - if ((pdev->cfg.is_high_latency) && - (!pdev->cfg.default_tx_comp_req)) - ol_tx_target_credit_update(pdev->txrx_pdev, -1); + ol_tx_deduct_one_credit(pdev->txrx_pdev); return 0; } diff --git a/core/dp/ol/inc/ol_txrx_htt_api.h b/core/dp/ol/inc/ol_txrx_htt_api.h index 389152c702fa..1602209e6dda 100644 --- a/core/dp/ol/inc/ol_txrx_htt_api.h +++ b/core/dp/ol/inc/ol_txrx_htt_api.h @@ -36,12 +36,27 @@ static inline uint16_t *ol_tx_msdu_id_storage(qdf_nbuf_t msdu) return (uint16_t *) (&QDF_NBUF_CB_TX_DESC_ID(msdu)); } + +/** + * @brief Deduct one credit from target_tx and one from any of the groups + * @details + * Deduct one credit from target_tx credit and one credit from any of the + * groups, whichever has more number of credits. + * + * @param pdev - the data physical device + */ +int ol_tx_deduct_one_credit(struct ol_txrx_pdev_t *pdev); #else static inline uint16_t *ol_tx_msdu_id_storage(qdf_nbuf_t msdu) { qdf_assert(qdf_nbuf_headroom(msdu) >= (sizeof(uint16_t) * 2 - 1)); return (uint16_t *) (((qdf_size_t) (qdf_nbuf_head(msdu) + 1)) & ~0x1); } + +static inline int ol_tx_deduct_one_credit(struct ol_txrx_pdev_t *pdev) +{ + return 0; +} #endif /** * @brief Tx MSDU download completion for a LL system @@ -236,6 +251,8 @@ ol_tx_desc_update_group_credit( u_int16_t tx_desc_id, int credit, u_int8_t absolute, enum htt_tx_status status); +void ol_tx_deduct_one_any_group_credit(ol_txrx_pdev_handle pdev); + #ifdef DEBUG_HL_LOGGING /** @@ -287,6 +304,9 @@ ol_tx_desc_update_group_credit( int credit, u_int8_t absolute, enum htt_tx_status status) { } + +static inline void ol_tx_deduct_one_any_group_credit(ol_txrx_pdev_handle pdev) +{} #endif /** diff --git a/core/dp/txrx/ol_tx_send.c b/core/dp/txrx/ol_tx_send.c index 885ba35b45b6..285dcf9e5966 100644 --- a/core/dp/txrx/ol_tx_send.c +++ b/core/dp/txrx/ol_tx_send.c @@ -384,6 +384,19 @@ ol_tx_delay_compute(struct ol_txrx_pdev_t *pdev, } #endif /* QCA_COMPUTE_TX_DELAY */ +#if defined(CONFIG_HL_SUPPORT) +int ol_tx_deduct_one_credit(struct ol_txrx_pdev_t *pdev) +{ + /* TODO: Check if enough credits */ + + if (!pdev->cfg.default_tx_comp_req) { + ol_tx_target_credit_update(pdev, -1); + ol_tx_deduct_one_any_group_credit(pdev); + } + return 0; +} +#endif /* CONFIG_HL_SUPPORT */ + #ifndef OL_TX_RESTORE_HDR #define OL_TX_RESTORE_HDR(__tx_desc, __msdu) #endif @@ -1005,6 +1018,22 @@ void ol_tx_desc_update_group_credit(ol_txrx_pdev_handle pdev, ol_tx_update_group_credit_stats(pdev); } +void ol_tx_deduct_one_any_group_credit(ol_txrx_pdev_handle pdev) +{ + int credits_group_0, credits_group_1; + + qdf_spin_lock_bh(&pdev->tx_queue_spinlock); + credits_group_0 = qdf_atomic_read(&pdev->txq_grps[0].credit); + credits_group_1 = qdf_atomic_read(&pdev->txq_grps[1].credit); + + if (credits_group_0 > credits_group_1) + ol_txrx_update_group_credit(&pdev->txq_grps[0], -1, 0); + else if (credits_group_1 != 0) + ol_txrx_update_group_credit(&pdev->txq_grps[1], -1, 0); + + qdf_spin_unlock_bh(&pdev->tx_queue_spinlock); +} + #ifdef DEBUG_HL_LOGGING void ol_tx_update_group_credit_stats(ol_txrx_pdev_handle pdev)