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
This commit is contained in:
Manikandan Mohan
2017-04-13 20:19:26 -07:00
committed by snandini
parent e03493ddfb
commit e3e209e1fd
9 changed files with 1095 additions and 1013 deletions

View File

@@ -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 */
@@ -57,7 +58,8 @@ typedef struct _DL_LIST {
(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,10 +80,9 @@ 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;
}
@@ -91,27 +93,26 @@ static __inline bool dl_list_is_entry_in_list(const DL_LIST *pList,
#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;
@@ -133,16 +134,13 @@ static __inline PDL_LIST dl_list_insert_head(PDL_LIST pList, PDL_LIST pAdd)
/*
* 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;

104
htc/htc.c
View File

@@ -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) {
@@ -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;
@@ -270,7 +267,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;
@@ -280,19 +277,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
@@ -302,7 +297,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;
@@ -325,6 +321,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));
@@ -333,17 +330,20 @@ 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,
pPacket->ActualLength));
@@ -363,7 +363,7 @@ 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,
struct htc_service_tx_credit_allocation *pEntry,
int credits)
{
switch (hif_get_bus_type(scn)) {
@@ -384,7 +384,6 @@ htc_setup_epping_credit_allocation(struct hif_opaque_softc *scn,
default:
break;
}
return;
}
/**
@@ -396,15 +395,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)
pEntry->CreditAllocation = credits;
/* 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,
@@ -471,6 +469,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,
@@ -513,8 +512,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;
@@ -528,15 +527,15 @@ 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,
@@ -565,8 +564,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;
@@ -619,7 +619,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_ANY, ("-HWT\n"));
return status;
}
@@ -703,7 +704,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;
@@ -718,10 +720,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"));
@@ -763,7 +763,9 @@ void htc_flush_surprise_remove(HTC_HANDLE HTCHandle)
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);
@@ -836,14 +838,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);
@@ -875,13 +877,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);

File diff suppressed because it is too large Load Diff

View File

@@ -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
/* Need to call HIF to fetch rx? (Not currently supported.) */
int dl_is_polled;
/* not currently supported */
/* qdf_timer_t dl_poll_timer; */
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 */
/* 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;
bool async_update; /* packets can be queued asynchronously */
@@ -163,16 +176,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
};
@@ -186,7 +200,7 @@ typedef struct _HTC_TARGET {
qdf_spinlock_t HTCCreditLock;
uint32_t HTCStateFlags;
void *host_handle;
HTC_INIT_INFO HTCInitInfo;
struct htc_init_info HTCInitInfo;
HTC_PACKET *pHTCPacketStructPool; /* pool of HTC packets */
HTC_PACKET_QUEUE ControlBufferTXFreeList;
uint8_t CtrlResponseBuffer[HTC_MAX_CONTROL_MESSAGE_LENGTH];
@@ -194,7 +208,7 @@ typedef struct _HTC_TARGET {
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
@@ -252,21 +266,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))
@@ -278,21 +294,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);
@@ -318,7 +332,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 *
@@ -336,9 +350,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;
}

View File

@@ -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;
/**
* 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;
};
#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) /* more packets on this endpoint are being fetched */
/* 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)
}
#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);
@@ -247,7 +278,8 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
/* 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); \
dl_list_transfer_items_to_tail(&(pQDest)->QueueHead, \
&(pQSrc)->QueueHead); \
(pQDest)->Depth += (pQSrc)->Depth; \
(pQSrc)->Depth = 0; \
}
@@ -260,7 +292,8 @@ static inline HTC_PACKET *htc_packet_dequeue_tail(HTC_PACKET_QUEUE *queue)
*/
#define HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(pQDest, pQSrc) \
{ \
dl_list_transfer_items_to_head(&(pQDest)->QueueHead, &(pQSrc)->QueueHead); \
dl_list_transfer_items_to_head(&(pQDest)->QueueHead, \
&(pQSrc)->QueueHead); \
(pQDest)->Depth += (pQSrc)->Depth; \
(pQSrc)->Depth = 0; \
}
@@ -273,7 +306,8 @@ 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_RESET(pQ) ITERATE_RESET(&(pQ)->QueueHead)

View File

