qcacmn: dp: hl: Read tx resources after single thread check
Bus TX resources are being read before the single thread check.
If the thread is pre-empted, the tx_resource variable may not
match with actual TX resources.
Change-Id: I7e8af58a5702172a4cfbea9175f333aad4a57238
CRs-Fixed: 2459253
diff --git a/htc/htc_send.c b/htc/htc_send.c
index 2a7b81c..8973b69 100644
--- a/htc/htc_send.c
+++ b/htc/htc_send.c
@@ -1139,14 +1139,6 @@
return result;
}
- if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
- tx_resources =
- hif_get_free_queue_number(target->hif_dev,
- pEndpoint->UL_PipeID);
- } else {
- tx_resources = 0;
- }
-
LOCK_HTC_TX(target);
if (!HTC_QUEUE_EMPTY(&sendQueue)) {
@@ -1185,6 +1177,14 @@
/* now drain the endpoint TX queue for transmission as long as we have
* enough transmit resources
*/
+ if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
+ tx_resources =
+ hif_get_free_queue_number(target->hif_dev,
+ pEndpoint->UL_PipeID);
+ } else {
+ tx_resources = 0;
+ }
+
while (true) {
if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0)