qcacmn: Add HTC APIs to schedule/cancel custom callbacks

Add HTC layer APIs to schedule/cancel custom callbacks.

CRs-Fixed: 3408693
Change-Id: I1316685707b7abc6c8d86ec4d237dc920f9f78eb
This commit is contained in:
Edayilliam Jayadev
2023-02-16 17:48:15 +05:30
committed by Madan Koyyalamudi
parent 63c5956a01
commit 10fe6982eb
2 changed files with 268 additions and 0 deletions

View File

@@ -531,6 +531,106 @@ void htc_ce_tasklet_debug_dump(HTC_HANDLE htc_handle);
*/
QDF_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
#ifdef CUSTOM_CB_SCHEDULER_SUPPORT
/**
* htc_register_custom_cb() - Helper API to register the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
* @custom_cb: Custom call back function pointer
* @custom_cb_context: Custom callback context
*
* return: QDF_STATUS
*/
QDF_STATUS
htc_register_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id,
void (*custom_cb)(void *), void *custom_cb_context);
/**
* htc_unregister_custom_cb() - Helper API to unregister the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
*
* return: QDF_STATUS
*/
QDF_STATUS
htc_unregister_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id);
/**
* htc_enable_custom_cb() - Helper API to enable the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
*
* return: QDF_STATUS
*/
QDF_STATUS
htc_enable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id);
/**
* htc_disable_custom_cb() - Helper API to disable the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
*
* return: QDF_STATUS
*/
QDF_STATUS
htc_disable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id);
#else
/**
* htc_register_custom_cb() - Helper API to register the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
* @custom_cb: Custom call back function pointer
* @custom_cb_context: Custom callback context
*
* return: QDF_STATUS
*/
static inline QDF_STATUS
htc_register_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id,
void (*custom_cb)(void *), void *custom_cb_context)
{
return QDF_STATUS_SUCCESS;
}
/**
* htc_unregister_custom_cb() - Helper API to unregister the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
*
* return: QDF_STATUS
*/
static inline QDF_STATUS
htc_unregister_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
{
return QDF_STATUS_SUCCESS;
}
/**
* htc_enable_custom_cb() - Helper API to enable the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
*
* return: QDF_STATUS
*/
static inline QDF_STATUS
htc_enable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
{
return QDF_STATUS_SUCCESS;
}
/**
* htc_disable_custom_cb() - Helper API to disable the custom callback
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
*
* return: QDF_STATUS
*/
static inline QDF_STATUS
htc_disable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
{
return QDF_STATUS_SUCCESS;
}
#endif /* CUSTOM_CB_SCHEDULER_SUPPORT */
#ifdef ATH_11AC_TXCOMPACT
/**
* htc_send_data_pkt() - Send an HTC packet containing a tx descriptor and data

View File

@@ -1995,6 +1995,174 @@ static inline QDF_STATUS __htc_send_pkt(HTC_HANDLE HTCHandle,
return QDF_STATUS_SUCCESS;
}
#ifdef CUSTOM_CB_SCHEDULER_SUPPORT
/**
* htc_get_endpoint_ul_pipeid() - Helper API to get uplink pipe ID
* @htc_handle: HTC handle
* @endpoint_id: Endpoint ID
* @ul_pipeid: Pointer to uplink pipe ID
*
* return: QDF_STATUS
*/
static QDF_STATUS
htc_get_endpoint_ul_pipeid(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id,
uint8_t *ul_pipeid)
{
HTC_TARGET *target;
HTC_ENDPOINT *end_point;
if (!htc_handle) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: HTCHandle is NULL\n", __func__));
return QDF_STATUS_E_NULL_VALUE;
}
target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
if (endpoint_id >= ENDPOINT_MAX || endpoint_id <= ENDPOINT_UNUSED) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
("%s endpoint is invalid\n", __func__));
AR_DEBUG_ASSERT(0);
return QDF_STATUS_E_INVAL;
}
end_point = &target->endpoint[endpoint_id];
if (!end_point->service_id) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s service_id is invalid\n",
__func__));
return QDF_STATUS_E_INVAL;
}
*ul_pipeid = end_point->UL_PipeID;
return QDF_STATUS_SUCCESS;
}
QDF_STATUS
htc_register_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id,
void (*custom_cb)(void *), void *custom_cb_context)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
uint8_t ul_pipeid;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+%s\n", __func__));
status = htc_get_endpoint_ul_pipeid(htc_handle, endpoint_id,
&ul_pipeid);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to get ul pipeid\n",
__func__));
goto exit;
}
status = hif_register_ce_custom_cb(htc_get_hif_device(htc_handle),
ul_pipeid, custom_cb,
custom_cb_context);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to register cb\n",
__func__));
goto exit;
}
exit:
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-%s\n", __func__));
return status;
}
QDF_STATUS
htc_unregister_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
uint8_t ul_pipeid;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+%s\n", __func__));
status = htc_get_endpoint_ul_pipeid(htc_handle, endpoint_id,
&ul_pipeid);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to get ul pipeid\n",
__func__));
goto exit;
}
status = hif_unregister_ce_custom_cb(htc_get_hif_device(htc_handle),
ul_pipeid);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to unregister cb\n",
__func__));
status = QDF_STATUS_E_INVAL;
goto exit;
}
exit:
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-%s\n", __func__));
return status;
}
QDF_STATUS
htc_enable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
uint8_t ul_pipeid;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+%s\n", __func__));
status = htc_get_endpoint_ul_pipeid(htc_handle, endpoint_id,
&ul_pipeid);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to get ul pipeid\n",
__func__));
goto exit;
}
status = hif_enable_ce_custom_cb(htc_get_hif_device(htc_handle),
ul_pipeid);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to enable cb\n",
__func__));
status = QDF_STATUS_E_INVAL;
goto exit;
}
exit:
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-%s\n", __func__));
return status;
}
QDF_STATUS
htc_disable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
uint8_t ul_pipeid;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+%s\n", __func__));
status = htc_get_endpoint_ul_pipeid(htc_handle, endpoint_id,
&ul_pipeid);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to get ul pipeid\n",
__func__));
goto exit;
}
status = hif_disable_ce_custom_cb(htc_get_hif_device(htc_handle),
ul_pipeid);
if (QDF_IS_STATUS_ERROR(status)) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("%s Failed to disable cb\n",
__func__));
status = QDF_STATUS_E_INVAL;
goto exit;
}
exit:
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-%s\n", __func__));
return status;
}
#endif /* CUSTOM_CB_SCHEDULER_SUPPORT */
/* HTC API - htc_send_pkt */
QDF_STATUS htc_send_pkt(HTC_HANDLE htc_handle, HTC_PACKET *htc_packet)
{