summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManikandan Mohan <manikand@codeaurora.org>2017-04-13 20:19:26 -0700
committerspuligil <spuligil@codeaurora.org>2017-04-19 16:12:52 -0700
commita3a5094b495c29b850eeb56e6aed4c2126d03053 (patch)
tree9a1f3a093e6fb0ba6dfb5d60e38818da143fd220
parent2f3449579d2928d0c3700e3d30bd195a3f3a721b (diff)
qcacmn: Fix kernel module check patch warnings
Fix kernel module check patch warnings in Host Target Communication module files Change-Id: I151f597142d93a26e5e037cf7fce944f86fba72a CRs-fixed: 2033001
-rw-r--r--htc/dl_list.h64
-rw-r--r--htc/htc.c116
-rw-r--r--htc/htc_api.h1041
-rw-r--r--htc/htc_internal.h119
-rw-r--r--htc/htc_packet.h144
-rw-r--r--htc/htc_recv.c113
-rw-r--r--htc/htc_send.c447
-rw-r--r--htc/htc_services.c60
-rw-r--r--wmi/src/wmi_unified.c4
9 files changed, 1097 insertions, 1011 deletions
diff --git a/htc/dl_list.h b/htc/dl_list.h
index 1b5d72f780e2..be9970cf0a29 100644
--- a/htc/dl_list.h
+++ b/htc/dl_list.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -25,17 +25,18 @@
* to the Linux Foundation.
*/
-/* ============================================================================== */
+/*=========================================================================== */
/* Double-link list definitions (adapted from Atheros SDIO stack) */
/* */
/* Author(s): ="Atheros" */
-/* ============================================================================== */
+/*=========================================================================== */
#ifndef __DL_LIST_H___
#define __DL_LIST_H___
#define A_CONTAINING_STRUCT(address, struct_type, field_name) \
- ((struct_type *)((char *)(address) - (char *)(&((struct_type *)0)->field_name)))
+ ((struct_type *)((char *)(address) - \
+ (char *)(&((struct_type *)0)->field_name)))
/* list functions */
/* pointers for the list */
@@ -50,14 +51,15 @@ typedef struct _DL_LIST {
{(pList)->pPrev = pList; (pList)->pNext = pList; }
/* faster macro to init list and add a single item */
-#define DL_LIST_INIT_AND_ADD(pList,pItem) \
+#define DL_LIST_INIT_AND_ADD(pList, pItem) \
{ (pList)->pPrev = (pItem); \
(pList)->pNext = (pItem); \
(pItem)->pNext = (pList); \
(pItem)->pPrev = (pList); \
}
-#define DL_LIST_IS_EMPTY(pList) (((pList)->pPrev == (pList)) && ((pList)->pNext == (pList)))
+#define DL_LIST_IS_EMPTY(pList) (((pList)->pPrev == (pList)) && \
+ ((pList)->pNext == (pList)))
#define DL_LIST_GET_ITEM_AT_HEAD(pList) (pList)->pNext
#define DL_LIST_GET_ITEM_AT_TAIL(pList) (pList)->pPrev
/*
@@ -66,9 +68,10 @@ typedef struct _DL_LIST {
* iteration loop
*/
#define ITERATE_OVER_LIST(pStart, pTemp) \
- for((pTemp) =(pStart)->pNext; pTemp != (pStart); (pTemp) = (pTemp)->pNext)
+ for ((pTemp) = (pStart)->pNext; pTemp != (pStart); \
+ (pTemp) = (pTemp)->pNext)
-static __inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
+static inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
const DL_LIST *pEntry)
{
const DL_LIST *pTmp;
@@ -77,9 +80,8 @@ static __inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
return true;
ITERATE_OVER_LIST(pList, pTmp) {
- if (pTmp == pEntry) {
+ if (pTmp == pEntry)
return true;
- }
}
return false;
@@ -88,30 +90,29 @@ static __inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
/* safe iterate macro that allows the item to be removed from the list
* the iteration continues to the next item in the list
*/
-#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart,pItem,st,offset) \
+#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart, pItem, st, offset) \
{ \
PDL_LIST pTemp; \
- pTemp = (pStart)->pNext; \
+ { pTemp = (pStart)->pNext; } \
while (pTemp != (pStart)) { \
- (pItem) = A_CONTAINING_STRUCT(pTemp,st,offset); \
- pTemp = pTemp->pNext; \
+ { (pItem) = A_CONTAINING_STRUCT(pTemp, st, offset); } \
+ { pTemp = pTemp->pNext; } \
#define ITERATE_IS_VALID(pStart) dl_list_is_entry_in_list(pStart, pTemp)
-#define ITERATE_RESET(pStart) pTemp=(pStart)->pNext
+#define ITERATE_RESET(pStart) { pTemp = (pStart)->pNext; }
#define ITERATE_END }}
/*
* dl_list_insert_tail - insert pAdd to the end of the list
*/
-static __inline PDL_LIST dl_list_insert_tail(PDL_LIST pList, PDL_LIST pAdd)
+static inline PDL_LIST dl_list_insert_tail(PDL_LIST pList, PDL_LIST pAdd)
{
/* insert at tail */
pAdd->pPrev = pList->pPrev;
pAdd->pNext = pList;
- if (pList->pPrev) {
+ if (pList->pPrev)
pList->pPrev->pNext = pAdd;
- }
pList->pPrev = pAdd;
return pAdd;
}
@@ -119,7 +120,7 @@ static __inline PDL_LIST dl_list_insert_tail(PDL_LIST pList, PDL_LIST pAdd)
/*
* dl_list_insert_head - insert pAdd into the head of the list
*/
-static __inline PDL_LIST dl_list_insert_head(PDL_LIST pList, PDL_LIST pAdd)
+static inline PDL_LIST dl_list_insert_head(PDL_LIST pList, PDL_LIST pAdd)
{
/* insert at head */
pAdd->pPrev = pList;
@@ -129,20 +130,17 @@ static __inline PDL_LIST dl_list_insert_head(PDL_LIST pList, PDL_LIST pAdd)
return pAdd;
}
-#define DL_ListAdd(pList,pItem) dl_list_insert_head((pList),(pItem))
+#define DL_ListAdd(pList, pItem) dl_list_insert_head((pList), (pItem))
/*
* dl_list_remove - remove pDel from list
*/
-static __inline PDL_LIST dl_list_remove(PDL_LIST pDel)
+static inline PDL_LIST dl_list_remove(PDL_LIST pDel)
{
- if (pDel->pNext != NULL) {
+ if (pDel->pNext != NULL)
pDel->pNext->pPrev = pDel->pPrev;
- }
- if (pDel->pPrev != NULL) {
+ if (pDel->pPrev != NULL)
pDel->pPrev->pNext = pDel->pNext;
- }
-
- /* point back to itself just to be safe, incase remove is called again */
+ /* point back to itself just to be safe, if remove is called again */
pDel->pNext = pDel;
pDel->pPrev = pDel;
return pDel;
@@ -151,9 +149,10 @@ static __inline PDL_LIST dl_list_remove(PDL_LIST pDel)
/*
* dl_list_remove_item_from_head - get a list item from the head
*/
-static __inline PDL_LIST dl_list_remove_item_from_head(PDL_LIST pList)
+static inline PDL_LIST dl_list_remove_item_from_head(PDL_LIST pList)
{
PDL_LIST pItem = NULL;
+
if (pList->pNext != pList) {
pItem = pList->pNext;
/* remove the first item from head */
@@ -162,9 +161,10 @@ static __inline PDL_LIST dl_list_remove_item_from_head(PDL_LIST pList)
return pItem;
}
-static __inline PDL_LIST dl_list_remove_item_from_tail(PDL_LIST pList)
+static inline PDL_LIST dl_list_remove_item_from_tail(PDL_LIST pList)
{
PDL_LIST pItem = NULL;
+
if (pList->pPrev != pList) {
pItem = pList->pPrev;
/* remove the item from tail */
@@ -174,7 +174,7 @@ static __inline PDL_LIST dl_list_remove_item_from_tail(PDL_LIST pList)
}
/* transfer src list items to the tail of the destination list */
-static __inline void dl_list_transfer_items_to_tail(PDL_LIST pDest, PDL_LIST pSrc)
+static inline void dl_list_transfer_items_to_tail(PDL_LIST pDest, PDL_LIST pSrc)
{
/* only concatenate if src is not empty */
if (!DL_LIST_IS_EMPTY(pSrc)) {
@@ -190,11 +190,11 @@ static __inline void dl_list_transfer_items_to_tail(PDL_LIST pDest, PDL_LIST pSr
}
/* transfer src list items to the head of the destination list */
-static __inline void dl_list_transfer_items_to_head(PDL_LIST pDest, PDL_LIST pSrc)
+static inline void dl_list_transfer_items_to_head(PDL_LIST pDest, PDL_LIST pSrc)
{
/* only concatenate if src is not empty */
if (!DL_LIST_IS_EMPTY(pSrc)) {
- /* cut out circular list in src and re-attach to start of dest */
+ /* cut out circular list in src and reattach to start of dest */
pSrc->pNext->pPrev = pDest;
pDest->pNext->pPrev = pSrc->pPrev;
pSrc->pPrev->pNext = pDest->pNext;
diff --git a/htc/htc.c b/htc/htc.c
index 0f9c3e4a486d..2077840a2b97 100644
--- a/htc/htc.c
+++ b/htc/htc.c
@@ -60,12 +60,11 @@ static void reset_endpoint_states(HTC_TARGET *target);
static void destroy_htc_tx_ctrl_packet(HTC_PACKET *pPacket)
{
qdf_nbuf_t netbuf;
+
netbuf = (qdf_nbuf_t) GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("free ctrl netbuf :0x%p\n", netbuf));
- if (netbuf != NULL) {
+ if (netbuf != NULL)
qdf_nbuf_free(netbuf);
- }
-
qdf_mem_free(pPacket);
}
@@ -76,9 +75,8 @@ static HTC_PACKET *build_htc_tx_ctrl_packet(qdf_device_t osdev)
do {
pPacket = (HTC_PACKET *) qdf_mem_malloc(sizeof(HTC_PACKET));
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
netbuf = qdf_nbuf_alloc(osdev, HTC_CONTROL_BUFFER_SIZE,
20, 4, true);
if (NULL == netbuf) {
@@ -88,7 +86,7 @@ static HTC_PACKET *build_htc_tx_ctrl_packet(qdf_device_t osdev)
break;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
- ("alloc ctrl netbuf :0x%p \n", netbuf));
+ ("alloc ctrl netbuf :0x%p\n", netbuf));
SET_HTC_PACKET_NET_BUF_CONTEXT(pPacket, netbuf);
} while (false);
@@ -129,12 +127,14 @@ void htc_set_target_failure_callback(HTC_HANDLE HTCHandle,
HTC_TARGET_FAILURE Callback)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
target->HTCInitInfo.TargetFailure = Callback;
}
void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
hif_dump(target->hif_dev, CmdId, start);
}
@@ -152,29 +152,26 @@ static void htc_cleanup(HTC_TARGET *target)
while (true) {
pPacket = allocate_htc_packet_container(target);
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
qdf_mem_free(pPacket);
}
pPacket = target->pBundleFreeList;
while (pPacket) {
HTC_PACKET *pPacketTmp = (HTC_PACKET *) pPacket->ListLink.pNext;
+
qdf_mem_free(pPacket);
pPacket = pPacketTmp;
}
#ifdef TODO_FIXME
while (true) {
pPacket = htc_alloc_control_tx_packet(target);
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
netbuf = (qdf_nbuf_t) GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
- if (netbuf != NULL) {
+ if (netbuf != NULL)
qdf_nbuf_free(netbuf);
- }
-
qdf_mem_free(pPacket);
}
#endif
@@ -238,8 +235,8 @@ static inline void htc_runtime_pm_init(HTC_TARGET *target) { }
#endif
/* registered target arrival callback from the HIF layer */
-HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
- uint32_t con_mode)
+HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo,
+ qdf_device_t osdev, uint32_t con_mode)
{
struct hif_msg_callbacks htcCallbacks;
HTC_ENDPOINT *pEndpoint = NULL;
@@ -269,7 +266,7 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
do {
qdf_mem_copy(&target->HTCInitInfo, pInfo,
- sizeof(HTC_INIT_INFO));
+ sizeof(struct htc_init_info));
target->host_handle = pInfo->pContext;
target->osdev = osdev;
target->con_mode = con_mode;
@@ -279,19 +276,17 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
INIT_HTC_PACKET_QUEUE(&target->ControlBufferTXFreeList);
for (i = 0; i < HTC_PACKET_CONTAINER_ALLOCATION; i++) {
- HTC_PACKET *pPacket =
- (HTC_PACKET *) qdf_mem_malloc(sizeof(HTC_PACKET));
- if (pPacket != NULL) {
+ HTC_PACKET *pPacket = (HTC_PACKET *)
+ qdf_mem_malloc(sizeof(HTC_PACKET));
+ if (pPacket != NULL)
free_htc_packet_container(target, pPacket);
- }
}
#ifdef TODO_FIXME
for (i = 0; i < NUM_CONTROL_TX_BUFFERS; i++) {
pPacket = build_htc_tx_ctrl_packet();
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
htc_free_control_tx_packet(target, pPacket);
}
#endif
@@ -301,7 +296,8 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
htcCallbacks.Context = target;
htcCallbacks.rxCompletionHandler = htc_rx_completion_handler;
htcCallbacks.txCompletionHandler = htc_tx_completion_handler;
- htcCallbacks.txResourceAvailHandler = htc_tx_resource_avail_handler;
+ htcCallbacks.txResourceAvailHandler =
+ htc_tx_resource_avail_handler;
htcCallbacks.fwEventHandler = htc_fw_event_handler;
target->hif_dev = ol_sc;
@@ -324,6 +320,7 @@ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
void htc_destroy(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
("+htc_destroy .. Destroying :0x%p\n", target));
hif_stop(htc_get_hif_device(HTCHandle));
@@ -332,19 +329,22 @@ void htc_destroy(HTC_HANDLE HTCHandle)
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_destroy\n"));
}
-/* get the low level HIF device for the caller , the caller may wish to do low level
- * HIF requests */
+/* get the low level HIF device for the caller , the caller may wish to do low
+ * level HIF requests
+ */
void *htc_get_hif_device(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
return target->hif_dev;
}
static void htc_control_tx_complete(void *Context, HTC_PACKET *pPacket)
{
HTC_TARGET *target = (HTC_TARGET *) Context;
+
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
- ("+-htc_control_tx_complete 0x%p (l:%d) \n", pPacket,
+ ("+-htc_control_tx_complete 0x%p (l:%d)\n", pPacket,
pPacket->ActualLength));
htc_free_control_tx_packet(target, pPacket);
}
@@ -362,8 +362,8 @@ static void htc_control_tx_complete(void *Context, HTC_PACKET *pPacket)
*/
static void
htc_setup_epping_credit_allocation(struct hif_opaque_softc *scn,
- HTC_SERVICE_TX_CREDIT_ALLOCATION *pEntry,
- int credits)
+ struct htc_service_tx_credit_allocation *pEntry,
+ int credits)
{
switch (hif_get_bus_type(scn)) {
case QDF_BUS_TYPE_PCI:
@@ -383,7 +383,6 @@ htc_setup_epping_credit_allocation(struct hif_opaque_softc *scn,
default:
break;
}
- return;
}
/**
@@ -395,15 +394,14 @@ htc_setup_epping_credit_allocation(struct hif_opaque_softc *scn,
static
A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
{
- HTC_SERVICE_TX_CREDIT_ALLOCATION *pEntry;
+ struct htc_service_tx_credit_allocation *pEntry;
A_STATUS status;
int credits;
int creditsPerMaxMsg;
creditsPerMaxMsg = MAX_MESSAGE_SIZE / target->TargetCreditSize;
- if (MAX_MESSAGE_SIZE % target->TargetCreditSize) {
+ if (MAX_MESSAGE_SIZE % target->TargetCreditSize)
creditsPerMaxMsg++;
- }
/* TODO, this should be configured by the caller! */
@@ -423,7 +421,7 @@ A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
if (HTC_IS_EPPING_ENABLED(target->con_mode)) {
/* endpoint ping is a testing tool directly on top of HTC in
* both target and host sides.
- * In target side, the endppint ping fw has no wlan stack and the
+ * In target side, the endppint ping fw has no wlan stack and
* FW mboxping app directly sits on HTC and it simply drops
* or loops back TX packets. For rx perf, FW mboxping app
* generates packets and passes packets to HTC to send to host.
@@ -440,9 +438,9 @@ A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
* space through the Ethernet interface.
* For credit allocation, in SDIO bus case, only BE service is
* used for tx/rx perf testing so that all credits are given
- * to BE service. In PCIe and USB bus case, endpoint ping uses both
- * BE and BK services to stress the bus so that the total credits
- * are equally distributed to BE and BK services.
+ * to BE service. In PCIe and USB bus case, endpoint ping uses
+ * both BE and BK services to stress the bus so that the total
+ * credits are equally distributed to BE and BK services.
*/
htc_setup_epping_credit_allocation(target->hif_dev,
@@ -451,6 +449,7 @@ A_STATUS htc_setup_target_buffer_assignments(HTC_TARGET *target)
if (A_SUCCESS(status)) {
int i;
+
for (i = 0; i < HTC_MAX_SERVICE_ALLOC_ENTRIES; i++) {
if (target->ServiceTxAllocTable[i].service_id != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_INIT,
@@ -493,8 +492,8 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
A_STATUS status = A_OK;
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_READY_EX_MSG *pReadyMsg;
- HTC_SERVICE_CONNECT_REQ connect;
- HTC_SERVICE_CONNECT_RESP resp;
+ struct htc_service_connect_req connect;
+ struct htc_service_connect_resp resp;
HTC_READY_MSG *rdy_msg;
uint16_t htc_rdy_msg_id;
uint8_t i = 0;
@@ -508,19 +507,19 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
status = hif_start(target->hif_dev);
if (A_FAILED(status)) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("hif_start failed\n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
+ ("hif_start failed\n"));
break;
}
status = htc_wait_recv_ctrl_message(target);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
if (target->CtrlResponseLength < (sizeof(HTC_READY_EX_MSG))) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Invalid HTC Ready Msg Len:%d! \n",
+ ("Invalid HTC Ready Msg Len:%d!\n",
target->CtrlResponseLength));
status = A_ECOMM;
break;
@@ -533,7 +532,7 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
HTC_GET_FIELD(rdy_msg, HTC_READY_MSG, MESSAGEID);
if (htc_rdy_msg_id != HTC_MSG_READY_ID) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("Invalid HTC Ready Msg : 0x%X ! \n",
+ ("Invalid HTC Ready Msg : 0x%X!\n",
htc_rdy_msg_id));
status = A_ECOMM;
break;
@@ -545,8 +544,9 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
(int)HTC_GET_FIELD(rdy_msg, HTC_READY_MSG, CREDITSIZE);
target->MaxMsgsPerHTCBundle =
(uint8_t) pReadyMsg->MaxMsgsPerHTCBundle;
- /* for old fw this value is set to 0. But the minimum value should be 1,
- * i.e., no bundling */
+ /* for old fw this value is set to 0. But the minimum value
+ * should be 1, i.e., no bundling
+ */
if (target->MaxMsgsPerHTCBundle < 1)
target->MaxMsgsPerHTCBundle = 1;
@@ -599,7 +599,8 @@ A_STATUS htc_wait_target(HTC_HANDLE HTCHandle)
} while (false);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htc_wait_target - Exit (%d)\n", status));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRC,
+ ("htc_wait_target - Exit (%d)\n", status));
AR_DEBUG_PRINTF(ATH_DEBUG_RSVD1, ("-HWT\n"));
return status;
}
@@ -683,7 +684,8 @@ A_STATUS htc_start(HTC_HANDLE HTCHandle)
}
if ((hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_SDIO) ||
- (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB)) {
+ (hif_get_bus_type(target->hif_dev) ==
+ QDF_BUS_TYPE_USB)) {
if (HTC_RX_BUNDLE_ENABLED(target))
pSetupComp->SetupFlags |=
HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV;
@@ -698,10 +700,8 @@ A_STATUS htc_start(HTC_HANDLE HTCHandle)
ENDPOINT_0, HTC_SERVICE_TX_PACKET_TAG);
status = htc_send_pkt((HTC_HANDLE) target, pSendPacket);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
-
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("htc_start Exit\n"));
@@ -740,10 +740,12 @@ void htc_flush_surprise_remove(HTC_HANDLE HTCHandle)
reset_endpoint_states(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_flush_surprise_remove \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-htc_flush_surprise_remove\n"));
}
-/* stop HTC communications, i.e. stop interrupt reception, and flush all queued buffers */
+/* stop HTC communications, i.e. stop interrupt reception, and flush all queued
+ * buffers
+ */
void htc_stop(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
@@ -816,14 +818,14 @@ void htc_dump_credit_states(HTC_HANDLE HTCHandle)
(" TxQueueDepth : %d\n",
HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue)));
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
- ("----------------------------------------------------\n"));
+ ("----------------------------------------\n"));
}
}
bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
- HTC_ENDPOINT_STAT_ACTION Action,
- HTC_ENDPOINT_STATS *pStats)
+ enum htc_endpoint_stat_action Action,
+ struct htc_endpoint_stats *pStats)
{
#ifdef HTC_EP_STAT_PROFILING
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
@@ -855,13 +857,13 @@ bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle,
A_ASSERT(pStats != NULL);
/* return the stats to the caller */
qdf_mem_copy(pStats, &target->endpoint[Endpoint].endpoint_stats,
- sizeof(HTC_ENDPOINT_STATS));
+ sizeof(struct htc_endpoint_stats));
}
if (clearStats) {
/* reset stats */
qdf_mem_zero(&target->endpoint[Endpoint].endpoint_stats,
- sizeof(HTC_ENDPOINT_STATS));
+ sizeof(struct htc_endpoint_stats));
}
UNLOCK_HTC_RX(target);
diff --git a/htc/htc_api.h b/htc/htc_api.h
index 74c5a448f1af..eaffb0329107 100644
--- a/htc/htc_api.h
+++ b/htc/htc_api.h
@@ -53,12 +53,12 @@ typedef uint16_t HTC_SERVICE_ID;
typedef void (*HTC_TARGET_FAILURE)(void *Instance, QDF_STATUS Status);
-typedef struct _HTC_INIT_INFO {
+struct htc_init_info {
void *pContext; /* context for target notifications */
void (*TargetFailure)(void *Instance, QDF_STATUS Status);
void (*TargetSendSuspendComplete)(void *ctx, bool is_nack);
void (*target_initial_wakeup_cb)(void);
-} HTC_INIT_INFO;
+};
/* Struct for HTC layer packet stats*/
struct ol_ath_htc_stats {
@@ -73,157 +73,216 @@ typedef void (*HTC_EP_RESUME_TX_QUEUE)(void *);
/* per service connection send completion */
typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *, HTC_PACKET *);
/* per service connection callback when a plurality of packets have been sent
- * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback)
- * to hold a list of completed send packets.
- * If the handler cannot fully traverse the packet queue before returning, it should
- * transfer the items of the queue into the caller's private queue using:
- * HTC_PACKET_ENQUEUE() */
+ * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from
+ * the callback) to hold a list of completed send packets.
+ * If the handler cannot fully traverse the packet queue before returning, it
+ * should transfer the items of the queue into the caller's private queue using:
+ * HTC_PACKET_ENQUEUE()
+ */
typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *,
HTC_PACKET_QUEUE *);
/* per service connection pkt received */
typedef void (*HTC_EP_RECV_PKT)(void *, HTC_PACKET *);
/* per service connection callback when a plurality of packets are received
- * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback)
- * to hold a list of recv packets.
- * If the handler cannot fully traverse the packet queue before returning, it should
- * transfer the items of the queue into the caller's private queue using:
- * HTC_PACKET_ENQUEUE() */
+ * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from
+ * the callback) to hold a list of recv packets.
+ * If the handler cannot fully traverse the packet queue before returning, it
+ * should transfer the items of the queue into the caller's private queue using:
+ * HTC_PACKET_ENQUEUE()
+ */
typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *, HTC_PACKET_QUEUE *);
/* Optional per service connection receive buffer re-fill callback,
- * On some OSes (like Linux) packets are allocated from a global pool and indicated up
- * to the network stack. The driver never gets the packets back from the OS. For these OSes
- * a refill callback can be used to allocate and re-queue buffers into HTC.
+ * On some OSes (like Linux) packets are allocated from a global pool and
+ * indicated up to the network stack. The driver never gets the packets back
+ * from the OS. For these OSes a refill callback can be used to allocate and
+ * re-queue buffers into HTC.
*
- * On other OSes, the network stack can call into the driver's OS-specifc "return_packet" handler and
- * the driver can re-queue these buffers into HTC. In this regard a refill callback is
- * unnecessary */
+ * On other OSes, the network stack can call into the driver's OS-specific
+ * "return_packet" handler and the driver can re-queue these buffers into HTC.
+ * In this regard a refill callback is unnecessary
+ */
typedef void (*HTC_EP_RECV_REFILL)(void *, HTC_ENDPOINT_ID Endpoint);
/* Optional per service connection receive buffer allocation callback.
- * On some systems packet buffers are an extremely limited resource. Rather than
+ * On some systems packet buffers are an extremely limited resource. Rather than
* queue largest-possible-sized buffers to HTC, some systems would rather
* allocate a specific size as the packet is received. The trade off is
* slightly more processing (callback invoked for each RX packet)
* for the benefit of committing fewer buffer resources into HTC.
*
- * The callback is provided the length of the pending packet to fetch. This includes the
- * HTC header length plus the length of payload. The callback can return a pointer to
- * the allocated HTC packet for immediate use.
+ * The callback is provided the length of the pending packet to fetch. This
+ * includes the HTC header length plus the length of payload. The callback can
+ * return a pointer to the allocated HTC packet for immediate use.
*
- * Alternatively a variant of this handler can be used to allocate large receive packets as needed.
- * For example an application can use the refill mechanism for normal packets and the recv-alloc mechanism to
- * handle the case where a large packet buffer is required. This can significantly reduce the
+ * Alternatively a variant of this handler can be used to allocate large receive
+ * packets as needed. For example an application can use the refill mechanism
+ * for normal packets and the recv-alloc mechanism to handle the case where a
+ * large packet buffer is required. This can significantly reduce the
* amount of "committed" memory used to receive packets.
- *
- * */
+ */
typedef HTC_PACKET *(*HTC_EP_RECV_ALLOC)(void *,
HTC_ENDPOINT_ID Endpoint,
int Length);
-typedef enum _HTC_SEND_FULL_ACTION {
- HTC_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */
- HTC_SEND_FULL_DROP = 1, /* packet that overflowed should be dropped */
-} HTC_SEND_FULL_ACTION;
+enum htc_send_full_action {
+ /* packet that overflowed should be kept in the queue */
+ HTC_SEND_FULL_KEEP = 0,
+ /* packet that overflowed should be dropped */
+ HTC_SEND_FULL_DROP = 1,
+};
-/* Optional per service connection callback when a send queue is full. This can occur if the
- * host continues queueing up TX packets faster than credits can arrive
- * To prevent the host (on some Oses like Linux) from continuously queueing packets
+/* Optional per service connection callback when a send queue is full. This can
+ * occur if host continues queueing up TX packets faster than credits can arrive
+ * To prevent the host (on some Oses like Linux) from continuously queueing pkts
* and consuming resources, this callback is provided so that that the host
* can disable TX in the subsystem (i.e. network stack).
- * This callback is invoked for each packet that "overflows" the HTC queue. The callback can
- * determine whether the new packet that overflowed the queue can be kept (HTC_SEND_FULL_KEEP) or
- * dropped (HTC_SEND_FULL_DROP). If a packet is dropped, the EpTxComplete handler will be called
- * and the packet's status field will be set to A_NO_RESOURCE.
- * Other OSes require a "per-packet" indication for each completed TX packet, this
- * closed loop mechanism will prevent the network stack from overunning the NIC
- * The packet to keep or drop is passed for inspection to the registered handler the handler
- * must ONLY inspect the packet, it may not free or reclaim the packet. */
-typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *,
- HTC_PACKET *
- pPacket);
-
-typedef struct _HTC_EP_CALLBACKS {
- void *pContext; /* context for each callback */
- HTC_EP_SEND_PKT_COMPLETE EpTxComplete; /* tx completion callback for connected endpoint */
- HTC_EP_RECV_PKT EpRecv; /* receive callback for connected endpoint */
- HTC_EP_RECV_REFILL EpRecvRefill; /* OPTIONAL receive re-fill callback for connected endpoint */
- HTC_EP_SEND_QUEUE_FULL EpSendFull; /* OPTIONAL send full callback */
- HTC_EP_RECV_ALLOC EpRecvAlloc; /* OPTIONAL recv allocation callback */
- HTC_EP_RECV_ALLOC EpRecvAllocThresh; /* OPTIONAL recv allocation callback based on a threshold */
- HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple; /* OPTIONAL completion handler for multiple complete
- indications (EpTxComplete must be NULL) */
- HTC_EP_RECV_PKT_MULTIPLE EpRecvPktMultiple; /* OPTIONAL completion handler for multiple
- recv packet indications (EpRecv must be NULL) */
+ * This callback is invoked for each packet that "overflows" the HTC queue. The
+ * callback can determine whether the new packet that overflowed the queue can
+ * be kept (HTC_SEND_FULL_KEEP) or dropped (HTC_SEND_FULL_DROP). If a packet is
+ * dropped, the EpTxComplete handler will be called and the packet's status
+ * field will be set to A_NO_RESOURCE.
+ * Other OSes require a "per-packet" indication for each completed TX packet,
+ * this closed loop mechanism will prevent the network stack from overunning the
+ * NIC. The packet to keep or drop is passed for inspection to the registered
+ * handler the handler must ONLY inspect the packet, it may not free or reclaim
+ * the packet.
+ */
+typedef enum htc_send_full_action (*HTC_EP_SEND_QUEUE_FULL)(void *,
+ HTC_PACKET *pPacket);
+
+struct htc_ep_callbacks {
+ /* context for each callback */
+ void *pContext;
+ /* tx completion callback for connected endpoint */
+ HTC_EP_SEND_PKT_COMPLETE EpTxComplete;
+ /* receive callback for connected endpoint */
+ HTC_EP_RECV_PKT EpRecv;
+ /* OPTIONAL receive re-fill callback for connected endpoint */
+ HTC_EP_RECV_REFILL EpRecvRefill;
+ /* OPTIONAL send full callback */
+ HTC_EP_SEND_QUEUE_FULL EpSendFull;
+ /* OPTIONAL recv allocation callback */
+ HTC_EP_RECV_ALLOC EpRecvAlloc;
+ /* OPTIONAL recv allocation callback based on a threshold */
+ HTC_EP_RECV_ALLOC EpRecvAllocThresh;
+ /* OPTIONAL completion handler for multiple complete
+ * indications (EpTxComplete must be NULL)
+ */
+ HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple;
+ /* OPTIONAL completion handler for multiple
+ * recv packet indications (EpRecv must be NULL)
+ */
+ HTC_EP_RECV_PKT_MULTIPLE EpRecvPktMultiple;
HTC_EP_RESUME_TX_QUEUE ep_resume_tx_queue;
- int RecvAllocThreshold; /* if EpRecvAllocThresh is non-NULL, HTC will compare the
- threshold value to the current recv packet length and invoke
- the EpRecvAllocThresh callback to acquire a packet buffer */
- int RecvRefillWaterMark; /* if a EpRecvRefill handler is provided, this value
- can be used to set a trigger refill callback
- when the recv queue drops below this value
- if set to 0, the refill is only called when packets
- are empty */
-} HTC_EP_CALLBACKS;
+ /* if EpRecvAllocThresh is non-NULL, HTC will compare the
+ * threshold value to the current recv packet length and invoke
+ * the EpRecvAllocThresh callback to acquire a packet buffer
+ */
+ int RecvAllocThreshold;
+ /* if a EpRecvRefill handler is provided, this value
+ * can be used to set a trigger refill callback
+ * when the recv queue drops below this value
+ * if set to 0, the refill is only called when packets
+ * are empty
+ */
+ int RecvRefillWaterMark;
+
+};
/* service connection information */
-typedef struct _HTC_SERVICE_CONNECT_REQ {
- HTC_SERVICE_ID service_id; /* service ID to connect to */
- uint16_t ConnectionFlags; /* connection flags, see htc protocol definition */
- uint8_t *pMetaData; /* ptr to optional service-specific meta-data */
- uint8_t MetaDataLength; /* optional meta data length */
- HTC_EP_CALLBACKS EpCallbacks; /* endpoint callbacks */
- int MaxSendQueueDepth; /* maximum depth of any send queue */
- uint32_t LocalConnectionFlags; /* HTC flags for the host-side (local) connection */
- unsigned int MaxSendMsgSize; /* override max message size in send direction */
-} HTC_SERVICE_CONNECT_REQ;
-
-#define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0) /* enable send bundle padding for this endpoint */
+struct htc_service_connect_req {
+ /* service ID to connect to */
+ HTC_SERVICE_ID service_id;
+ /* connection flags, see htc protocol definition */
+ uint16_t ConnectionFlags;
+ /* ptr to optional service-specific meta-data */
+ uint8_t *pMetaData;
+ /* optional meta data length */
+ uint8_t MetaDataLength;
+ /* endpoint callbacks */
+ struct htc_ep_callbacks EpCallbacks;
+ /* maximum depth of any send queue */
+ int MaxSendQueueDepth;
+ /* HTC flags for the host-side (local) connection */
+ uint32_t LocalConnectionFlags;
+ /* override max message size in send direction */
+ unsigned int MaxSendMsgSize;
+};
+
+/* enable send bundle padding for this endpoint */
+#define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0)
/* service connection response information */
-typedef struct _HTC_SERVICE_CONNECT_RESP {
- uint8_t *pMetaData; /* caller supplied buffer to optional meta-data */
- uint8_t BufferLength; /* length of caller supplied buffer */
- uint8_t ActualLength; /* actual length of meta data */
- HTC_ENDPOINT_ID Endpoint; /* endpoint to communicate over */
- unsigned int MaxMsgLength; /* max length of all messages over this endpoint */
- uint8_t ConnectRespCode; /* connect response code from target */
-} HTC_SERVICE_CONNECT_RESP;
+struct htc_service_connect_resp {
+ /* caller supplied buffer to optional meta-data */
+ uint8_t *pMetaData;
+ /* length of caller supplied buffer */
+ uint8_t BufferLength;
+ /* actual length of meta data */
+ uint8_t ActualLength;
+ /* endpoint to communicate over */
+ HTC_ENDPOINT_ID Endpoint;
+ /* max length of all messages over this endpoint */
+ unsigned int MaxMsgLength;
+ /* connect response code from target */
+ uint8_t ConnectRespCode;
+};
/* endpoint distribution structure */
-typedef struct _HTC_ENDPOINT_CREDIT_DIST {
- struct _HTC_ENDPOINT_CREDIT_DIST *pNext;
- struct _HTC_ENDPOINT_CREDIT_DIST *pPrev;
- HTC_SERVICE_ID service_id; /* Service ID (set by HTC) */
- HTC_ENDPOINT_ID Endpoint; /* endpoint for this distribution struct (set by HTC) */
- uint32_t DistFlags; /* distribution flags, distribution function can
- set default activity using SET_EP_ACTIVE() macro */
- int TxCreditsNorm; /* credits for normal operation, anything above this
- indicates the endpoint is over-subscribed, this field
- is only relevant to the credit distribution function */
- int TxCreditsMin; /* floor for credit distribution, this field is
- only relevant to the credit distribution function */
- int TxCreditsAssigned; /* number of credits assigned to this EP, this field
- is only relevant to the credit dist function */
- int TxCredits; /* current credits available, this field is used by
- HTC to determine whether a message can be sent or
- must be queued */
- int TxCreditsToDist; /* pending credits to distribute on this endpoint, this
- is set by HTC when credit reports arrive.
- The credit distribution functions sets this to zero
- when it distributes the credits */
- int TxCreditsSeek; /* this is the number of credits that the current pending TX
- packet needs to transmit. This is set by HTC when
- and endpoint needs credits in order to transmit */
- int TxCreditSize; /* size in bytes of each credit (set by HTC) */
- int TxCreditsPerMaxMsg; /* credits required for a maximum sized messages (set by HTC) */
- void *pHTCReserved; /* reserved for HTC use */
- int TxQueueDepth; /* current depth of TX queue , i.e. messages waiting for credits
- This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE
- or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint
- that has non-zero credits to recover
- */
-} HTC_ENDPOINT_CREDIT_DIST;
+struct htc_endpoint_credit_dist {
+ struct _htc_endpoint_credit_dist *pNext;
+ struct _htc_endpoint_credit_dist *pPrev;
+ /* Service ID (set by HTC) */
+ HTC_SERVICE_ID service_id;
+ /* endpoint for this distribution struct (set by HTC) */
+ HTC_ENDPOINT_ID Endpoint;
+ /* distribution flags, distribution function can
+ * set default activity using SET_EP_ACTIVE() macro
+ */
+ uint32_t DistFlags;
+ /* credits for normal operation, anything above this
+ * indicates the endpoint is over-subscribed, this field
+ * is only relevant to the credit distribution function
+ */
+ int TxCreditsNorm;
+ /* floor for credit distribution, this field is
+ * only relevant to the credit distribution function
+ */
+ int TxCreditsMin;
+ /* number of credits assigned to this EP, this field
+ * is only relevant to the credit dist function
+ */
+ int TxCreditsAssigned;
+ /* current credits available, this field is used by
+ * HTC to determine whether a message can be sent or
+ * must be queued
+ */
+ int TxCredits;
+ /* pending credits to distribute on this endpoint, this
+ * is set by HTC when credit reports arrive.
+ * The credit distribution functions sets this to zero
+ * when it distributes the credits
+ */
+ int TxCreditsToDist;
+ /* this is the number of credits that the current pending TX
+ * packet needs to transmit. This is set by HTC when
+ * and endpoint needs credits in order to transmit
+ */
+ int TxCreditsSeek;
+ /* size in bytes of each credit (set by HTC) */
+ int TxCreditSize;
+ /* credits required for a maximum sized messages (set by HTC) */
+ int TxCreditsPerMaxMsg;
+ /* reserved for HTC use */
+ void *pHTCReserved;
+ /* current depth of TX queue , i.e. messages waiting for credits
+ * This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE
+ * or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint
+ * that has non-zero credits to recover
+ */
+ int TxQueueDepth;
+};
#define HTC_EP_ACTIVE ((uint32_t) (1u << 31))
@@ -233,218 +292,227 @@ typedef struct _HTC_ENDPOINT_CREDIT_DIST {
#define SET_EP_ACTIVE(epDist) (epDist)->DistFlags |= HTC_EP_ACTIVE
/* credit distibution code that is passed into the distrbution function,
- * there are mandatory and optional codes that must be handled */
-typedef enum _HTC_CREDIT_DIST_REASON {
- HTC_CREDIT_DIST_SEND_COMPLETE = 0, /* credits available as a result of completed
- send operations (MANDATORY) resulting in credit reports */
- HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, /* a change in endpoint activity occured (OPTIONAL) */
- HTC_CREDIT_DIST_SEEK_CREDITS, /* an endpoint needs to "seek" credits (OPTIONAL) */
- HTC_DUMP_CREDIT_STATE /* for debugging, dump any state information that is kept by
- the distribution function */
-} HTC_CREDIT_DIST_REASON;
+ * there are mandatory and optional codes that must be handled
+ */
+enum htc_credit_dist_reason {
+ /* credits available as a result of completed
+ * send operations (MANDATORY) resulting in credit reports
+ */
+ HTC_CREDIT_DIST_SEND_COMPLETE = 0,
+ /* a change in endpoint activity occurred (OPTIONAL) */
+ HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1,
+ /* an endpoint needs to "seek" credits (OPTIONAL) */
+ HTC_CREDIT_DIST_SEEK_CREDITS,
+ /* for debugging, dump any state information that is kept by
+ * the distribution function
+ */
+ HTC_DUMP_CREDIT_STATE
+};
typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context,
- HTC_ENDPOINT_CREDIT_DIST *
+ struct htc_endpoint_credit_dist *
pEPList,
- HTC_CREDIT_DIST_REASON
+ enum htc_credit_dist_reason
Reason);
typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context,
- HTC_ENDPOINT_CREDIT_DIST *
+ struct htc_endpoint_credit_dist *
pEPList, int TotalCredits);
/* endpoint statistics action */
-typedef enum _HTC_ENDPOINT_STAT_ACTION {
- HTC_EP_STAT_SAMPLE = 0, /* only read statistics */
- HTC_EP_STAT_SAMPLE_AND_CLEAR = 1, /* sample and immediately clear statistics */
- HTC_EP_STAT_CLEAR /* clear only */
-} HTC_ENDPOINT_STAT_ACTION;
+enum htc_endpoint_stat_action {
+ /* only read statistics */
+ HTC_EP_STAT_SAMPLE = 0,
+ /* sample and immediately clear statistics */
+ HTC_EP_STAT_SAMPLE_AND_CLEAR = 1,
+ /* clear only */
+ HTC_EP_STAT_CLEAR
+};
/* endpoint statistics */
-typedef struct _HTC_ENDPOINT_STATS {
- uint32_t TxPosted; /* number of TX packets posted to the endpoint */
- uint32_t TxCreditLowIndications; /* number of times the host set the credit-low flag in a send message on
- this endpoint */
- uint32_t TxIssued; /* running count of total TX packets issued */
- uint32_t TxPacketsBundled; /* running count of TX packets that were issued in bundles */
- uint32_t TxBundles; /* running count of TX bundles that were issued */
- uint32_t TxDropped; /* tx packets that were dropped */
- uint32_t TxCreditRpts; /* running count of total credit reports received for this endpoint */
- uint32_t TxCreditRptsFromRx; /* credit reports received from this endpoint's RX packets */
- uint32_t TxCreditRptsFromOther; /* credit reports received from RX packets of other endpoints */
- uint32_t TxCreditRptsFromEp0; /* credit reports received from endpoint 0 RX packets */
- uint32_t TxCreditsFromRx; /* count of credits received via Rx packets on this endpoint */
- uint32_t TxCreditsFromOther; /* count of credits received via another endpoint */
- uint32_t TxCreditsFromEp0; /* count of credits received via another endpoint */
- uint32_t TxCreditsConsummed; /* count of consummed credits */
- uint32_t TxCreditsReturned; /* count of credits returned */
- uint32_t RxReceived; /* count of RX packets received */
- uint32_t RxLookAheads; /* count of lookahead records
- found in messages received on this endpoint */
- uint32_t RxPacketsBundled; /* count of recv packets received in a bundle */
- uint32_t RxBundleLookAheads; /* count of number of bundled lookaheads */
- uint32_t RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */
- uint32_t RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */
- uint32_t RxAllocThreshBytes; /* total number of bytes */
-} HTC_ENDPOINT_STATS;
+struct htc_endpoint_stats {
+ /* number of TX packets posted to the endpoint */
+ uint32_t TxPosted;
+ /* number of times the host set the credit-low flag in a send message on
+ * this endpoint
+ */
+ uint32_t TxCreditLowIndications;
+ /* running count of total TX packets issued */
+ uint32_t TxIssued;
+ /* running count of TX packets that were issued in bundles */
+ uint32_t TxPacketsBundled;
+ /* running count of TX bundles that were issued */
+ uint32_t TxBundles;
+ /* tx packets that were dropped */
+ uint32_t TxDropped;
+ /* running count of total credit reports received for this endpoint */
+ uint32_t TxCreditRpts;
+ /* credit reports received from this endpoint's RX packets */
+ uint32_t TxCreditRptsFromRx;
+ /* credit reports received from RX packets of other endpoints */
+ uint32_t TxCreditRptsFromOther;
+ /* credit reports received from endpoint 0 RX packets */
+ uint32_t TxCreditRptsFromEp0;
+ /* count of credits received via Rx packets on this endpoint */
+ uint32_t TxCreditsFromRx;
+ /* count of credits received via another endpoint */
+ uint32_t TxCreditsFromOther;
+ /* count of credits received via another endpoint */
+ uint32_t TxCreditsFromEp0;
+ /* count of consummed credits */
+ uint32_t TxCreditsConsummed;
+ /* count of credits returned */
+ uint32_t TxCreditsReturned;
+ /* count of RX packets received */
+ uint32_t RxReceived;
+ /* count of lookahead records
+ * found in messages received on this endpoint
+ */
+ uint32_t RxLookAheads;
+ /* count of recv packets received in a bundle */
+ uint32_t RxPacketsBundled;
+ /* count of number of bundled lookaheads */
+ uint32_t RxBundleLookAheads;
+ /* count of the number of bundle indications from the HTC header */
+ uint32_t RxBundleIndFromHdr;
+ /* number of times the recv allocation threshold was hit */
+ uint32_t RxAllocThreshHit;
+ /* total number of bytes */
+ uint32_t RxAllocThreshBytes;
+};
/* ------ Function Prototypes ------ */
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Create an instance of HTC over the underlying HIF device
- @function name: htc_create
- @input: HifDevice - hif device handle,
- pInfo - initialization information
- osdev - QDF device structure
- con_mode - driver connection mode
- @output:
- @return: HTC_HANDLE on success, NULL on failure
- @notes:
- @example:
- @see also: htc_destroy
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-HTC_HANDLE htc_create(void *HifDevice, HTC_INIT_INFO *pInfo, qdf_device_t osdev,
- uint32_t con_mode);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Get the underlying HIF device handle
- @function name: htc_get_hif_device
- @input: HTCHandle - handle passed into the AddInstance callback
- @output:
- @return: opaque HIF device handle usable in HIF API calls.
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_create - Create an instance of HTC over the underlying HIF device
+ * @HifDevice: hif device handle,
+ * @pInfo: initialization information
+ * @osdev: QDF device structure
+ * @con_mode: driver connection mode
+ *
+ * Return: HTC_HANDLE on success, NULL on failure
+ */
+HTC_HANDLE htc_create(void *HifDevice, struct htc_init_info *pInfo,
+ qdf_device_t osdev, uint32_t con_mode);
+
+/**
+ * htc_get_hif_device - Get the underlying HIF device handle
+ * @HTCHandle: handle passed into the AddInstance callback
+ *
+ * Return: opaque HIF device handle usable in HIF API calls.
+ */
void *htc_get_hif_device(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Set credit distribution parameters
- @function name: htc_set_credit_distribution
- @input: HTCHandle - HTC handle
- pCreditDistCont - caller supplied context to pass into distribution functions
- CreditDistFunc - Distribution function callback
- CreditDistInit - Credit Distribution initialization callback
- ServicePriorityOrder - Array containing list of service IDs, lowest index
- is highestpriority
- ListLength - number of elements in ServicePriorityOrder
- @output:
- @return:
- @notes : The user can set a custom credit distribution function to handle
- special requirementsfor each endpoint. A default credit distribution
- routine can be used by setting CreditInitFunc to NULL. The default
- credit distribution is only provided for simple "fair" credit distribution
- without regard to any prioritization.
-
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_set_credit_distribution - Set credit distribution parameters
+ * @HTCHandle: HTC handle
+ * @pCreditDistCont: caller supplied context to pass into distribution functions
+ * @CreditDistFunc: Distribution function callback
+ * @CreditDistInit: Credit Distribution initialization callback
+ * @ServicePriorityOrder: Array containing list of service IDs, lowest index
+ * @is highestpriority: ListLength - number of elements in ServicePriorityOrder
+ *
+ * The user can set a custom credit distribution function to handle
+ * special requirementsfor each endpoint. A default credit distribution
+ * routine can be used by setting CreditInitFunc to NULL. The default
+ * credit distribution is only provided for simple "fair" credit distribution
+ * without regard to any prioritization.
+ * Return: None
+ */
void htc_set_credit_distribution(HTC_HANDLE HTCHandle,
void *pCreditDistContext,
HTC_CREDIT_DIST_CALLBACK CreditDistFunc,
HTC_CREDIT_INIT_CALLBACK CreditInitFunc,
HTC_SERVICE_ID ServicePriorityOrder[],
int ListLength);
+
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Wait for the target to indicate the HTC layer is ready
- @function name: htc_wait_target
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: This API blocks until the target responds with an HTC ready message.
- The caller should not connect services until the target has indicated it is
- ready.
- @example:
- @see also: htc_connect_service
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+ * Wait for the target to indicate the HTC layer is ready
+ * htc_wait_target
+ * @HTCHandle - HTC handle
+ *
+ * This API blocks until the target responds with an HTC ready message.
+ * The caller should not connect services until the target has indicated it is
+ * ready.
+ * Return: None
+ */
A_STATUS htc_wait_target(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Start target service communications
- @function name: htc_start
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: This API indicates to the target that the service connection phase
- is completeand the target can freely start all connected services. This
- API should only be called AFTER all service connections have been made.
- TCStart will issue a SETUP_COMPLETE message to the target to indicate that
- all service connections have been made and the target can start
- communicating over the endpoints.
- @example:
- @see also: htc_connect_service
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_start - Start target service communications
+ * @HTCHandle - HTC handle
+ *
+ * This API indicates to the target that the service connection phase
+ * is completeand the target can freely start all connected services. This
+ * API should only be called AFTER all service connections have been made.
+ * TCStart will issue a SETUP_COMPLETE message to the target to indicate that
+ * all service connections have been made and the target can start
+ * communicating over the endpoints.
+ * Return: None
+ */
A_STATUS htc_start(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Add receive packet to HTC
- @function name: htc_add_receive_pkt
- @input: HTCHandle - HTC handle
- pPacket - HTC receive packet to add
- @output:
- @return: A_OK on success
- @notes: user must supply HTC packets for capturing incomming HTC frames.
- The caller must initialize each HTC packet using the
- SET_HTC_PACKET_INFO_RX_REFILL() macro.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_add_receive_pkt - Add receive packet to HTC
+ * @HTCHandle - HTC handle
+ * @pPacket - HTC receive packet to add
+ *
+ * User must supply HTC packets for capturing incoming HTC frames.
+ * The caller must initialize each HTC packet using the
+ * SET_HTC_PACKET_INFO_RX_REFILL() macro.
+ * Return: A_OK on success
+ */
A_STATUS htc_add_receive_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Connect to an HTC service
- @function name: htc_connect_service
- @input: HTCHandle - HTC handle
- pReq - connection details
- @output: pResp - connection response
- @return:
- @notes: Service connections must be performed before htc_start.
- User provides callback handlersfor various endpoint events.
- @example:
- @see also: htc_start
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_connect_service - Connect to an HTC service
+ * @HTCHandle - HTC handle
+ * @pReq - connection details
+ * @pResp - connection response
+ *
+ * Service connections must be performed before htc_start.
+ * User provides callback handlersfor various endpoint events.
+ * Return: None
+ */
A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
- HTC_SERVICE_CONNECT_REQ *pReq,
- HTC_SERVICE_CONNECT_RESP *pResp);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: HTC register log dump
- @function name: htc_dump
- @input: HTCHandle - HTC handle
- CmdId - Log command
- start - start/print logs
- @output:
- @return:
- @notes: Register logs will be started/printed.
- be flushed.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+ struct htc_service_connect_req *pReq,
+ struct htc_service_connect_resp *pResp);
+/**
+ * htc_dump - HTC register log dump
+ * @HTCHandle - HTC handle
+ * @CmdId - Log command
+ * @start - start/print logs
+ *
+ * Register logs will be started/printed/ be flushed.
+ * Return: None
+ */
void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Send an HTC packet
- @function name: htc_send_pkt
- @input: HTCHandle - HTC handle
- pPacket - packet to send
- @output:
- @return: A_OK
- @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
- This interface is fully asynchronous. On error, HTC SendPkt will
- call the registered Endpoint callback to cleanup the packet.
- @example:
- @see also: htc_flush_endpoint
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_send_pkt - Send an HTC packet
+ * @HTCHandle - HTC handle
+ * @pPacket - packet to send
+ *
+ * Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
+ * This interface is fully asynchronous. On error, HTC SendPkt will
+ * call the registered Endpoint callback to cleanup the packet.
+ * Return: A_OK
+ */
A_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Send an HTC packet containing a tx descriptor and data
- @function name: htc_send_data_pkt
- @input: HTCHandle - HTC handle
- pPacket - packet to send
- @output:
- @return: A_OK
- @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
- Caller must provide headroom in an initial fragment added to the
- network buffer to store a HTC_FRAME_HDR.
- This interface is fully asynchronous. On error, htc_send_data_pkt will
- call the registered Endpoint EpDataTxComplete callback to cleanup
- the packet.
- @example:
- @see also: htc_send_pkt
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_send_data_pkt - Send an HTC packet containing a tx descriptor and data
+ * @HTCHandle - HTC handle
+ * @pPacket - packet to send
+ *
+ * Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
+ * Caller must provide headroom in an initial fragment added to the
+ * network buffer to store a HTC_FRAME_HDR.
+ * This interface is fully asynchronous. On error, htc_send_data_pkt will
+ * call the registered Endpoint EpDataTxComplete callback to cleanup
+ * the packet.
+ * Return: A_OK
+ */
#ifdef ATH_11AC_TXCOMPACT
A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf,
int Epid, int ActualLength);
@@ -452,229 +520,188 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf,
A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
uint8_t more_data);
#endif /*ATH_11AC_TXCOMPACT */
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Flush HTC when target is removed surprisely service communications
- @function name: htc_flush_surprise_remove
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: All receive and pending TX packets will
- be flushed.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_flush_surprise_remove - Flush HTC when target is removed surprisely
+ * service communications
+ * @HTCHandle - HTC handle
+ *
+ * All receive and pending TX packets will be flushed.
+ * Return: None
+ */
void htc_flush_surprise_remove(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Stop HTC service communications
- @function name: htc_stop
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: HTC communications is halted. All receive and pending TX packets will
- be flushed.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_stop - Stop HTC service communications
+ * @HTCHandle - HTC handle
+ *
+ * HTC communications is halted. All receive and pending TX packets
+ * will be flushed.
+ * Return: None
+ */
void htc_stop(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Destory HTC service
- @function name: htc_destroy
- @input: HTCHandle
- @output:
- @return:
- @notes: This cleans up all resources allocated by htc_create().
- @example:
- @see also: htc_create
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_destroy - Destroy HTC service
+ * @HTCHandle - HTC handle
+ *
+ * This cleans up all resources allocated by htc_create().
+ * Return: None
+ */
void htc_destroy(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Flush pending TX packets
- @function name: htc_flush_endpoint
- @input: HTCHandle - HTC handle
- Endpoint - Endpoint to flush
- Tag - flush tag
- @output:
- @return:
- @notes: The Tag parameter is used to selectively flush packets with matching tags.
- The value of 0 forces all packets to be flush regardless of tag.
- @example:
- @see also: htc_send_pkt
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_flush_endpoint - Flush pending TX packets
+ * @HTCHandle - HTC handle
+ * @Endpoint - Endpoint to flush
+ * @Tag - flush tag
+ *
+ * The Tag parameter is used to selectively flush packets with matching
+ * tags. The value of 0 forces all packets to be flush regardless of tag
+ * Return: None
+ */
void htc_flush_endpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint,
HTC_TX_TAG Tag);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Dump credit distribution state
- @function name: htc_dump_credit_states
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes: This dumps all credit distribution information to the debugger
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_dump_credit_states - Dump credit distribution state
+ * @HTCHandle - HTC handle
+ *
+ * This dumps all credit distribution information to the debugger
+ * Return: None
+ */
void htc_dump_credit_states(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Indicate a traffic activity change on an endpoint
- @function name: htc_indicate_activity_change
- @input: HTCHandle - HTC handle
- Endpoint - endpoint in which activity has changed
- Active - true if active, false if it has become inactive
- @output:
- @return:
- @notes: This triggers the registered credit distribution function to
- re-adjust credits for active/inactive endpoints.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+
+/**
+ * htc_indicate_activity_change - Indicate a traffic activity change on an
+ * endpoint
+ * @HTCHandle - HTC handle
+ * @Endpoint - endpoint in which activity has changed
+ * @Active - true if active, false if it has become inactive
+ *
+ * This triggers the registered credit distribution function to
+ * re-adjust credits for active/inactive endpoints.
+ * Return: None
+ */
void htc_indicate_activity_change(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint, bool Active);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Get endpoint statistics
- @function name: htc_get_endpoint_statistics
- @input: HTCHandle - HTC handle
- Endpoint - Endpoint identifier
- Action - action to take with statistics
- @output:
- pStats - statistics that were sampled (can be NULL if Action is HTC_EP_STAT_CLEAR)
-
- @return: true if statistics profiling is enabled, otherwise false.
-
- @notes : Statistics is a compile-time option and this function may return
- false if HTC is not compiled with profiling.
-
- The caller can specify the statistic "action" to take when sampling
- the statistics. This includes :
-
- HTC_EP_STAT_SAMPLE : The pStats structure is filled with the current
- values.
- HTC_EP_STAT_SAMPLE_AND_CLEAR : The structure is filled and the current
- statisticsare cleared.
-
- HTC_EP_STAT_CLEA : the statistics are cleared, the called can pass a NULL
- value forpStats
-
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_get_endpoint_statistics - Get endpoint statistics
+ * @HTCHandle - HTC handle
+ * @Endpoint - Endpoint identifier
+ * @Action - action to take with statistics
+ * @pStats - statistics that were sampled (can be NULL if Action is
+ * HTC_EP_STAT_CLEAR)
+ *
+ * Statistics is a compile-time option and this function may return
+ * false if HTC is not compiled with profiling.
+ * The caller can specify the statistic "action" to take when sampling
+ * the statistics. This includes :
+ * HTC_EP_STAT_SAMPLE : The pStats structure is filled with the current
+ * values.
+ * HTC_EP_STAT_SAMPLE_AND_CLEAR : The structure is filled and the current
+ * statisticsare cleared.
+ * HTC_EP_STAT_CLEA : the statistics are cleared, the called can pass
+ * a NULL value for pStats
+ * Return: true if statistics profiling is enabled, otherwise false.
+ */
bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
- HTC_ENDPOINT_STAT_ACTION Action,
- HTC_ENDPOINT_STATS *pStats);
+ enum htc_endpoint_stat_action Action,
+ struct htc_endpoint_stats *pStats);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Unblock HTC message reception
- @function name: htc_unblock_recv
- @input: HTCHandle - HTC handle
- @output:
- @return:
- @notes:
- HTC will block the receiver if the EpRecvAlloc callback fails to provide a
- packet. The caller can use this API to indicate to HTC when resources
- (buffers) are available such that the receiver can be unblocked and HTC
- may re-attempt fetching the pending message.
-
- This API is not required if the user uses the EpRecvRefill callback or uses
- the HTCAddReceivePacket()API to recycle or provide receive packets to HTC.
-
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_unblock_recv - Unblock HTC message reception
+ * @HTCHandle - HTC handle
+ *
+ * HTC will block the receiver if the EpRecvAlloc callback fails to provide a
+ * packet. The caller can use this API to indicate to HTC when resources
+ * (buffers) are available such that the receiver can be unblocked and HTC
+ * may re-attempt fetching the pending message.
+ * This API is not required if the user uses the EpRecvRefill callback or uses
+ * the HTCAddReceivePacket()API to recycle or provide receive packets to HTC.
+ * Return: None
+ */
void htc_unblock_recv(HTC_HANDLE HTCHandle);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: send a series of HTC packets
- @function name: htc_send_pkts_multiple
- @input: HTCHandle - HTC handle
- pPktQueue - local queue holding packets to send
- @output:
- @return: A_OK
- @notes: Caller must initialize each packet using SET_HTC_PACKET_INFO_TX() macro.
- The queue must only contain packets directed at the same endpoint.
- Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the TX packets in FIFO order.
- This API will remove the packets from the pkt queue and place them into the HTC Tx Queue
- and bundle messages where possible.
- The caller may allocate the pkt queue on the stack to hold the packets.
- This interface is fully asynchronous. On error, htc_send_pkts will
- call the registered Endpoint callback to cleanup the packet.
- @example:
- @see also: htc_flush_endpoint
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_send_pkts_multiple - Send a series of HTC packets
+ * @HTCHandle - HTC handle
+ * @pPktQueue - local queue holding packets to send
+ *
+ * Caller must initialize each packet using SET_HTC_PACKET_INFO_TX()
+ * macro. The queue must only contain packets directed at the same
+ * endpoint. Caller supplies a pointer to an HTC_PACKET_QUEUE structure
+ * holding the TX packets in FIFO order. This API will remove the
+ * packets from the pkt queue and place them into the HTC Tx Queue
+ * and bundle messages where possible.
+ * The caller may allocate the pkt queue on the stack to hold the pkts.
+ * This interface is fully asynchronous. On error, htc_send_pkts will
+ * call the registered Endpoint callback to cleanup the packet.
+ * Return: A_OK
+ */
A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle,
HTC_PACKET_QUEUE *pPktQueue);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Add multiple receive packets to HTC
- @function name: htc_add_receive_pkt_multiple
- @input: HTCHandle - HTC handle
- pPktQueue - HTC receive packet queue holding packets to add
- @output:
- @return: A_OK on success
- @notes: user must supply HTC packets for capturing incomming HTC frames. The caller
- must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL()
- macro. The queue must only contain recv packets for the same endpoint.
- Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the recv packet.
- This API will remove the packets from the pkt queue and place them into internal
- recv packet list.
- The caller may allocate the pkt queue on the stack to hold the packets.
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_add_receive_pkt_multiple - Add multiple receive packets to HTC
+ * @HTCHandle - HTC handle
+ * @pPktQueue - HTC receive packet queue holding packets to add
+ *
+ * User must supply HTC packets for capturing incoming HTC frames.
+ * The caller mmust initialize each HTC packet using the
+ * SET_HTC_PACKET_INFO_RX_REFILL() macro. The queue must only contain
+ * recv packets for the same endpoint. Caller supplies a pointer to an
+ * HTC_PACKET_QUEUE structure holding the recv packet. This API will
+ * remove the packets from the pkt queue and place them into internal
+ * recv packet list.
+ * The caller may allocate the pkt queue on the stack to hold the pkts.
+ * Return: A_OK on success
+ */
A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle,
HTC_PACKET_QUEUE *pPktQueue);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Check if an endpoint is marked active
- @function name: htc_is_endpoint_active
- @input: HTCHandle - HTC handle
- Endpoint - endpoint to check for active state
- @output:
- @return: returns true if Endpoint is Active
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_is_endpoint_active - Check if an endpoint is marked active
+ * @HTCHandle - HTC handle
+ * @Endpoint - endpoint to check for active state
+ *
+ * Return: returns true if Endpoint is Active
+ */
bool htc_is_endpoint_active(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Set up nodrop pkt flag for mboxping nodrop pkt
- @function name: htc_set_nodrop_pkt
- @input: HTCHandle - HTC handle
- isNodropPkt - indicates whether it is nodrop pkt
- @output:
- @return:
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_set_nodrop_pkt - Set up nodrop pkt flag for mboxping nodrop pkt
+ * @HTCHandle - HTC handle
+ * @isNodropPkt - indicates whether it is nodrop pkt
+ *
+ * Return: None
+ * Return:
+ *
+ */
void htc_set_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Get the number of recv buffers currently queued into an HTC endpoint
- @function name: htc_get_num_recv_buffers
- @input: HTCHandle - HTC handle
- Endpoint - endpoint to check
- @output:
- @return: returns number of buffers in queue
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_get_num_recv_buffers - Get the number of recv buffers currently queued
+ * into an HTC endpoint
+ * @HTCHandle - HTC handle
+ * @Endpoint - endpoint to check
+ *
+ * Return: returns number of buffers in queue
+ *
+ */
int htc_get_num_recv_buffers(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint);
-/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- @desc: Set the target failure handling callback in HTC layer
- @function name: htc_set_target_failure_callback
- @input: HTCHandle - HTC handle
- Callback - target failure handling callback
- @output:
- @return:
- @notes:
- @example:
- @see also:
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
+/**
+ * htc_set_target_failure_callback - Set the target failure handling callback
+ * in HTC layer
+ * @HTCHandle - HTC handle
+ * @Callback - target failure handling callback
+ *
+ * Return: None
+ */
void htc_set_target_failure_callback(HTC_HANDLE HTCHandle,
HTC_TARGET_FAILURE Callback);
@@ -713,20 +740,20 @@ int htc_get_tx_queue_depth(HTC_HANDLE *htc_handle, HTC_ENDPOINT_ID endpoint_id);
void htc_ctrl_msg_cmpl(HTC_HANDLE htc_pdev, HTC_ENDPOINT_ID htc_ep_id);
#define HTC_TX_DESC_FILL(_htc_tx_desc, _download_len, _ep_id, _seq_no) \
-do { \
- HTC_WRITE32((_htc_tx_desc), \
- SM((_download_len), HTC_FRAME_HDR_PAYLOADLEN) | \
- SM((_ep_id), HTC_FRAME_HDR_ENDPOINTID)); \
- \
- HTC_WRITE32((uint32_t *)(_htc_tx_desc) + 1, \
- SM((_seq_no), HTC_FRAME_HDR_CONTROLBYTES1));\
+do { \
+ HTC_WRITE32((_htc_tx_desc), \
+ SM((_download_len), HTC_FRAME_HDR_PAYLOADLEN) | \
+ SM((_ep_id), HTC_FRAME_HDR_ENDPOINTID)); \
+ HTC_WRITE32((uint32_t *)(_htc_tx_desc) + 1, \
+ SM((_seq_no), HTC_FRAME_HDR_CONTROLBYTES1)); \
} while (0)
#endif /* WLAN_FEATURE_FASTPATH */
#ifdef __cplusplus
}
#endif
-void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credit);
+void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle,
+ int *credit);
void htc_dump_counter_info(HTC_HANDLE HTCHandle);
void *htc_get_targetdef(HTC_HANDLE htc_handle);
#ifdef FEATURE_RUNTIME_PM
diff --git a/htc/htc_internal.h b/htc/htc_internal.h
index 6f6fa4707e17..1a914b2a7aaa 100644
--- a/htc/htc_internal.h
+++ b/htc/htc_internal.h
@@ -69,7 +69,8 @@ extern "C" {
#define HTC_PACKET_CONTAINER_ALLOCATION 32
#define NUM_CONTROL_TX_BUFFERS 2
-#define HTC_CONTROL_BUFFER_SIZE (HTC_MAX_CONTROL_MESSAGE_LENGTH + HTC_HDR_LENGTH)
+#define HTC_CONTROL_BUFFER_SIZE (HTC_MAX_CONTROL_MESSAGE_LENGTH + \
+ HTC_HDR_LENGTH)
#define HTC_CONTROL_BUFFER_ALIGN 32
#define HTC_TARGET_RESPONSE_POLL_MS 10
#if !defined(A_SIMOS_DEVHOST)
@@ -84,16 +85,16 @@ extern "C" {
#define HTC_IS_EPPING_ENABLED(_x) ((_x) == QDF_GLOBAL_EPPING_MODE)
-typedef enum {
+enum htc_credit_exchange_type {
HTC_REQUEST_CREDIT,
HTC_PROCESS_CREDIT_REPORT,
HTC_SUSPEND_ACK,
HTC_SUSPEND_NACK,
HTC_INITIAL_WAKE_UP,
-} htc_credit_exchange_type;
+};
static inline const char*
-htc_credit_exchange_type_str(htc_credit_exchange_type type)
+htc_credit_exchange_type_str(enum htc_credit_exchange_type type)
{
switch (type) {
case HTC_REQUEST_CREDIT:
@@ -111,12 +112,12 @@ htc_credit_exchange_type_str(htc_credit_exchange_type type)
}
}
-typedef struct {
- htc_credit_exchange_type type;
+struct HTC_CREDIT_HISTORY {
+ enum htc_credit_exchange_type type;
uint64_t time;
uint32_t tx_credit;
uint32_t htc_tx_queue_depth;
-} HTC_CREDIT_HISTORY;
+};
typedef struct _HTC_ENDPOINT {
HTC_ENDPOINT_ID Id;
@@ -126,32 +127,44 @@ typedef struct _HTC_ENDPOINT {
*/
HTC_SERVICE_ID service_id;
- HTC_EP_CALLBACKS EpCallBacks; /* callbacks associated with this endpoint */
- HTC_PACKET_QUEUE TxQueue; /* HTC frame buffer TX queue */
- int MaxTxQueueDepth; /* max depth of the TX queue before we need to
- call driver's full handler */
- int MaxMsgLength; /* max length of endpoint message */
+ /* callbacks associated with this endpoint */
+ struct htc_ep_callbacks EpCallBacks;
+ /* HTC frame buffer TX queue */
+ HTC_PACKET_QUEUE TxQueue;
+ /* max depth of the TX queue before calling driver's full handler */
+ int MaxTxQueueDepth;
+ /* max length of endpoint message */
+ int MaxMsgLength;
uint8_t UL_PipeID;
uint8_t DL_PipeID;
- int ul_is_polled; /* Need to call HIF to get tx completion callbacks? */
+ /* Need to call HIF to get tx completion callbacks? */
+ int ul_is_polled;
qdf_timer_t ul_poll_timer;
int ul_poll_timer_active;
int ul_outstanding_cnt;
- int dl_is_polled; /* Need to call HIF to fetch rx? (Not currently supported.) */
-#if 0 /* not currently supported */
- qdf_timer_t dl_poll_timer;
-#endif
-
- HTC_PACKET_QUEUE TxLookupQueue; /* lookup queue to match netbufs to htc packets */
- HTC_PACKET_QUEUE RxBufferHoldQueue; /* temporary hold queue for back compatibility */
- uint8_t SeqNo; /* TX seq no (helpful) for debugging */
- qdf_atomic_t TxProcessCount; /* serialization */
+ /* Need to call HIF to fetch rx? (Not currently supported.) */
+ int dl_is_polled;
+ /* not currently supported */
+ /* qdf_timer_t dl_poll_timer; */
+
+ /* lookup queue to match netbufs to htc packets */
+ HTC_PACKET_QUEUE TxLookupQueue;
+ /* temporary hold queue for back compatibility */
+ HTC_PACKET_QUEUE RxBufferHoldQueue;
+ /* TX seq no (helpful) for debugging */
+ uint8_t SeqNo;
+ /* serialization */
+ qdf_atomic_t TxProcessCount;
struct _HTC_TARGET *target;
- int TxCredits; /* TX credits available on this endpoint */
- int TxCreditSize; /* size in bytes of each credit (set by HTC) */
- int TxCreditsPerMaxMsg; /* credits required per max message (precalculated) */
+ /* TX credits available on this endpoint */
+ int TxCredits;
+ /* size in bytes of each credit (set by HTC) */
+ int TxCreditSize;
+ /* credits required per max message (precalculated) */
+ int TxCreditsPerMaxMsg;
#ifdef HTC_EP_STAT_PROFILING
- HTC_ENDPOINT_STATS endpoint_stats; /* endpoint statistics */
+ /* endpoint statistics */
+ struct htc_endpoint_stats endpoint_stats;
#endif
bool TxCreditFlowEnabled;
} HTC_ENDPOINT;
@@ -162,16 +175,17 @@ typedef struct _HTC_ENDPOINT {
#define INC_HTC_EP_STAT(p, stat, count)
#endif
-typedef struct {
+struct htc_service_tx_credit_allocation {
uint16_t service_id;
uint8_t CreditAllocation;
-} HTC_SERVICE_TX_CREDIT_ALLOCATION;
+};
#define HTC_MAX_SERVICE_ALLOC_ENTRIES 8
/* Error codes for HTC layer packet stats*/
enum ol_ath_htc_pkt_ecodes {
- GET_HTC_PKT_Q_FAIL = 0, /* error- get packet at head of HTC_PACKET_Q */
+ /* error- get packet at head of HTC_PACKET_Q */
+ GET_HTC_PKT_Q_FAIL = 0,
HTC_PKT_Q_EMPTY,
HTC_SEND_Q_EMPTY
};
@@ -185,15 +199,15 @@ typedef struct _HTC_TARGET {
qdf_spinlock_t HTCCreditLock;
uint32_t HTCStateFlags;
void *host_handle;
- HTC_INIT_INFO HTCInitInfo;
- HTC_PACKET *pHTCPacketStructPool; /* pool of HTC packets */
+ struct htc_init_info HTCInitInfo;
+ HTC_PACKET *pHTCPacketStructPool; /* pool of HTC packets */
HTC_PACKET_QUEUE ControlBufferTXFreeList;
uint8_t CtrlResponseBuffer[HTC_MAX_CONTROL_MESSAGE_LENGTH];
int CtrlResponseLength;
qdf_event_t ctrl_response_valid;
bool CtrlResponseProcessing;
int TotalTransmitCredits;
- HTC_SERVICE_TX_CREDIT_ALLOCATION
+ struct htc_service_tx_credit_allocation
ServiceTxAllocTable[HTC_MAX_SERVICE_ALLOC_ENTRIES];
int TargetCreditSize;
#ifdef RX_SG_SUPPORT
@@ -244,21 +258,23 @@ typedef struct _HTC_TARGET {
#ifdef RX_SG_SUPPORT
#define RESET_RX_SG_CONFIG(_target) \
+do { \
_target->ExpRxSgTotalLen = 0; \
_target->CurRxSgTotalLen = 0; \
- _target->IsRxSgInprogress = false;
+ _target->IsRxSgInprogress = false; \
+} while (0)
#endif
#define HTC_STATE_STOPPING (1 << 0)
#define HTC_STOPPING(t) ((t)->HTCStateFlags & HTC_STATE_STOPPING)
-#define LOCK_HTC(t) qdf_spin_lock_bh(&(t)->HTCLock);
-#define UNLOCK_HTC(t) qdf_spin_unlock_bh(&(t)->HTCLock);
-#define LOCK_HTC_RX(t) qdf_spin_lock_bh(&(t)->HTCRxLock);
-#define UNLOCK_HTC_RX(t) qdf_spin_unlock_bh(&(t)->HTCRxLock);
-#define LOCK_HTC_TX(t) qdf_spin_lock_bh(&(t)->HTCTxLock);
-#define UNLOCK_HTC_TX(t) qdf_spin_unlock_bh(&(t)->HTCTxLock);
-#define LOCK_HTC_CREDIT(t) qdf_spin_lock_bh(&(t)->HTCCreditLock);
-#define UNLOCK_HTC_CREDIT(t) qdf_spin_unlock_bh(&(t)->HTCCreditLock);
+#define LOCK_HTC(t) qdf_spin_lock_bh(&(t)->HTCLock)
+#define UNLOCK_HTC(t) qdf_spin_unlock_bh(&(t)->HTCLock)
+#define LOCK_HTC_RX(t) qdf_spin_lock_bh(&(t)->HTCRxLock)
+#define UNLOCK_HTC_RX(t) qdf_spin_unlock_bh(&(t)->HTCRxLock)
+#define LOCK_HTC_TX(t) qdf_spin_lock_bh(&(t)->HTCTxLock)
+#define UNLOCK_HTC_TX(t) qdf_spin_unlock_bh(&(t)->HTCTxLock)
+#define LOCK_HTC_CREDIT(t) qdf_spin_lock_bh(&(t)->HTCCreditLock)
+#define UNLOCK_HTC_CREDIT(t) qdf_spin_unlock_bh(&(t)->HTCCreditLock)
#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd))
@@ -270,21 +286,19 @@ typedef struct _HTC_TARGET {
#define OL_ATH_HTC_PKT_ERROR_COUNT_INCR(_target, _ecode) \
do { \
if (_ecode == GET_HTC_PKT_Q_FAIL) \
- (_target->htc_pkt_stats.htc_get_pkt_q_fail_count) += 1 \
- ; \
+ (_target->htc_pkt_stats.htc_get_pkt_q_fail_count) += 1; \
if (_ecode == HTC_PKT_Q_EMPTY) \
- (_target->htc_pkt_stats.htc_pkt_q_empty_count) += 1 \
- ; \
+ (_target->htc_pkt_stats.htc_pkt_q_empty_count) += 1; \
if (_ecode == HTC_SEND_Q_EMPTY) \
- (_target->htc_pkt_stats.htc_send_q_empty_count) += 1 \
- ; \
- } while (0);
+ (_target->htc_pkt_stats.htc_send_q_empty_count) += 1; \
+ } while (0)
/* internal HTC functions */
QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
uint8_t pipeID);
QDF_STATUS htc_tx_completion_handler(void *Context, qdf_nbuf_t netbuf,
- unsigned int transferID, uint32_t toeplitz_hash_result);
+ unsigned int transferID,
+ uint32_t toeplitz_hash_result);
HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target);
void free_htc_bundle_packet(HTC_TARGET *target, HTC_PACKET *pPacket);
@@ -310,7 +324,7 @@ void htc_send_complete_check_cleanup(void *context);
void htc_kick_queues(void *context);
#endif
-void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit,
+void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
uint32_t htc_tx_queue_depth);
static inline void htc_send_complete_poll_timer_stop(HTC_ENDPOINT *
@@ -328,9 +342,8 @@ static inline void htc_send_complete_poll_timer_start(HTC_ENDPOINT *
LOCK_HTC_TX(pEndpoint->target);
if (pEndpoint->ul_outstanding_cnt
&& !pEndpoint->ul_poll_timer_active) {
- /*
- qdf_timer_start(
- &pEndpoint->ul_poll_timer, HTC_POLL_CLEANUP_PERIOD_MS);
+ /* qdf_timer_start(
+ * &pEndpoint->ul_poll_timer, HTC_POLL_CLEANUP_PERIOD_MS);
*/
pEndpoint->ul_poll_timer_active = 1;
}
diff --git a/htc/htc_packet.h b/htc/htc_packet.h
index bb23dcbf3cc0..5356e4f62d47 100644
--- a/htc/htc_packet.h
+++ b/htc/htc_packet.h
@@ -52,13 +52,21 @@ typedef void (*HTC_PACKET_COMPLETION)(void *, struct _HTC_PACKET *);
typedef uint16_t HTC_TX_TAG;
-typedef struct _HTC_TX_PACKET_INFO {
- HTC_TX_TAG Tag; /* tag used to selective flush packets */
- int CreditsUsed; /* number of credits used for this TX packet (HTC internal) */
- uint8_t SendFlags; /* send flags (HTC internal) */
- int SeqNo; /* internal seq no for debugging (HTC internal) */
- uint32_t Flags; /* internal use */
-} HTC_TX_PACKET_INFO;
+/**
+ * struct htc_tx_packet_info - HTC TX packet information
+ * @Tag: tag used to selective flush packets
+ * @CreditsUsed: number of credits used for this TX packet (HTC internal)
+ * @SendFlags: send flags (HTC internal)
+ * @SeqNo: internal seq no for debugging (HTC internal)
+ * @Flags: Internal use
+ */
+struct htc_tx_packet_info {
+ HTC_TX_TAG Tag;
+ int CreditsUsed;
+ uint8_t SendFlags;
+ int SeqNo;
+ uint32_t Flags;
+};
/**
* HTC_TX_PACKET_TAG_XXX - #defines for tagging packets for special handling
@@ -80,26 +88,51 @@ typedef struct _HTC_TX_PACKET_INFO {
#define HTC_TX_PACKET_FLAG_FIXUP_NETBUF (1 << 0)
-typedef struct _HTC_RX_PACKET_INFO {
- uint32_t ExpectedHdr; /* HTC internal use */
- uint32_t HTCRxFlags; /* HTC internal use */
- uint32_t IndicationFlags; /* indication flags set on each RX packet indication */
-} HTC_RX_PACKET_INFO;
-
-#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) /* more packets on this endpoint are being fetched */
+/**
+ * struct htc_rx_packet_info - HTC RX Packet information
+ * @ExpectedHdr: HTC Internal use
+ * @HTCRxFlags: HTC Internal use
+ * @IndicationFlags: indication flags set on each RX packet indication
+ */
+struct htc_rx_packet_info {
+ uint32_t ExpectedHdr;
+ uint32_t HTCRxFlags;
+ uint32_t IndicationFlags;
+};
+
+/* more packets on this endpoint are being fetched */
+#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0)
#define HTC_PACKET_MAGIC_COOKIE 0xdeadbeef
/* wrapper around endpoint-specific packets */
+/**
+ * struct _HTC_PACKET - HTC Packet data structure
+ * @ListLink: double link
+ * @pPktContext: caller's per packet specific context
+ * @pBufferStart: The true buffer start, the caller can store the real buffer
+ * start here. In receive callbacks, the HTC layer sets pBuffer
+ * to the start of the payload past the header. This field allows
+ * the caller to reset pBuffer when it recycles receive packets
+ * back to HTC
+ * @pBuffer: payload start (RX/TX)
+ * @BufferLength: length of buffer
+ * @ActualLength: actual length of payload
+ * @Endpoint: endpoint that this packet was sent/recv'd from
+ * @Status: completion status
+ * @PktInfo: Packet specific info
+ * @netbufOrigHeadRoom: Original head room of skb
+ * @Completion: completion
+ * @pContext: HTC private completion context
+ * @pNetBufContext: optimization for network-oriented data, the HTC packet can
+ * pass the network buffer corresponding to the HTC packet
+ * lower layers may optimized the transfer knowing this is a
+ * network buffer
+ * @magic_cookie: HTC Magic cookie
+ */
typedef struct _HTC_PACKET {
- DL_LIST ListLink; /* double link */
- void *pPktContext; /* caller's per packet specific context */
-
- uint8_t *pBufferStart; /* the true buffer start , the caller can
- store the real buffer start here. In
- receive callbacks, the HTC layer sets pBuffer
- to the start of the payload past the header. This
- field allows the caller to reset pBuffer when it
- recycles receive packets back to HTC */
+ DL_LIST ListLink;
+ void *pPktContext;
+ uint8_t *pBufferStart;
/*
* Pointer to the start of the buffer. In the transmit
* direction this points to the start of the payload. In the
@@ -107,24 +140,20 @@ typedef struct _HTC_PACKET {
* points to the start of the HTC header but when returned
* to the caller points to the start of the payload
*/
- uint8_t *pBuffer; /* payload start (RX/TX) */
- uint32_t BufferLength; /* length of buffer */
- uint32_t ActualLength; /* actual length of payload */
- HTC_ENDPOINT_ID Endpoint; /* endpoint that this packet was sent/recv'd from */
- A_STATUS Status; /* completion status */
+ uint8_t *pBuffer;
+ uint32_t BufferLength;
+ uint32_t ActualLength;
+ HTC_ENDPOINT_ID Endpoint;
+ A_STATUS Status;
union {
- HTC_TX_PACKET_INFO AsTx; /* Tx Packet specific info */
- HTC_RX_PACKET_INFO AsRx; /* Rx Packet specific info */
+ struct htc_tx_packet_info AsTx;
+ struct htc_rx_packet_info AsRx;
} PktInfo;
-
/* the following fields are for internal HTC use */
uint32_t netbufOrigHeadRoom;
- HTC_PACKET_COMPLETION Completion; /* completion */
- void *pContext; /* HTC private completion context */
- void *pNetBufContext; /* optimization for network-oriented data, the HTC packet
- can pass the network buffer corresponding to the HTC packet
- lower layers may optimized the transfer knowing this is
- a network buffer */
+ HTC_PACKET_COMPLETION Completion;
+ void *pContext;
+ void *pNetBufContext;
uint32_t magic_cookie;
} HTC_PACKET;
@@ -167,9 +196,9 @@ typedef struct _HTC_PACKET {
} while (0)
#define SET_HTC_PACKET_NET_BUF_CONTEXT(p, nb) \
- do { \
- (p)->pNetBufContext = (nb); \
- } while (0)
+ { \
+ (p)->pNetBufContext = (nb); \
+ }
#define GET_HTC_PACKET_NET_BUF_CONTEXT(p) (p)->pNetBufContext
@@ -202,11 +231,11 @@ typedef struct _HTC_PACKET_QUEUE {
/* get packet at head without removing it */
static inline HTC_PACKET *htc_get_pkt_at_head(HTC_PACKET_QUEUE *queue)
{
- if (queue->Depth == 0) {
+ if (queue->Depth == 0)
return NULL;
- }
- return
- A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(&queue->QueueHead)),
+
+ return A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(
+ &queue->QueueHead)),
HTC_PACKET, ListLink);
}
@@ -221,6 +250,7 @@ static inline HTC_PACKET *htc_get_pkt_at_head(HTC_PACKET_QUEUE *queue)
static inline HTC_PACKET *htc_packet_dequeue(HTC_PACKET_QUEUE *queue)
{
DL_LIST *pItem = dl_list_remove_item_from_head(&queue->QueueHead);
+
if (pItem != NULL) {
queue->Depth--;
return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink);
@@ -232,6 +262,7 @@ static inline HTC_PACKET *htc_packet_dequeue(HTC_PACKET_QUEUE *queue)
static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
{
DL_LIST *pItem = dl_list_remove_item_from_tail(&queue->QueueHead);
+
if (pItem != NULL) {
queue->Depth--;
return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink);
@@ -245,11 +276,12 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
#define HTC_GET_TAG_FROM_PKT(p) (p)->PktInfo.AsTx.Tag
/* transfer the packets from one queue to the tail of another queue */
-#define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest, pQSrc) \
- { \
- dl_list_transfer_items_to_tail(&(pQDest)->QueueHead, &(pQSrc)->QueueHead); \
- (pQDest)->Depth += (pQSrc)->Depth; \
- (pQSrc)->Depth = 0; \
+#define HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(pQDest, pQSrc) \
+ { \
+ dl_list_transfer_items_to_tail(&(pQDest)->QueueHead, \
+ &(pQSrc)->QueueHead); \
+ (pQDest)->Depth += (pQSrc)->Depth; \
+ (pQSrc)->Depth = 0; \
}
/*
@@ -259,10 +291,11 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
* to the concatenated queue.
*/
#define HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(pQDest, pQSrc) \
- { \
- dl_list_transfer_items_to_head(&(pQDest)->QueueHead, &(pQSrc)->QueueHead); \
- (pQDest)->Depth += (pQSrc)->Depth; \
- (pQSrc)->Depth = 0; \
+ { \
+ dl_list_transfer_items_to_head(&(pQDest)->QueueHead, \
+ &(pQSrc)->QueueHead); \
+ (pQDest)->Depth += (pQSrc)->Depth; \
+ (pQSrc)->Depth = 0; \
}
/* fast version to init and add a single packet to a queue */
@@ -273,9 +306,10 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
}
#define HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pQ, pPTemp) \
- ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead, (pPTemp), HTC_PACKET, ListLink)
+ ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead, \
+ (pPTemp), HTC_PACKET, ListLink)
-#define HTC_PACKET_QUEUE_ITERATE_IS_VALID(pQ) ITERATE_IS_VALID(&(pQ)->QueueHead)
+#define HTC_PACKET_QUEUE_ITERATE_IS_VALID(pQ) ITERATE_IS_VALID(&(pQ)->QueueHead)
#define HTC_PACKET_QUEUE_ITERATE_RESET(pQ) ITERATE_RESET(&(pQ)->QueueHead)
#define HTC_PACKET_QUEUE_ITERATE_END ITERATE_END
diff --git a/htc/htc_recv.c b/htc/htc_recv.c
index 2538d965b922..c88bb3e59779 100644
--- a/htc/htc_recv.c
+++ b/htc/htc_recv.c
@@ -94,15 +94,16 @@ static void do_recv_completion(HTC_ENDPOINT *pEndpoint,
if (pEndpoint->EpCallBacks.EpRecvPktMultiple != NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- (" HTC calling ep %d, recv multiple callback (%d pkts) \n",
+ ("HTC calling ep %d, recv multiple callback (%d pkts)\n",
pEndpoint->Id,
HTC_PACKET_QUEUE_DEPTH
(pQueueToIndicate)));
- /* a recv multiple handler is being used, pass the queue to the handler */
- pEndpoint->EpCallBacks.EpRecvPktMultiple(pEndpoint->
- EpCallBacks.
- pContext,
- pQueueToIndicate);
+ /* a recv multiple handler is being used, pass the queue
+ * to the handler
+ */
+ pEndpoint->EpCallBacks.EpRecvPktMultiple(
+ pEndpoint->EpCallBacks.pContext,
+ pQueueToIndicate);
INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
} else {
HTC_PACKET *pPacket;
@@ -137,6 +138,7 @@ static void recv_packet_completion(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint,
HTC_PACKET *pPacket)
{
HTC_PACKET_QUEUE container;
+
INIT_HTC_PACKET_QUEUE_AND_ADD(&container, pPacket);
/* do completion */
do_recv_completion(pEndpoint, &container);
@@ -169,6 +171,7 @@ void htc_disable_recv(HTC_HANDLE HTCHandle)
int htc_get_num_recv_buffers(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
HTC_ENDPOINT *pEndpoint = &target->endpoint[Endpoint];
return HTC_PACKET_QUEUE_DEPTH(&pEndpoint->RxBufferHoldQueue);
}
@@ -313,7 +316,8 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
("HTC Rx: invalid EndpointID=%d\n",
htc_ep_id));
debug_dump_bytes((uint8_t *) HtcHdr,
- sizeof(HTC_FRAME_HDR), "BAD HTC Header");
+ sizeof(HTC_FRAME_HDR),
+ "BAD HTC Header");
status = QDF_STATUS_E_FAILURE;
QDF_BUG(0);
break;
@@ -324,12 +328,11 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
/*
* If this endpoint that received a message from the target has
* a to-target HIF pipe whose send completions are polled rather
- * than interrupt-driven, this is a good point to ask HIF to check
- * whether it has any completed sends to handle.
+ * than interrupt driven, this is a good point to ask HIF to
+ * check whether it has any completed sends to handle.
*/
- if (pEndpoint->ul_is_polled) {
+ if (pEndpoint->ul_is_polled)
htc_send_complete_check(pEndpoint, 1);
- }
payloadLen = HTC_GET_FIELD(HtcHdr, HTC_FRAME_HDR, PAYLOADLEN);
@@ -383,12 +386,14 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
}
trailerlen = temp;
- /* process trailer data that follows HDR + application payload */
+ /* process trailer data that follows HDR +
+ * application payload
+ */
temp_status = htc_process_trailer(target,
- ((uint8_t *) HtcHdr +
- HTC_HDR_LENGTH +
- payloadLen - temp),
- temp, htc_ep_id);
+ ((uint8_t *) HtcHdr +
+ HTC_HDR_LENGTH +
+ payloadLen - temp),
+ temp, htc_ep_id);
if (A_FAILED(temp_status)) {
status = QDF_STATUS_E_FAILURE;
break;
@@ -398,7 +403,7 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
}
if (((int)payloadLen - (int)trailerlen) <= 0) {
- /* zero length packet with trailer data, just drop these */
+ /* 0 length packet with trailer data, just drop these */
break;
}
@@ -413,15 +418,17 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
netlen = qdf_nbuf_len(netbuf);
htc_msg = (HTC_UNKNOWN_MSG *) netdata;
- message_id =
- HTC_GET_FIELD(htc_msg, HTC_UNKNOWN_MSG, MESSAGEID);
+ message_id = HTC_GET_FIELD(htc_msg, HTC_UNKNOWN_MSG,
+ MESSAGEID);
switch (message_id) {
default:
/* handle HTC control message */
if (target->CtrlResponseProcessing) {
- /* this is a fatal error, target should not be sending unsolicited messages
- * on the endpoint 0 */
+ /* this is a fatal error, target should
+ * not be sending unsolicited messages
+ * on the endpoint 0
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("HTC Rx Ctrl still processing\n"));
status = QDF_STATUS_E_FAILURE;
@@ -453,8 +460,10 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
HTC_PACKET_QUEUE_DEPTH(
&pEndpoint->TxQueue));
UNLOCK_HTC_CREDIT(target);
- if (target->HTCInitInfo.target_initial_wakeup_cb)
- target->HTCInitInfo.target_initial_wakeup_cb();
+ if (target->HTCInitInfo.
+ target_initial_wakeup_cb)
+ target->HTCInitInfo.
+ target_initial_wakeup_cb();
else
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
("No initial wake up cb"));
@@ -493,10 +502,11 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
break;
}
- /* the current message based HIF architecture allocates net bufs for recv packets
- * since this layer bridges that HIF to upper layers , which expects HTC packets,
- * we form the packets here
- * TODO_FIXME */
+ /* the current message based HIF architecture allocates net bufs
+ * for recv packets since this layer bridges that HIF to upper
+ * layers , which expects HTC packets, we form the packets here
+ * TODO_FIXME
+ */
pPacket = allocate_htc_packet_container(target);
if (NULL == pPacket) {
status = QDF_STATUS_E_RESOURCES;
@@ -522,9 +532,8 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
_out:
#endif
- if (netbuf != NULL) {
+ if (netbuf != NULL)
qdf_nbuf_free(netbuf);
- }
return status;
@@ -589,6 +598,7 @@ A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle,
A_STATUS htc_add_receive_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket)
{
HTC_PACKET_QUEUE queue;
+
INIT_HTC_PACKET_QUEUE_AND_ADD(&queue, pPacket);
return htc_add_receive_pkt_multiple(HTCHandle, &queue);
}
@@ -602,14 +612,13 @@ void htc_flush_rx_hold_queue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint)
while (1) {
pPacket = htc_packet_dequeue(&pEndpoint->RxBufferHoldQueue);
- if (NULL == pPacket) {
+ if (pPacket == NULL)
break;
- }
UNLOCK_HTC_RX(target);
pPacket->Status = A_ECANCELED;
pPacket->ActualLength = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- (" Flushing RX packet:%p, length:%d, ep:%d \n",
+ ("Flushing RX packet:%p, length:%d, ep:%d\n",
pPacket, pPacket->BufferLength,
pPacket->Endpoint));
INIT_HTC_PACKET_QUEUE_AND_ADD(&container, pPacket);
@@ -647,32 +656,6 @@ A_STATUS htc_wait_recv_ctrl_message(HTC_TARGET *target)
UNLOCK_HTC_RX(target);
-#if 0
- while (count > 0) {
-
- LOCK_HTC_RX(target);
-
- if (target->CtrlResponseValid) {
- target->CtrlResponseValid = false;
- /* caller will clear this flag */
- target->CtrlResponseProcessing = true;
- UNLOCK_HTC_RX(target);
- break;
- }
-
- UNLOCK_HTC_RX(target);
-
- count--;
- A_MSLEEP(HTC_TARGET_RESPONSE_POLL_MS);
- }
-
- if (count <= 0) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("-HTCWaitCtrlMessageRecv: Timeout!\n"));
- return A_ECOMM;
- }
-#endif
-
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCWaitCtrlMessageRecv success\n"));
return A_OK;
}
@@ -690,11 +673,10 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
A_STATUS status;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
- ("+htc_process_trailer (length:%d) \n", Length));
+ ("+htc_process_trailer (length:%d)\n", Length));
- if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) {
+ if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV))
AR_DEBUG_PRINTBUF(pBuffer, Length, "Recv Trailer");
- }
pOrigBuffer = pBuffer;
origLength = Length;
@@ -717,7 +699,7 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
if (htc_rec_len > Length) {
/* no room left in buffer for record */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" invalid record length: %d (id:%d) buffer has: %d bytes left \n",
+ ("invalid record length: %d (id:%d) buffer has: %d bytes left\n",
htc_rec_len, htc_rec_id, Length));
status = A_EPROTO;
break;
@@ -748,7 +730,7 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
default:
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" HTC unhandled record: id:%d length:%d \n",
+ ("HTC unhandled record: id:%d length:%d\n",
htc_rec_id, htc_rec_len));
break;
}
@@ -762,11 +744,10 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
Length -= htc_rec_len;
}
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
debug_dump_bytes(pOrigBuffer, origLength, "BAD Recv Trailer");
- }
- AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-htc_process_trailer \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("-htc_process_trailer\n"));
return status;
}
diff --git a/htc/htc_send.c b/htc/htc_send.c
index 7b496b5197b4..3eff8cd2d656 100644
--- a/htc/htc_send.c
+++ b/htc/htc_send.c
@@ -38,10 +38,10 @@
#define HTC_DATA_RESOURCE_THRS 256
#define HTC_DATA_MINDESC_PERPACKET 2
-typedef enum _HTC_SEND_QUEUE_RESULT {
+enum HTC_SEND_QUEUE_RESULT {
HTC_SEND_QUEUE_OK = 0, /* packet was queued */
- HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */
-} HTC_SEND_QUEUE_RESULT;
+ HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */
+};
#ifndef DEBUG_CREDIT
#define DEBUG_CREDIT 0
@@ -49,14 +49,14 @@ typedef enum _HTC_SEND_QUEUE_RESULT {
#if DEBUG_CREDIT
/* bit mask to enable debug certain endpoint */
-static unsigned ep_debug_mask =
+static unsigned int ep_debug_mask =
(1 << ENDPOINT_0) | (1 << ENDPOINT_1) | (1 << ENDPOINT_2);
#endif
/* HTC Control Path Credit History */
-uint32_t g_htc_credit_history_idx = 0;
+uint32_t g_htc_credit_history_idx;
uint32_t g_htc_credit_history_length;
-HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
+struct HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
/**
* htc_credit_record() - records tx que state & credit transactions
@@ -72,9 +72,9 @@ HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
* Consider making this function accept an HTC_ENDPOINT and find the current
* credits and queue depth itself.
*
- * Consider moving the LOCK_HTC_CREDIT(target); logic into this function as well.
+ * Consider moving the LOCK_HTC_CREDIT(target); logic into this func as well
*/
-void htc_credit_record(htc_credit_exchange_type type, uint32_t tx_credit,
+void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
uint32_t htc_tx_queue_depth) {
if (HTC_CREDIT_HISTORY_MAX <= g_htc_credit_history_idx)
g_htc_credit_history_idx = 0;
@@ -113,7 +113,8 @@ void htc_print_credit_history(HTC_HANDLE htc, uint32_t count,
print(print_priv,
"Time (seconds) Type Credits Queue Depth");
while (count) {
- HTC_CREDIT_HISTORY *hist = &htc_credit_history_buffer[idx];
+ struct HTC_CREDIT_HISTORY *hist =
+ &htc_credit_history_buffer[idx];
long long us = qdf_log_timestamp_to_usecs(hist->time);
print(print_priv, "% 8lld.%06lld %-25s %-7.d %d",
@@ -150,7 +151,8 @@ int htc_get_tx_queue_depth(HTC_HANDLE *htc_handle, HTC_ENDPOINT_ID endpoint_id)
return HTC_PACKET_QUEUE_DEPTH(&endpoint->TxQueue);
}
-void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credits)
+void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle,
+ int *credits)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
@@ -177,6 +179,7 @@ static inline void restore_tx_packet(HTC_TARGET *target, HTC_PACKET *pPacket)
{
if (pPacket->PktInfo.AsTx.Flags & HTC_TX_PACKET_FLAG_FIXUP_NETBUF) {
qdf_nbuf_t netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
+
qdf_nbuf_unmap(target->osdev, netbuf, QDF_DMA_TO_DEVICE);
qdf_nbuf_pull_head(netbuf, sizeof(HTC_FRAME_HDR));
pPacket->PktInfo.AsTx.Flags &= ~HTC_TX_PACKET_FLAG_FIXUP_NETBUF;
@@ -196,16 +199,19 @@ static void do_send_completion(HTC_ENDPOINT *pEndpoint,
if (pEndpoint->EpCallBacks.EpTxCompleteMultiple != NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" HTC calling ep %d, send complete multiple callback (%d pkts) \n",
+ ("HTC calling ep %d, send complete multiple callback (%d pkts)\n",
pEndpoint->Id,
HTC_PACKET_QUEUE_DEPTH
(pQueueToIndicate)));
- /* a multiple send complete handler is being used, pass the queue to the handler */
- pEndpoint->EpCallBacks.EpTxCompleteMultiple(pEndpoint->
- EpCallBacks.
- pContext,
- pQueueToIndicate);
- /* all packets are now owned by the callback, reset queue to be safe */
+ /* a multiple send complete handler is being used, pass
+ * the queue to the handler
+ */
+ pEndpoint->EpCallBacks.EpTxCompleteMultiple(
+ pEndpoint->EpCallBacks.pContext,
+ pQueueToIndicate);
+ /* all packets are now owned by the callback, reset
+ * queue to be safe
+ */
INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
} else {
HTC_PACKET *pPacket;
@@ -213,7 +219,7 @@ static void do_send_completion(HTC_ENDPOINT *pEndpoint,
do {
pPacket = htc_packet_dequeue(pQueueToIndicate);
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" HTC calling ep %d send complete callback on packet %p \n",
+ ("HTC calling ep %d send complete callback on packet %p\n",
pEndpoint->Id, pPacket));
pEndpoint->EpCallBacks.EpTxComplete(pEndpoint->
EpCallBacks.
@@ -241,6 +247,7 @@ static void send_packet_completion(HTC_TARGET *target, HTC_PACKET *pPacket)
void htc_send_complete_check_cleanup(void *context)
{
HTC_ENDPOINT *pEndpoint = (HTC_ENDPOINT *) context;
+
htc_send_complete_check(pEndpoint, 1);
}
@@ -249,6 +256,7 @@ HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target)
HTC_PACKET *pPacket;
HTC_PACKET_QUEUE *pQueueSave;
qdf_nbuf_t netbuf;
+
LOCK_HTC_TX(target);
if (NULL == target->pBundleFreeList) {
UNLOCK_HTC_TX(target);
@@ -256,9 +264,8 @@ HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target)
target->MaxMsgsPerHTCBundle *
target->TargetCreditSize, 0, 4, false);
AR_DEBUG_ASSERT(netbuf);
- if (!netbuf) {
+ if (!netbuf)
return NULL;
- }
pPacket = qdf_mem_malloc(sizeof(HTC_PACKET));
AR_DEBUG_ASSERT(pPacket);
if (!pPacket) {
@@ -278,8 +285,10 @@ HTC_PACKET *allocate_htc_bundle_packet(HTC_TARGET *target)
pPacket->pBuffer = qdf_nbuf_data(netbuf);
pPacket->BufferLength = qdf_nbuf_len(netbuf);
- /* store the original head room so that we can restore this when we "free" the packet */
- /* free packet puts the packet back on the free list */
+ /* store the original head room so that we can restore this
+ * when we "free" the packet.
+ * free packet puts the packet back on the free list
+ */
pPacket->netbufOrigHeadRoom = qdf_nbuf_headroom(netbuf);
return pPacket;
}
@@ -306,14 +315,16 @@ void free_htc_bundle_packet(HTC_TARGET *target, HTC_PACKET *pPacket)
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
AR_DEBUG_ASSERT(netbuf);
if (!netbuf) {
- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("\n%s: Invalid netbuf in HTC "
- "Packet\n", __func__));
+ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
+ ("\n%s: Invalid netbuf in HTC Packet\n",
+ __func__));
return;
}
- /* HIF adds data to the headroom section of the nbuf, restore the original */
- /* size. If this is not done, headroom keeps shrinking with every HIF send */
- /* and eventually HIF ends up doing another malloc big enough to store the */
- /* data + its header */
+ /* HIF adds data to the headroom section of the nbuf, restore thei
+ * original size. If this is not done, headroom keeps shrinking with
+ * every HIF send and eventually HIF ends up doing another malloc big
+ * enough to store the data + its header
+ */
curentHeadRoom = qdf_nbuf_headroom(netbuf);
qdf_nbuf_pull_head(netbuf,
@@ -359,8 +370,6 @@ htc_send_update_tx_bundle_stats(HTC_TARGET *target,
{
if ((data_len / TxCreditSize) <= HTC_MAX_MSG_PER_BUNDLE_TX)
target->tx_bundle_stats[(data_len / TxCreditSize) - 1]++;
-
- return;
}
/**
@@ -382,13 +391,11 @@ htc_send_update_tx_bundle_stats(HTC_TARGET *target,
qdf_size_t data_len,
int TxCreditSize)
{
- return;
}
static inline void
htc_issue_tx_bundle_stats_inc(HTC_TARGET *target)
{
- return;
}
#endif
@@ -464,7 +471,7 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
if (!pPacketTx) {
/* good time to panic */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("allocate_htc_bundle_packet failed \n"));
+ ("allocate_htc_bundle_packet failed\n"));
AR_DEBUG_ASSERT(false);
return;
}
@@ -473,16 +480,15 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
pQueueSave = (HTC_PACKET_QUEUE *) pPacketTx->pContext;
while (1) {
pPacket = htc_packet_dequeue(pPktQueue);
- if (pPacket == NULL) {
+ if (pPacket == NULL)
break;
- }
creditPad = 0;
transferLength = pPacket->ActualLength + HTC_HDR_LENGTH;
creditRemainder = transferLength % pEndpoint->TxCreditSize;
if (creditRemainder != 0) {
if (transferLength < pEndpoint->TxCreditSize) {
- creditPad =
- pEndpoint->TxCreditSize - transferLength;
+ creditPad = pEndpoint->TxCreditSize -
+ transferLength;
} else {
creditPad = creditRemainder;
}
@@ -505,7 +511,7 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
if (!pPacketTx) {
/* good time to panic */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("allocate_htc_bundle_packet failed \n"));
+ ("allocate_htc_bundle_packet failed\n"));
AR_DEBUG_ASSERT(false);
return;
}
@@ -518,9 +524,8 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
if (hif_get_bus_type(target->hif_dev) != QDF_BUS_TYPE_USB) {
- pHtcHdr =
- (HTC_FRAME_HDR *)
- qdf_nbuf_get_frag_vaddr(netbuf, 0);
+ pHtcHdr = (HTC_FRAME_HDR *)qdf_nbuf_get_frag_vaddr(
+ netbuf, 0);
HTC_WRITE32(pHtcHdr,
SM(pPacket->ActualLength,
HTC_FRAME_HDR_PAYLOADLEN) |
@@ -541,9 +546,8 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
int frag_len = qdf_nbuf_get_frag_len(netbuf, i);
unsigned char *frag_addr =
qdf_nbuf_get_frag_vaddr(netbuf, i);
- if (frag_len > nbytes) {
+ if (frag_len > nbytes)
frag_len = nbytes;
- }
qdf_mem_copy(pBundleBuffer, frag_addr, frag_len);
nbytes -= frag_len;
pBundleBuffer += frag_len;
@@ -551,20 +555,17 @@ static void htc_issue_packets_bundle(HTC_TARGET *target,
HTC_PACKET_ENQUEUE(pQueueSave, pPacket);
pBundleBuffer += creditPad;
- if (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB) {
- /* last one can't be packed. */
+ /* last one can't be packed. */
+ if (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB)
last_credit_pad = creditPad;
- }
-
}
- if (pBundleBuffer != qdf_nbuf_data(bundleBuf)) {
- /* send out remaining buffer */
+ /* send out remaining buffer */
+ if (pBundleBuffer != qdf_nbuf_data(bundleBuf))
htc_send_bundled_netbuf(target, pEndpoint,
pBundleBuffer - last_credit_pad,
pPacketTx);
- } else {
+ else
free_htc_bundle_packet(target, pPacketTx);
- }
}
#endif /* ENABLE_BUNDLE_TX */
#else
@@ -599,7 +600,7 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
bus_type = hif_get_bus_type(target->hif_dev);
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+htc_issue_packets: Queue: %p, Pkts %d \n", pPktQueue,
+ ("+htc_issue_packets: Queue: %p, Pkts %d\n", pPktQueue,
HTC_PACKET_QUEUE_DEPTH(pPktQueue)));
while (true) {
if (HTC_TX_BUNDLE_ENABLED(target) &&
@@ -618,8 +619,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
break;
}
}
- /* if not bundling or there was a packet that could not be placed in a bundle,
- * and send it by normal way
+ /* if not bundling or there was a packet that could not be
+ * placed in a bundle, and send it by normal way
*/
pPacket = htc_packet_dequeue(pPktQueue);
if (NULL == pPacket) {
@@ -629,8 +630,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
AR_DEBUG_ASSERT(netbuf);
- /* Non-credit enabled endpoints have been mapped and setup by now,
- * so no need to revisit the HTC headers
+ /* Non-credit enabled endpoints have been mapped and setup by
+ * now, so no need to revisit the HTC headers
*/
if (IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
@@ -642,24 +643,23 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
AR_DEBUG_ASSERT(pHtcHdr);
HTC_WRITE32(pHtcHdr,
- SM(payloadLen,
- HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->
- PktInfo.
- AsTx.
- SendFlags,
- HTC_FRAME_HDR_FLAGS)
- | SM(pPacket->Endpoint,
- HTC_FRAME_HDR_ENDPOINTID));
+ SM(payloadLen,
+ HTC_FRAME_HDR_PAYLOADLEN) |
+ SM(pPacket->PktInfo.AsTx.SendFlags,
+ HTC_FRAME_HDR_FLAGS) |
+ SM(pPacket->Endpoint,
+ HTC_FRAME_HDR_ENDPOINTID));
HTC_WRITE32(((uint32_t *) pHtcHdr) + 1,
SM(pPacket->PktInfo.AsTx.SeqNo,
HTC_FRAME_HDR_CONTROLBYTES1));
/*
- * Now that the HTC frame header has been added, the netbuf can be
- * mapped. This only applies to non-data frames, since data frames
- * were already mapped as they entered into the driver.
- * Check the "FIXUP_NETBUF" flag to see whether this is a data netbuf
- * that is already mapped, or a non-data netbuf that needs to be
+ * Now that the HTC frame header has been added, the
+ * netbuf can be mapped. This only applies to non-data
+ * frames, since data frames were already mapped as they
+ * entered into the driver. Check the "FIXUP_NETBUF"
+ * flag to see whether this is a data netbuf that is
+ * already mapped, or a non-data netbuf that needs to be
* mapped.
*/
if (pPacket->PktInfo.AsTx.
@@ -669,8 +669,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
(pPacket), QDF_DMA_TO_DEVICE);
if (ret != QDF_STATUS_SUCCESS) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("%s: nbuf map failed, endpoint %p\n",
- __func__, pEndpoint));
+ ("%s nbuf Map Fail Endpnt %p\n",
+ __func__, pEndpoint));
status = A_ERROR;
break;
}
@@ -683,7 +683,8 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
pEndpoint->ul_outstanding_cnt++;
UNLOCK_HTC_TX(target);
- hif_send_complete_check(target->hif_dev, pEndpoint->UL_PipeID, false);
+ hif_send_complete_check(target->hif_dev, pEndpoint->UL_PipeID,
+ false);
htc_packet_set_magic_cookie(pPacket, HTC_PACKET_MAGIC_COOKIE);
status = hif_send_head(target->hif_dev,
pEndpoint->UL_PipeID, pEndpoint->Id,
@@ -702,10 +703,13 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
if (qdf_unlikely(A_FAILED(status))) {
if (status != A_NO_RESOURCE) {
- /* TODO : if more than 1 endpoint maps to the same PipeID it is possible
- * to run out of resources in the HIF layer. Don't emit the error */
+ /* TODO : if more than 1 endpoint maps to the
+ * same PipeID it is possible to run out of
+ * resources in the HIF layer. Don't emit the
+ * error
+ */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- ("hif_send Failed status:%d \n",
+ ("hif_send Failed status:%d\n",
status));
}
LOCK_HTC_TX(target);
@@ -736,7 +740,7 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
pPacket, status));
}
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_issue_packets \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_issue_packets\n"));
return status;
}
@@ -818,8 +822,9 @@ static void get_htc_send_packets_credit_based(HTC_TARGET *target,
HTC_PACKET_QUEUE pm_queue;
bool do_pm_get = false;
- /****** NOTE : the TX lock is held when this function is called *****************/
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+get_htc_send_packets_credit_based\n"));
+ /*** NOTE : the TX lock is held when this function is called ***/
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
+ ("+get_htc_send_packets_credit_based\n"));
INIT_HTC_PACKET_QUEUE(&pm_queue);
extract_htc_pm_packets(pEndpoint, &pm_queue);
@@ -862,9 +867,8 @@ static void get_htc_send_packets_credit_based(HTC_TARGET *target,
transferLength / pEndpoint->TxCreditSize;
remainder = transferLength % pEndpoint->TxCreditSize;
- if (remainder) {
+ if (remainder)
creditsRequired++;
- }
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
@@ -882,7 +886,7 @@ static void get_htc_send_packets_credit_based(HTC_TARGET *target,
if (pEndpoint->TxCredits < creditsRequired) {
#if DEBUG_CREDIT
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" EP%d, No Credit now. %d < %d\n",
+ ("EP%d,No Credit now.%d < %d\n",
pEndpoint->Id,
pEndpoint->TxCredits,
creditsRequired));
@@ -952,7 +956,7 @@ static void get_htc_send_packets(HTC_TARGET *target,
HTC_PACKET_QUEUE pm_queue;
bool do_pm_get;
- /****** NOTE : the TX lock is held when this function is called *****************/
+ /*** NOTE : the TX lock is held when this function is called ***/
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
("+get_htc_send_packets %d resources\n", Resources));
@@ -988,10 +992,6 @@ static void get_htc_send_packets(HTC_TARGET *target,
/* For non-credit path the sequence number is already embedded
* in the constructed HTC header
*/
-#if 0
- pPacket->PktInfo.AsTx.SeqNo = pEndpoint->SeqNo;
- pEndpoint->SeqNo++;
-#endif
pPacket->PktInfo.AsTx.SendFlags = 0;
pPacket->PktInfo.AsTx.CreditsUsed = 0;
/* queue this packet into the caller's queue */
@@ -1003,13 +1003,13 @@ static void get_htc_send_packets(HTC_TARGET *target,
* qdf_nbuf_map, because the MacOS version of qdf_nbuf_t doesn't
* support qdf_nbuf_get_num_frags until after qdf_nbuf_map has
* been done.
- * Assume that the non-data netbufs, i.e. the WMI message netbufs,
+ * Assume that the non-data netbufs, i.e. WMI message netbufs,
* consist of a single fragment.
*/
+ /* WMI messages are in a single-fragment network buf */
num_frags =
(pPacket->PktInfo.AsTx.
- Flags & HTC_TX_PACKET_FLAG_FIXUP_NETBUF) ? 1
- /* WMI messages are in a single-fragment network buffer */ :
+ Flags & HTC_TX_PACKET_FLAG_FIXUP_NETBUF) ? 1 :
qdf_nbuf_get_num_frags(GET_HTC_PACKET_NET_BUF_CONTEXT
(pPacket));
Resources -= num_frags;
@@ -1028,18 +1028,19 @@ static void get_htc_send_packets(HTC_TARGET *target,
* @pEndpoint: logical endpoint on which packets needs to be sent
* @pCallersSendQueue: packet queue containing the list of packets to be sent
*
- * Return: HTC_SEND_QUEUE_RESULT indicates whether the packet was queued to be
- * sent or the packet should be dropped by the upper layer
+ * Return: enum HTC_SEND_QUEUE_RESULT indicates whether the packet was queued to
+ * be sent or the packet should be dropped by the upper layer
*/
-static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
+static enum HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pCallersSendQueue)
{
- HTC_PACKET_QUEUE sendQueue; /* temp queue to hold packets at various stages */
+ /* temp queue to hold packets at various stages */
+ HTC_PACKET_QUEUE sendQueue;
HTC_PACKET *pPacket;
int tx_resources;
int overflow;
- HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK;
+ enum HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+htc_try_send (Queue:%p Depth:%d)\n",
pCallersSendQueue,
@@ -1053,10 +1054,11 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
do {
- if (NULL == pCallersSendQueue) {
- /* caller didn't provide a queue, just wants us to check queues and send */
+ /* caller didn't provide a queue, just wants us to check
+ * queues and send
+ */
+ if (pCallersSendQueue == NULL)
break;
- }
if (HTC_QUEUE_EMPTY(pCallersSendQueue)) {
/* empty queue */
@@ -1074,14 +1076,14 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
/* figure out how much we will overflow by */
overflow = HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue);
overflow += HTC_PACKET_QUEUE_DEPTH(pCallersSendQueue);
- /* figure out how much we will overflow the TX queue by */
+ /* get how much we will overflow the TX queue by */
overflow -= pEndpoint->MaxTxQueueDepth;
}
/* if overflow is negative or zero, we are okay */
if (overflow > 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" Endpoint %d, TX queue will overflow :%d , Tx Depth:%d, Max:%d \n",
+ ("Endpoint %d, TX queue will overflow :%d , Tx Depth:%d, Max:%d\n",
pEndpoint->Id, overflow,
HTC_PACKET_QUEUE_DEPTH(&pEndpoint->
TxQueue),
@@ -1089,8 +1091,10 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
}
if ((overflow <= 0)
|| (pEndpoint->EpCallBacks.EpSendFull == NULL)) {
- /* all packets will fit or caller did not provide send full indication handler
- * -- just move all of them to the local sendQueue object */
+ /* all packets will fit or caller did not provide send
+ * full indication handler
+ * just move all of them to local sendQueue object
+ */
HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&sendQueue,
pCallersSendQueue);
} else {
@@ -1100,8 +1104,9 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
overflow;
A_ASSERT(goodPkts >= 0);
- /* we have overflowed, and a callback is provided */
- /* dequeue all non-overflow packets into the sendqueue */
+ /* we have overflowed and callback is provided. Dequeue
+ * all non-overflow packets into the sendqueue
+ */
for (i = 0; i < goodPkts; i++) {
/* pop off caller's queue */
pPacket = htc_packet_dequeue(pCallersSendQueue);
@@ -1110,18 +1115,21 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
HTC_PACKET_ENQUEUE(&sendQueue, pPacket);
}
- /* the caller's queue has all the packets that won't fit */
- /* walk through the caller's queue and indicate each one to the send full handler */
+ /* the caller's queue has all the packets that won't fit
+ * walk through the caller's queue and indicate each one
+ * to the send full handler
+ */
ITERATE_OVER_LIST_ALLOW_REMOVE(&pCallersSendQueue->
QueueHead, pPacket,
HTC_PACKET, ListLink) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" Indicating overflowed TX packet: %p \n",
+ ("Indicating overflowed TX packet: %p\n",
pPacket));
/*
- * Remove headroom reserved for HTC_FRAME_HDR before giving
- * the packet back to the user via the EpSendFull callback.
+ * Remove headroom reserved for HTC_FRAME_HDR
+ * before giving the packet back to the user via
+ * the EpSendFull callback.
*/
restore_tx_packet(target, pPacket);
@@ -1131,16 +1139,23 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
/* callback wants the packet dropped */
INC_HTC_EP_STAT(pEndpoint, TxDropped,
1);
- /* leave this one in the caller's queue for cleanup */
+ /* leave this one in the caller's queue
+ * for cleanup
+ */
} else {
- /* callback wants to keep this packet, remove from caller's queue */
+ /* callback wants to keep this packet,
+ * remove from caller's queue
+ */
HTC_PACKET_REMOVE(pCallersSendQueue,
pPacket);
- /* put it in the send queue */
- /* add HTC_FRAME_HDR space reservation again */
+ /* put it in the send queue
+ * add HTC_FRAME_HDR space reservation
+ * again
+ */
qdf_nbuf_push_head
(GET_HTC_PACKET_NET_BUF_CONTEXT
- (pPacket), sizeof(HTC_FRAME_HDR));
+ (pPacket),
+ sizeof(HTC_FRAME_HDR));
HTC_PACKET_ENQUEUE(&sendQueue, pPacket);
}
@@ -1151,7 +1166,7 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
if (HTC_QUEUE_EMPTY(&sendQueue)) {
/* no packets made it in, caller will cleanup */
OL_ATH_HTC_PKT_ERROR_COUNT_INCR(target,
- HTC_SEND_Q_EMPTY);
+ HTC_SEND_Q_EMPTY);
result = HTC_SEND_QUEUE_DROP;
break;
}
@@ -1196,37 +1211,42 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
/* increment tx processing count on entry */
if (qdf_atomic_inc_return(&pEndpoint->TxProcessCount) > 1) {
- /* another thread or task is draining the TX queues on this endpoint
- * that thread will reset the tx processing count when the queue is drained */
+ /* another thread or task is draining the TX queues on this
+ * endpoint that thread will reset the tx processing count when
+ * the queue is drained
+ */
qdf_atomic_dec(&pEndpoint->TxProcessCount);
UNLOCK_HTC_TX(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send (busy) \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send (busy)\n"));
return HTC_SEND_QUEUE_OK;
}
/***** beyond this point only 1 thread may enter ******/
- /* now drain the endpoint TX queue for transmission as long as we have enough
- * transmit resources */
+ /* now drain the endpoint TX queue for transmission as long as we have
+ * enough transmit resources
+ */
while (true) {
- if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0) {
+ if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0)
break;
- }
if (IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
#if DEBUG_CREDIT
int cred = pEndpoint->TxCredits;
#endif
- /* credit based mechanism provides flow control based on target transmit resource availability, we
- * assume that the HIF layer will always have bus resources greater than target transmit resources */
+ /* credit based mechanism provides flow control based on
+ * target transmit resource availability, we assume that
+ * the HIF layer will always have bus resources greater
+ * than target transmit resources
+ */
get_htc_send_packets_credit_based(target, pEndpoint,
&sendQueue);
#if DEBUG_CREDIT
if (ep_debug_mask & (1 << pEndpoint->Id)) {
if (cred - pEndpoint->TxCredits > 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
- (" <HTC> Decrease EP%d %d - %d = %d credits.\n",
+ (" <HTC> Decrease EP%d %d - %d = %d credits.\n",
pEndpoint->Id, cred,
cred -
pEndpoint->TxCredits,
@@ -1252,13 +1272,17 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
tx_resources =
(HTC_MAX_MSG_PER_BUNDLE_TX * 2);
}
- /* get all the packets for this endpoint that we can for this pass */
+ /* get all the packets for this endpoint that we can for
+ * this pass
+ */
get_htc_send_packets(target, pEndpoint, &sendQueue,
tx_resources);
}
if (HTC_PACKET_QUEUE_DEPTH(&sendQueue) == 0) {
- /* didn't get any packets due to a lack of resources or TX queue was drained */
+ /* didn't get any packets due to a lack of resources or
+ * TX queue was drained
+ */
break;
}
@@ -1268,6 +1292,7 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
result = htc_issue_packets(target, pEndpoint, &sendQueue);
if (result) {
int i;
+
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("htc_issue_packets, failed status:%d put it back to head of callersSendQueue",
result));
@@ -1295,13 +1320,14 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
UNLOCK_HTC_TX(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send: \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_try_send:\n"));
return HTC_SEND_QUEUE_OK;
}
#ifdef USB_HIF_SINGLE_PIPE_DATA_SCHED
-static uint16_t htc_send_pkts_sched_check(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID id)
+static uint16_t htc_send_pkts_sched_check(HTC_HANDLE HTCHandle,
+ HTC_ENDPOINT_ID id)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
@@ -1310,17 +1336,15 @@ static uint16_t htc_send_pkts_sched_check(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID
uint16_t resources;
uint16_t acQueueStatus[DATA_EP_SIZE] = { 0, 0, 0, 0 };
- if (id < ENDPOINT_2 || id > ENDPOINT_5) {
+ if (id < ENDPOINT_2 || id > ENDPOINT_5)
return 1;
- }
for (eid = ENDPOINT_2; eid <= ENDPOINT_5; eid++) {
pEndpoint = &target->endpoint[eid];
pTxQueue = &pEndpoint->TxQueue;
- if (HTC_QUEUE_EMPTY(pTxQueue)) {
+ if (HTC_QUEUE_EMPTY(pTxQueue))
acQueueStatus[eid - 2] = 1;
- }
}
switch (id) {
@@ -1364,9 +1388,8 @@ static A_STATUS htc_send_pkts_sched_queue(HTC_TARGET *target,
HTC_PACKET_ENQUEUE(pTxQueue, pPacket);
goodPkts--;
- if (goodPkts <= 0) {
+ if (goodPkts <= 0)
break;
- }
}
}
@@ -1393,7 +1416,8 @@ static A_STATUS htc_send_pkts_sched_queue(HTC_TARGET *target,
#endif
-A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue)
+A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle,
+ HTC_PACKET_QUEUE *pPktQueue)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
@@ -1403,14 +1427,16 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
QDF_STATUS status;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+htc_send_pkts_multiple: Queue: %p, Pkts %d \n",
+ ("+htc_send_pkts_multiple: Queue: %p, Pkts %d\n",
pPktQueue, HTC_PACKET_QUEUE_DEPTH(pPktQueue)));
- /* get packet at head to figure out which endpoint these packets will go into */
+ /* get packet at head to figure out which endpoint these packets will
+ * go into
+ */
pPacket = htc_get_pkt_at_head(pPktQueue);
if (NULL == pPacket) {
OL_ATH_HTC_PKT_ERROR_COUNT_INCR(target, GET_HTC_PKT_Q_FAIL);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple\n"));
return A_EINVAL;
}
@@ -1439,10 +1465,10 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
pHtcHdr = (HTC_FRAME_HDR *) qdf_nbuf_get_frag_vaddr(netbuf, 0);
AR_DEBUG_ASSERT(pHtcHdr);
HTC_WRITE32(pHtcHdr,
- SM(pPacket->ActualLength,
- HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->Endpoint,
- HTC_FRAME_HDR_ENDPOINTID));
-
+ SM(pPacket->ActualLength,
+ HTC_FRAME_HDR_PAYLOADLEN) |
+ SM(pPacket->Endpoint,
+ HTC_FRAME_HDR_ENDPOINTID));
LOCK_HTC_TX(target);
pPacket->PktInfo.AsTx.SeqNo = pEndpoint->SeqNo;
@@ -1454,9 +1480,9 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
UNLOCK_HTC_TX(target);
/*
- * Now that the HTC frame header has been added, the netbuf can be
- * mapped. This only applies to non-data frames, since data frames
- * were already mapped as they entered into the driver.
+ * Now that the HTC frame header has been added, the netbuf can
+ * be mapped. This only applies to non-data frames, since data
+ * frames were already mapped as they entered into the driver.
*/
status = qdf_nbuf_map(target->osdev,
GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket),
@@ -1473,11 +1499,10 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
HTC_PACKET_QUEUE_ITERATE_END;
#ifdef USB_HIF_SINGLE_PIPE_DATA_SCHED
- if (!htc_send_pkts_sched_check(HTCHandle, pEndpoint->Id)) {
+ if (!htc_send_pkts_sched_check(HTCHandle, pEndpoint->Id))
htc_send_pkts_sched_queue(HTCHandle, pPktQueue, pEndpoint->Id);
- } else {
+ else
htc_try_send(target, pEndpoint, pPktQueue);
- }
#else
htc_try_send(target, pEndpoint, pPktQueue);
#endif
@@ -1489,18 +1514,17 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
/* remove the headroom reserved for HTC_FRAME_HDR */
restore_tx_packet(target, pPacket);
- if (HTC_STOPPING(target)) {
+ if (HTC_STOPPING(target))
pPacket->Status = A_ECANCELED;
- } else {
+ else
pPacket->Status = A_NO_RESOURCE;
- }
}
HTC_PACKET_QUEUE_ITERATE_END;
do_send_completion(pEndpoint, pPktQueue);
}
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_send_pkts_multiple\n"));
return A_OK;
}
@@ -1510,12 +1534,11 @@ A_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket)
{
HTC_PACKET_QUEUE queue;
- if (HTCHandle == NULL || pPacket == NULL) {
+ if (HTCHandle == NULL || pPacket == NULL)
return A_ERROR;
- }
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+-htc_send_pkt: Enter endPointId: %d, buffer: %p, length: %d \n",
+ ("+-htc_send_pkt: Enter endPointId: %d, buffer: %p, length: %d\n",
pPacket->Endpoint, pPacket->pBuffer,
pPacket->ActualLength));
INIT_HTC_PACKET_QUEUE_AND_ADD(&queue, pPacket);
@@ -1543,8 +1566,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf, int Epid,
pEndpoint = &target->endpoint[Epid];
- tx_resources =
- hif_get_free_queue_number(target->hif_dev, pEndpoint->UL_PipeID);
+ tx_resources = hif_get_free_queue_number(target->hif_dev,
+ pEndpoint->UL_PipeID);
if (tx_resources < HTC_DATA_RESOURCE_THRS) {
if (pEndpoint->ul_is_polled) {
@@ -1554,9 +1577,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf, int Epid,
hif_get_free_queue_number(target->hif_dev,
pEndpoint->UL_PipeID);
}
- if (tx_resources < HTC_DATA_MINDESC_PERPACKET) {
+ if (tx_resources < HTC_DATA_MINDESC_PERPACKET)
return A_ERROR;
- }
}
if (hif_pm_runtime_get(target->hif_dev))
@@ -1634,24 +1656,26 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
AR_DEBUG_ASSERT(pHtcHdr);
HTC_WRITE32(pHtcHdr,
- SM(pPacket->ActualLength,
- HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->PktInfo.
- AsTx.SendFlags,
- HTC_FRAME_HDR_FLAGS)
- | SM(pPacket->Endpoint, HTC_FRAME_HDR_ENDPOINTID));
+ SM(pPacket->ActualLength,
+ HTC_FRAME_HDR_PAYLOADLEN) |
+ SM(pPacket->PktInfo.AsTx.SendFlags,
+ HTC_FRAME_HDR_FLAGS) |
+ SM(pPacket->Endpoint,
+ HTC_FRAME_HDR_ENDPOINTID));
/*
* If the HIF pipe for the data endpoint is polled rather than
* interrupt-driven, this is a good point to check whether any
* data previously sent through the HIF pipe have finished being
- * sent.
- * Since this may result in callbacks to htc_tx_completion_handler,
- * which can take the HTC tx lock, make the hif_send_complete_check
- * call before acquiring the HTC tx lock.
+ * sent. Since this may result in callbacks to
+ * htc_tx_completion_handler, which can take the HTC tx lock,
+ * make the hif_send_complete_check call before acquiring the
+ * HTC tx lock.
* Call hif_send_complete_check directly, rather than calling
- * htc_send_complete_check, and call the PollTimerStart separately
- * after calling hif_send_head, so the timer will be started to
- * check for completion of the new outstanding download (in the
- * unexpected event that other polling calls don't catch it).
+ * htc_send_complete_check, and call the PollTimerStart
+ * separately after calling hif_send_head, so the timer will be
+ * started to check for completion of the new outstanding
+ * download (in the unexpected event that other polling calls
+ * don't catch it).
*/
if (pEndpoint->ul_is_polled) {
htc_send_complete_poll_timer_stop(pEndpoint);
@@ -1683,9 +1707,9 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
qdf_atomic_inc(&pEndpoint->TxProcessCount);
if (qdf_atomic_read(&pEndpoint->TxProcessCount) > 1) {
/*
- * Another thread or task is draining the TX queues on this endpoint.
- * That thread will reset the tx processing count when the queue is
- * drained.
+ * Another thread or task is draining the TX queues on this
+ * endpoint. That thread will reset the tx processing count when
+ * the queue is drained.
*/
qdf_atomic_dec(&pEndpoint->TxProcessCount);
UNLOCK_HTC_TX(target);
@@ -1699,7 +1723,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
#if DEBUG_CREDIT
int cred = pEndpoint->TxCredits;
#endif
- get_htc_send_packets_credit_based(target, pEndpoint, &sendQueue);
+ get_htc_send_packets_credit_based(target, pEndpoint,
+ &sendQueue);
#if DEBUG_CREDIT
if (ep_debug_mask & (1 << pEndpoint->Id)) {
if (cred - pEndpoint->TxCredits > 0) {
@@ -1720,10 +1745,10 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
hif_get_free_queue_number(target->hif_dev,
pEndpoint->UL_PipeID)) {
/*
- * Header and payload belongs to the different fragments
- * and consume 2 resource for one HTC package but USB
- * combine into one transfer.
- */
+ * Header and payload belongs to the different fragments
+ * and consume 2 resource for one HTC package but USB
+ * combine into one transfer.
+ */
get_htc_send_packets(target, pEndpoint, &sendQueue,
(HTC_MAX_MSG_PER_BUNDLE_TX * 2));
} else {
@@ -1733,16 +1758,16 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
}
UNLOCK_HTC_TX(target);
- }
- else {
+ } else {
/*
- * Now drain the endpoint TX queue for transmission as long as we have
- * enough transmit resources
+ * Now drain the endpoint TX queue for transmission as long as
+ * we have enough transmit resources
*/
tx_resources =
hif_get_free_queue_number(target->hif_dev,
pEndpoint->UL_PipeID);
- get_htc_send_packets(target, pEndpoint, &sendQueue, tx_resources);
+ get_htc_send_packets(target, pEndpoint, &sendQueue,
+ tx_resources);
UNLOCK_HTC_TX(target);
}
QDF_NBUF_UPDATE_TX_PKT_COUNT(netbuf, QDF_NBUF_TX_PKT_HTC);
@@ -1760,9 +1785,8 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
htc_issue_packets_bundle(target, pEndpoint, &sendQueue);
}
pPacket = htc_packet_dequeue(&sendQueue);
- if (pPacket == NULL) {
+ if (pPacket == NULL)
break;
- }
netbuf = GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket);
LOCK_HTC_TX(target);
@@ -1800,12 +1824,16 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
* In HL systems, the txrx SW explicitly performs the
* tx flow control.
*/
- /* pEndpoint->TxCredits += pPacket->PktInfo.AsTx.CreditsUsed; */
+ /* pEndpoint->TxCredits +=
+ * pPacket->PktInfo.AsTx.CreditsUsed;
+ */
/* put this frame back at the front of the sendQueue */
HTC_PACKET_ENQUEUE_TO_HEAD(&sendQueue, pPacket);
- /* put the sendQueue back at the front of pEndpoint->TxQueue */
+ /* put the sendQueue back at the front of
+ * pEndpoint->TxQueue
+ */
HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(&pEndpoint->TxQueue,
&sendQueue);
UNLOCK_HTC_TX(target);
@@ -1860,13 +1888,12 @@ static HTC_PACKET *htc_lookup_tx_packet(HTC_TARGET *target,
if (netbuf == (qdf_nbuf_t) GET_HTC_PACKET_NET_BUF_CONTEXT(pPacket)) {
UNLOCK_HTC_TX(target);
return pPacket;
- } else {
- HTC_PACKET_ENQUEUE(&lookupQueue, pPacket);
}
+ HTC_PACKET_ENQUEUE(&lookupQueue, pPacket);
/*
- * Move TX lookup queue to temp queue because most of packets that are not index 0
- * are not top 10 packets.
+ * Move TX lookup queue to temp queue because most of packets that are
+ * not index 0 are not top 10 packets.
*/
HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&lookupQueue,
&pEndpoint->TxLookupQueue);
@@ -1951,7 +1978,8 @@ QDF_STATUS htc_tx_completion_handler(void *Context,
HTC_PACKET_QUEUE_ITERATE_END;
free_htc_bundle_packet(target, pPacket);
- if (hif_get_bus_type(target->hif_dev) == QDF_BUS_TYPE_USB) {
+ if (hif_get_bus_type(target->hif_dev) ==
+ QDF_BUS_TYPE_USB) {
if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint))
htc_try_send(target, pEndpoint, NULL);
}
@@ -1966,9 +1994,10 @@ QDF_STATUS htc_tx_completion_handler(void *Context,
} while (false);
if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
- /* note: when using TX credit flow, the re-checking of queues happens
- * when credits flow back from the target.
- * in the non-TX credit case, we recheck after the packet completes */
+ /* note: when using TX credit flow, the re-checking of queues
+ * happens when credits flow back from the target. In the non-TX
+ * credit case, we recheck after the packet completes
+ */
htc_try_send(target, pEndpoint, NULL);
}
@@ -2004,9 +2033,8 @@ void htc_tx_resource_avail_handler(void *context, uint8_t pipeID)
for (i = 0; i < ENDPOINT_MAX; i++) {
pEndpoint = &target->endpoint[i];
if (pEndpoint->service_id != 0) {
- if (pEndpoint->UL_PipeID == pipeID) {
+ if (pEndpoint->UL_PipeID == pipeID)
break;
- }
}
}
@@ -2018,7 +2046,7 @@ void htc_tx_resource_avail_handler(void *context, uint8_t pipeID)
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("HIF indicated more resources for pipe:%d \n",
+ ("HIF indicated more resources for pipe:%d\n",
pipeID));
htc_try_send(target, pEndpoint, NULL);
@@ -2105,6 +2133,7 @@ bool htc_is_endpoint_active(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint)
void htc_set_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+
target->is_nodrop_pkt = isNodropPkt;
}
@@ -2126,7 +2155,7 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
uint8_t rpt_credits, rpt_ep_id;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- ("+htc_process_credit_rpt, Credit Report Entries:%d \n",
+ ("+htc_process_credit_rpt, Credit Report Entries:%d\n",
NumEntries));
/* lock out TX while we update credits */
@@ -2160,13 +2189,14 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
INC_HTC_EP_STAT(pEndpoint, TxCreditsReturned, rpt_credits);
if (FromEndpoint == rpt_ep_id) {
- /* this credit report arrived on the same endpoint indicating it arrived in an RX
- * packet */
+ /* this credit report arrived on the same endpoint
+ * indicating it arrived in an RX packet
+ */
INC_HTC_EP_STAT(pEndpoint, TxCreditsFromRx,
rpt_credits);
INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromRx, 1);
} else if (FromEndpoint == ENDPOINT_0) {
- /* this credit arrived on endpoint 0 as a NULL message */
+ /* this credit arrived on endpoint 0 as a NULL msg */
INC_HTC_EP_STAT(pEndpoint, TxCreditsFromEp0,
rpt_credits);
INC_HTC_EP_STAT(pEndpoint, TxCreditRptsFromEp0, 1);
@@ -2196,11 +2226,10 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
#ifdef ATH_11AC_TXCOMPACT
htc_try_send(target, pEndpoint, NULL);
#else
- if (pEndpoint->service_id == HTT_DATA_MSG_SVC) {
+ if (pEndpoint->service_id == HTT_DATA_MSG_SVC)
htc_send_data_pkt(target, NULL, 0);
- } else {
+ else
htc_try_send(target, pEndpoint, NULL);
- }
#endif
LOCK_HTC_TX(target);
}
@@ -2208,12 +2237,12 @@ void htc_process_credit_rpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt,
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
- (" Report indicated %d credits to distribute \n",
+ (" Report indicated %d credits to distribute\n",
totalCredits));
UNLOCK_HTC_TX(target);
- AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_process_credit_rpt \n"));
+ AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_process_credit_rpt\n"));
}
/* function to fetch stats from htc layer*/
diff --git a/htc/htc_services.c b/htc/htc_services.c
index 3bf0efa7adfb..c8910d86d2dc 100644
--- a/htc/htc_services.c
+++ b/htc/htc_services.c
@@ -83,7 +83,6 @@ htc_alt_data_credit_size_update(HTC_TARGET *target,
(*ul_pipe == 1) && (*dl_pipe == 0))
*txCreditSize = target->AltDataCreditSize;
- return;
}
#else
@@ -93,13 +92,12 @@ htc_alt_data_credit_size_update(HTC_TARGET *target,
uint8_t *dl_pipe,
int *txCreditSize)
{
- return;
}
#endif
A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
- HTC_SERVICE_CONNECT_REQ *pConnectReq,
- HTC_SERVICE_CONNECT_RESP *pConnectResp)
+ struct htc_service_connect_req *pConnectReq,
+ struct htc_service_connect_resp *pConnectResp)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
A_STATUS status = A_OK;
@@ -189,15 +187,14 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
disableCreditFlowCtrl = true;
}
- if (!htc_credit_flow) {
+ if (!htc_credit_flow)
disableCreditFlowCtrl = true;
- }
/* check caller if it wants to transfer meta data */
if ((pConnectReq->pMetaData != NULL) &&
(pConnectReq->MetaDataLength <=
HTC_SERVICE_META_DATA_MAX_LENGTH)) {
- /* copy meta data into message buffer (after header ) */
+ /* copy meta data into msg buffer (after hdr) */
qdf_mem_copy((uint8_t *) pConnectMsg +
sizeof(HTC_CONNECT_SERVICE_MSG),
pConnectReq->pMetaData,
@@ -219,23 +216,23 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
status = htc_send_pkt((HTC_HANDLE) target, pSendPacket);
/* we don't own it anymore */
pSendPacket = NULL;
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
/* wait for response */
status = htc_wait_recv_ctrl_message(target);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
- /* we controlled the buffer creation so it has to be properly aligned */
+ /* we controlled the buffer creation so it has to be
+ * properly aligned
+ */
pResponseMsg =
(HTC_CONNECT_SERVICE_RESPONSE_MSG *) target->
CtrlResponseBuffer;
rsp_msg_id = HTC_GET_FIELD(pResponseMsg,
- HTC_CONNECT_SERVICE_RESPONSE_MSG,
- MESSAGEID);
+ HTC_CONNECT_SERVICE_RESPONSE_MSG,
+ MESSAGEID);
rsp_msg_serv_id =
HTC_GET_FIELD(pResponseMsg,
HTC_CONNECT_SERVICE_RESPONSE_MSG,
@@ -280,12 +277,13 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
rsp_msg_serv_id,
rsp_msg_status));
status = A_EPROTO;
-/* TODO: restore the ifdef when FW supports services 301 and 302 (HTT_MSG_DATA[23]_MSG_SVC)
-#ifdef QCA_TX_HTT2_SUPPORT
-*/
- /* Keep work and not to block the control message. */
+/* TODO: restore the ifdef when FW supports services 301 and 302
+ * (HTT_MSG_DATA[23]_MSG_SVC)
+ */
+/* #ifdef QCA_TX_HTT2_SUPPORT */
+ /* Keep work and not to block the control msg */
target->CtrlResponseProcessing = false;
-/*#endif */ /* QCA_TX_HTT2_SUPPORT */
+/* #endif */ /* QCA_TX_HTT2_SUPPORT */
break;
}
@@ -296,7 +294,9 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
(rsp_msg_serv_meta_len > 0) &&
(rsp_msg_serv_meta_len <=
HTC_SERVICE_META_DATA_MAX_LENGTH)) {
- /* caller supplied a buffer and the target responded with data */
+ /* caller supplied a buffer and the target
+ * responded with data
+ */
int copyLength =
min((int)pConnectResp->BufferLength,
(int)rsp_msg_serv_meta_len);
@@ -312,7 +312,7 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
target->CtrlResponseProcessing = false;
}
- /* the rest of these are parameter checks so set the error status */
+ /* rest of these are parameter checks so set the error status */
status = A_EPROTO;
if (assignedEndpoint >= ENDPOINT_MAX) {
@@ -346,9 +346,8 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
pEndpoint->TxCreditSize = target->TargetCreditSize;
pEndpoint->TxCreditsPerMaxMsg =
maxMsgSize / target->TargetCreditSize;
- if (maxMsgSize % target->TargetCreditSize) {
+ if (maxMsgSize % target->TargetCreditSize)
pEndpoint->TxCreditsPerMaxMsg++;
- }
#if DEBUG_CREDIT
qdf_print(" Endpoint%d initial credit:%d, size:%d.\n",
pEndpoint->Id, pEndpoint->TxCredits,
@@ -364,16 +363,16 @@ A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
&pEndpoint->DL_PipeID,
&pEndpoint->ul_is_polled,
&pEndpoint->dl_is_polled);
- if (A_FAILED(status)) {
+ if (A_FAILED(status))
break;
- }
htc_alt_data_credit_size_update(target,
&pEndpoint->UL_PipeID,
&pEndpoint->DL_PipeID,
&pEndpoint->TxCreditSize);
- qdf_assert(!pEndpoint->dl_is_polled); /* not currently supported */
+ /* not currently supported */
+ qdf_assert(!pEndpoint->dl_is_polled);
if (pEndpoint->ul_is_polled) {
qdf_timer_init(target->osdev,
@@ -410,17 +409,18 @@ void htc_set_credit_distribution(HTC_HANDLE HTCHandle,
HTC_SERVICE_ID ServicePriorityOrder[],
int ListLength)
{
- /* NOT Supported, this transport does not use a credit based flow control mechanism */
+ /* NOT Supported, this transport does not use a credit based flow
+ * control mechanism
+ */
}
void htc_fw_event_handler(void *context, QDF_STATUS status)
{
HTC_TARGET *target = (HTC_TARGET *) context;
- HTC_INIT_INFO *initInfo = &target->HTCInitInfo;
+ struct htc_init_info *initInfo = &target->HTCInitInfo;
/* check if target failure handler exists and pass error code to it. */
- if (target->HTCInitInfo.TargetFailure != NULL) {
+ if (target->HTCInitInfo.TargetFailure != NULL)
initInfo->TargetFailure(initInfo->pContext, status);
- }
}
diff --git a/wmi/src/wmi_unified.c b/wmi/src/wmi_unified.c
index 3411025c1502..a7cb1cc1468f 100644
--- a/wmi/src/wmi_unified.c
+++ b/wmi/src/wmi_unified.c
@@ -1963,8 +1963,8 @@ wmi_unified_connect_htc_service(struct wmi_unified *wmi_handle,
{
int status;
- HTC_SERVICE_CONNECT_RESP response;
- HTC_SERVICE_CONNECT_REQ connect;
+ struct htc_service_connect_resp response;
+ struct htc_service_connect_req connect;
OS_MEMZERO(&connect, sizeof(connect));
OS_MEMZERO(&response, sizeof(response));