qcacmn: Add cdp api for dp tx desc availability
Add cdp api to check if tx desc pool available descriptor
threshold has reached.
Change-Id: Ie542d03dd865d32aa6e01da00328aa51728b4276
CRs-Fixed: 2369218
diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c
index a42cd2e..9c06974 100644
--- a/dp/wifi3.0/dp_main.c
+++ b/dp/wifi3.0/dp_main.c
@@ -9166,6 +9166,7 @@
.flow_pool_unmap_handler = dp_tx_flow_pool_unmap,
.register_pause_cb = dp_txrx_register_pause_cb,
.dump_flow_pool_info = dp_tx_dump_flow_pool_info,
+ .tx_desc_thresh_reached = dp_tx_desc_thresh_reached,
#endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
};
diff --git a/dp/wifi3.0/dp_tx_desc.h b/dp/wifi3.0/dp_tx_desc.h
index a903d99..8afe00e 100644
--- a/dp/wifi3.0/dp_tx_desc.h
+++ b/dp/wifi3.0/dp_tx_desc.h
@@ -374,6 +374,16 @@
qdf_spin_unlock_bh(&pool->flow_pool_lock);
}
#else /* QCA_AC_BASED_FLOW_CONTROL */
+
+static inline bool
+dp_tx_is_threshold_reached(struct dp_tx_desc_pool_s *pool, uint16_t avail_desc)
+{
+ if (qdf_unlikely(avail_desc < pool->stop_th))
+ return true;
+ else
+ return false;
+}
+
/**
* dp_tx_desc_alloc() - Allocate a Software Tx Descriptor from given pool
*
@@ -482,6 +492,21 @@
}
#endif /* QCA_AC_BASED_FLOW_CONTROL */
+
+static inline bool
+dp_tx_desc_thresh_reached(struct cdp_vdev *vdev)
+{
+ struct dp_vdev *dp_vdev = (struct dp_vdev *)vdev;
+ struct dp_tx_desc_pool_s *pool;
+
+ if (!vdev)
+ return false;
+
+ pool = dp_vdev->pool;
+
+ return dp_tx_is_threshold_reached(pool, pool->avail_desc);
+}
+
#else /* QCA_LL_TX_FLOW_CONTROL_V2 */
static inline void dp_tx_flow_control_init(struct dp_soc *handle)