@@ -98,10 +98,11 @@ static void do_recv_completion(HTC_ENDPOINT *pEndpoint,
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,
/* 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 {
@@ -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);
}
@@ -278,7 +281,7 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf,
uint16_t payloadLen;
uint32_t trailerlen = 0;
uint8_t htc_ep_id;
HTC_INIT_INFO *info;
struct htc_init_info *info;
#ifdef RX_SG_SUPPORT
LOCK_HTC_RX(target);
@@ -314,7 +317,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;
@@ -325,12 +329,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);
@@ -384,7 +387,9 @@ 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 +
@@ -399,7 +404,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;
}
@@ -414,15 +419,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;
@@ -496,10 +503,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;
@@ -525,9 +533,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;
@@ -592,6 +599,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);
}
@@ -605,9 +613,8 @@ 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;
@@ -650,32 +657,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;
}
@@ -695,9 +676,8 @@ static A_STATUS htc_process_trailer(HTC_TARGET *target,
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
("+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;
@@ -765,9 +745,8 @@ 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"));
return status;

View File

@@ -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;
};
#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];
uint64_t secs, usecs;
qdf_log_timestamp_to_secs(hist->time, &secs, &usecs);
@@ -151,7 +152,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;
@@ -178,6 +180,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;
@@ -201,12 +204,15 @@ static void do_send_completion(HTC_ENDPOINT *pEndpoint,
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,
/* 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 */
/* all packets are now owned by the callback, reset
* queue to be safe
*/
INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
} else {
HTC_PACKET *pPacket;
@@ -242,6 +248,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);
}
@@ -250,6 +257,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);
@@ -257,9 +265,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) {
@@ -279,8 +286,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;
}
@@ -307,14 +316,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,
@@ -360,8 +371,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;
}
/**
@@ -383,13 +392,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
@@ -474,16 +481,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;
}
@@ -519,9 +525,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) |
@@ -542,9 +547,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;
@@ -552,21 +556,18 @@ 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. */
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 */
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
static void htc_issue_packets_bundle(HTC_TARGET *target,
@@ -619,8 +620,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) {
@@ -630,8 +631,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)) {
@@ -644,23 +645,22 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target,
HTC_WRITE32(pHtcHdr,
SM(payloadLen,
HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->
PktInfo.
AsTx.
SendFlags,
HTC_FRAME_HDR_FLAGS)
| SM(pPacket->Endpoint,
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.
@@ -670,7 +670,7 @@ 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",
("%s nbuf Map Fail Endpnt %p\n",
__func__, pEndpoint));
status = A_ERROR;
break;
@@ -709,8 +709,11 @@ 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",
status));
@@ -829,8 +832,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);
@@ -873,10 +877,9 @@ 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,
(" Credits Required:%d Got:%d\n",
@@ -963,7 +966,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));
@@ -999,10 +1002,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 */
@@ -1014,13 +1013,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;
@@ -1039,18 +1038,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,
@@ -1064,10 +1064,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 */
@@ -1085,7 +1086,7 @@ 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;
}
@@ -1100,8 +1101,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 {
@@ -1111,8 +1114,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);
@@ -1121,8 +1125,10 @@ 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) {
@@ -1131,8 +1137,9 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
("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);
@@ -1142,16 +1149,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);
}
@@ -1207,8 +1221,10 @@ 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"));
@@ -1217,8 +1233,9 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
/***** 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)
@@ -1226,16 +1243,18 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
if (pEndpoint->async_update &&
(!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) &&
(!tx_resources)) {
(!tx_resources))
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
@@ -1269,24 +1288,28 @@ 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;
}
if (!pEndpoint->async_update) {
if (!pEndpoint->async_update)
UNLOCK_HTC_TX(target);
}
/* send what we can */
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));
@@ -1324,7 +1347,8 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
}
#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;
@@ -1333,18 +1357,16 @@ 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) {
case ENDPOINT_2: /* BE */
@@ -1387,11 +1409,10 @@ static A_STATUS htc_send_pkts_sched_queue(HTC_TARGET *target,
HTC_PACKET_ENQUEUE(pTxQueue, pPacket);
goodPkts--;
if (goodPkts <= 0) {
if (goodPkts <= 0)
break;
}
}
}
if (HTC_PACKET_QUEUE_DEPTH(pPktQueue)) {
ITERATE_OVER_LIST_ALLOW_REMOVE(&pPktQueue->QueueHead, pPacket,
@@ -1416,7 +1437,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;
@@ -1429,7 +1451,9 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
("+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);
@@ -1463,9 +1487,9 @@ A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
AR_DEBUG_ASSERT(pHtcHdr);
HTC_WRITE32(pHtcHdr,
SM(pPacket->ActualLength,
HTC_FRAME_HDR_PAYLOADLEN) | SM(pPacket->Endpoint,
HTC_FRAME_HDR_PAYLOADLEN) |
SM(pPacket->Endpoint,
HTC_FRAME_HDR_ENDPOINTID));
LOCK_HTC_TX(target);
pPacket->PktInfo.AsTx.SeqNo = pEndpoint->SeqNo;
@@ -1477,9 +1501,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),
@@ -1496,11 +1520,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
@@ -1512,12 +1535,11 @@ 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);
@@ -1533,9 +1555,8 @@ 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",
@@ -1566,8 +1587,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) {
@@ -1577,10 +1598,9 @@ 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))
return A_ERROR;
@@ -1658,23 +1678,25 @@ A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
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));
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);
@@ -1706,9 +1728,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);
@@ -1722,7 +1744,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) {
@@ -1756,16 +1779,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);
@@ -1783,9 +1806,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);
@@ -1823,12 +1845,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);
@@ -1883,13 +1909,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);
@@ -1974,7 +1999,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);
}
@@ -1989,9 +2015,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
*/
if ((qdf_atomic_read(&pEndpoint->TxProcessCount) == 0) ||
(!pEndpoint->async_update)) {
htc_try_send(target, pEndpoint, NULL);
@@ -2030,11 +2057,10 @@ 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;
}
}
}
if (i >= ENDPOINT_MAX) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
@@ -2133,6 +2159,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;
}
@@ -2188,13 +2215,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);
@@ -2224,11 +2252,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);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -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,16 +216,16 @@ 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;
@@ -280,10 +277,11 @@ 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
/* TODO: restore the ifdef when FW supports services 301 and 302
* (HTT_MSG_DATA[23]_MSG_SVC)
*/
/* Keep work and not to block the control message. */
/* #ifdef QCA_TX_HTT2_SUPPORT */
/* Keep work and not to block the control msg */
target->CtrlResponseProcessing = false;
/* #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,
@@ -365,16 +364,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,
@@ -411,20 +410,21 @@ 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);
}
}
void htc_set_async_ep(HTC_HANDLE HTCHandle,

View File

@@ -2871,8 +2871,8 @@ static int wmi_connect_pdev_htc_service(struct wmi_soc *soc,
int status;
uint32_t svc_id[] = {WMI_CONTROL_SVC, WMI_CONTROL_SVC_WMAC1,
WMI_CONTROL_SVC_WMAC2};
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));