From a9d5382e9a207ebd02136c3fdde116458e50d665 Mon Sep 17 00:00:00 2001 From: Ajit Pal Singh Date: Thu, 26 Apr 2018 18:22:16 +0530 Subject: [PATCH] qcacld-3.0: Check per vdev limits for selecting discard frames When HL Flow Control is enabled, check for per vdev limits for making a decision on whether frames should be discarded. Change-Id: Ifde5f763d253eb644f97afeab9e4e1365c23e672 CRs-fixed: 2236321 --- core/dp/txrx/ol_tx_queue.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/core/dp/txrx/ol_tx_queue.c b/core/dp/txrx/ol_tx_queue.c index 621f1c2b7d86..3468f680006d 100644 --- a/core/dp/txrx/ol_tx_queue.c +++ b/core/dp/txrx/ol_tx_queue.c @@ -161,6 +161,7 @@ ol_tx_queue_discard( num = ol_tx_desc_pool_size_hl(pdev->ctrl_pdev) - qdf_atomic_read(&pdev->tx_queue.rsrc_cnt); else + /*TODO: Discard frames for a particular vdev only */ num = pdev->tx_queue.rsrc_threshold_hi - pdev->tx_queue.rsrc_threshold_lo; @@ -192,7 +193,7 @@ ol_tx_queue_discard( ol_tx_queue_flush(pdev); } -#ifdef CONFIG_PER_VDEV_TX_DESC_POOL +#ifdef QCA_HL_NETDEV_FLOW_CONTROL /** * is_ol_tx_discard_frames_success() - check whether currently queued tx frames @@ -202,16 +203,39 @@ ol_tx_queue_discard( * * Return: Success if available tx descriptors are too few */ -static bool +static inline bool is_ol_tx_discard_frames_success(struct ol_txrx_pdev_t *pdev, struct ol_tx_desc_t *tx_desc) { ol_txrx_vdev_handle vdev; + bool discard_frames; vdev = tx_desc->vdev; - return qdf_atomic_read(&vdev->tx_desc_count) > - ((ol_tx_desc_pool_size_hl(pdev->ctrl_pdev) >> 1) - - TXRX_HL_TX_FLOW_CTRL_MGMT_RESERVED); + + qdf_spin_lock_bh(&vdev->pdev->tx_mutex); + if (vdev->tx_desc_limit == 0) { + /* Flow control not enabled */ + discard_frames = qdf_atomic_read(&pdev->tx_queue.rsrc_cnt) <= + pdev->tx_queue.rsrc_threshold_lo; + } else { + /* + * Discard + * if netbuf is normal priority and tx_desc_count greater than + * queue stop threshold + * AND + * if netbuf is high priority and tx_desc_count greater than + * tx desc limit. + */ + discard_frames = (!ol_tx_desc_is_high_prio(tx_desc->netbuf) && + qdf_atomic_read(&vdev->tx_desc_count) > + vdev->queue_stop_th) || + (ol_tx_desc_is_high_prio(tx_desc->netbuf) && + qdf_atomic_read(&vdev->tx_desc_count) > + vdev->tx_desc_limit); + } + qdf_spin_unlock_bh(&vdev->pdev->tx_mutex); + + return discard_frames; } #else @@ -222,7 +246,7 @@ is_ol_tx_discard_frames_success(struct ol_txrx_pdev_t *pdev, return qdf_atomic_read(&pdev->tx_queue.rsrc_cnt) <= pdev->tx_queue.rsrc_threshold_lo; } -#endif +#endif /* QCA_HL_NETDEV_FLOW_CONTROL */ void ol_tx_enqueue(