diff --git a/htc/htc_api.h b/htc/htc_api.h index dac72bc3001b..d4e92a43e6cd 100644 --- a/htc/htc_api.h +++ b/htc/htc_api.h @@ -770,4 +770,18 @@ int htc_pm_runtime_put(HTC_HANDLE htc_handle); static inline int htc_pm_runtime_get(HTC_HANDLE htc_handle) { return 0; } static inline int htc_pm_runtime_put(HTC_HANDLE htc_handle) { return 0; } #endif + +/** + * htc_set_async_ep() - set async HTC end point + * user should call this function after htc_connect_service before + * queing any packets to end point + * @HTCHandle: htc handle + * @HTC_ENDPOINT_ID: end point id + * @value: true or false + * + * Return: None + */ + +void htc_set_async_ep(HTC_HANDLE HTCHandle, + HTC_ENDPOINT_ID htc_ep_id, bool value); #endif /* _HTC_API_H_ */ diff --git a/htc/htc_internal.h b/htc/htc_internal.h index 596628cead6a..570b53130b55 100644 --- a/htc/htc_internal.h +++ b/htc/htc_internal.h @@ -135,6 +135,7 @@ typedef struct _HTC_ENDPOINT { HTC_ENDPOINT_STATS endpoint_stats; /* endpoint statistics */ #endif bool TxCreditFlowEnabled; + bool async_update; /* packets can be queued asynchronously */ } HTC_ENDPOINT; #ifdef HTC_EP_STAT_PROFILING diff --git a/htc/htc_send.c b/htc/htc_send.c index 348233fff93b..c7ee0dff44b3 100644 --- a/htc/htc_send.c +++ b/htc/htc_send.c @@ -616,14 +616,14 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target, } } - if (pEndpoint->service_id != WMI_CONTROL_SVC) { + if (!pEndpoint->async_update) { LOCK_HTC_TX(target); } /* store in look up queue to match completions */ HTC_PACKET_ENQUEUE(&pEndpoint->TxLookupQueue, pPacket); INC_HTC_EP_STAT(pEndpoint, TxIssued, 1); pEndpoint->ul_outstanding_cnt++; - if (pEndpoint->service_id != WMI_CONTROL_SVC) { + if (!pEndpoint->async_update) { UNLOCK_HTC_TX(target); hif_send_complete_check(target->hif_dev, pEndpoint->UL_PipeID, false); @@ -651,7 +651,7 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target, ("hif_send Failed status:%d \n", status)); } - if (pEndpoint->service_id != WMI_CONTROL_SVC) { + if (!pEndpoint->async_update) { LOCK_HTC_TX(target); } target->ce_send_cnt--; @@ -662,7 +662,7 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target, pPacket->PktInfo.AsTx.CreditsUsed; /* put it back into the callers queue */ HTC_PACKET_ENQUEUE_TO_HEAD(pPktQueue, pPacket); - if (pEndpoint->service_id != WMI_CONTROL_SVC) { + if (!pEndpoint->async_update) { UNLOCK_HTC_TX(target); } break; @@ -1156,9 +1156,12 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target, * transmit resources */ while (true) { - if ((HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0) || - ((!tx_resources) && - (pEndpoint->service_id == WMI_CONTROL_SVC))) { + if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0) + break; + + if (pEndpoint->async_update && + (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) && + (!tx_resources)) { break; } @@ -1211,7 +1214,7 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target, break; } - if (pEndpoint->service_id != WMI_CONTROL_SVC) { + if (!pEndpoint->async_update) { UNLOCK_HTC_TX(target); } @@ -1229,7 +1232,7 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target, HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(&pEndpoint->TxQueue, &sendQueue); - if (pEndpoint->service_id != WMI_CONTROL_SVC) { + if (!pEndpoint->async_update) { LOCK_HTC_TX(target); } break; @@ -1241,7 +1244,7 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target, pEndpoint->UL_PipeID); } - if (pEndpoint->service_id != WMI_CONTROL_SVC) { + if (!pEndpoint->async_update) { LOCK_HTC_TX(target); } @@ -1920,7 +1923,7 @@ QDF_STATUS htc_tx_completion_handler(void *Context, * when credits flow back from the target. * in the non-TX credit case, we recheck after the packet completes */ if ((qdf_atomic_read(&pEndpoint->TxProcessCount) == 0) || - (pEndpoint->service_id != WMI_CONTROL_SVC)) { + (!pEndpoint->async_update)) { htc_try_send(target, pEndpoint, NULL); } } diff --git a/htc/htc_services.c b/htc/htc_services.c index 0cfe8bae1507..0ddf398af5dd 100644 --- a/htc/htc_services.c +++ b/htc/htc_services.c @@ -357,6 +357,7 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle, /* copy all the callbacks */ pEndpoint->EpCallBacks = pConnectReq->EpCallbacks; + pEndpoint->async_update = 0; status = hif_map_service_to_pipe(target->hif_dev, pEndpoint->service_id, @@ -424,3 +425,16 @@ void htc_fw_event_handler(void *context, QDF_STATUS status) initInfo->TargetFailure(initInfo->pContext, status); } } + + +void htc_set_async_ep(HTC_HANDLE HTCHandle, + HTC_ENDPOINT_ID htc_ep_id, bool value) +{ + HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); + HTC_ENDPOINT *pEndpoint = &target->endpoint[htc_ep_id]; + + pEndpoint->async_update = value; + qdf_print("%s: htc_handle %p, ep %d, value %d\n", __func__, + HTCHandle, htc_ep_id, value); +} +