|
@@ -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;
|
|
@@ -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,19 +330,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);
|
|
|
}
|
|
@@ -363,8 +363,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:
|
|
@@ -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,19 +527,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;
|
|
@@ -553,7 +552,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;
|
|
@@ -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"));
|
|
@@ -760,10 +760,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);
|
|
@@ -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);
|