OLD | NEW |
1 //------------------------------------------------------------------------------ | 1 //------------------------------------------------------------------------------ |
2 // <copyright file="htc_send.c" company="Atheros"> | 2 // <copyright file="htc_send.c" company="Atheros"> |
3 // Copyright (c) 2007-2008 Atheros Corporation. All rights reserved. | 3 // Copyright (c) 2007-2010 Atheros Corporation. All rights reserved. |
4 // | 4 // |
5 // This program is free software; you can redistribute it and/or modify | |
6 // it under the terms of the GNU General Public License version 2 as | |
7 // published by the Free Software Foundation; | |
8 // | 5 // |
9 // Software distributed under the License is distributed on an "AS | 6 // Permission to use, copy, modify, and/or distribute this software for any |
10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | 7 // purpose with or without fee is hereby granted, provided that the above |
11 // implied. See the License for the specific language governing | 8 // copyright notice and this permission notice appear in all copies. |
12 // rights and limitations under the License. | 9 // |
| 10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
13 // | 17 // |
14 // | 18 // |
15 //------------------------------------------------------------------------------ | 19 //------------------------------------------------------------------------------ |
16 //============================================================================== | 20 //============================================================================== |
17 // Author(s): ="Atheros" | 21 // Author(s): ="Atheros" |
18 //============================================================================== | 22 //============================================================================== |
19 #include "htc_internal.h" | 23 #include "htc_internal.h" |
20 | 24 |
21 typedef enum _HTC_SEND_QUEUE_RESULT { | 25 typedef enum _HTC_SEND_QUEUE_RESULT { |
22 HTC_SEND_QUEUE_OK = 0, /* packet was queued */ | 26 HTC_SEND_QUEUE_OK = 0, /* packet was queued */ |
23 HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */ | 27 HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */ |
24 } HTC_SEND_QUEUE_RESULT; | 28 } HTC_SEND_QUEUE_RESULT; |
25 | 29 |
26 #define DO_EP_TX_COMPLETION(ep,q) DoSendCompletion(ep,q) | 30 #define DO_EP_TX_COMPLETION(ep,q) DoSendCompletion(ep,q) |
27 | 31 |
28 /* call the distribute credits callback with the distribution */ | 32 /* call the distribute credits callback with the distribution */ |
29 #define DO_DISTRIBUTION(t,reason,description,pList) \ | 33 #define DO_DISTRIBUTION(t,reason,description,pList) \ |
30 { \ | 34 { \ |
31 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, \ | 35 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, \ |
32 (" calling distribute function (%s) (dfn:0x%X, ctxt:0x%X, dist:0x%X) \n
", \ | 36 (" calling distribute function (%s) (dfn:0x%lX, ctxt:0x%lX, dist:0x%lX)
\n", \ |
33 (description), \ | 37 (description), \ |
34 (A_UINT32)(t)->DistributeCredits, \ | 38 (unsigned long)(t)->DistributeCredits, \ |
35 (A_UINT32)(t)->pCredDistContext, \ | 39 (unsigned long)(t)->pCredDistContext, \ |
36 (A_UINT32)pList)); \ | 40 (unsigned long)pList)); \ |
37 (t)->DistributeCredits((t)->pCredDistContext, \ | 41 (t)->DistributeCredits((t)->pCredDistContext, \ |
38 (pList), \ | 42 (pList), \ |
39 (reason)); \ | 43 (reason)); \ |
40 } | 44 } |
41 | 45 |
42 static void DoSendCompletion(HTC_ENDPOINT *pEndpoint, | 46 static void DoSendCompletion(HTC_ENDPOINT *pEndpoint, |
43 HTC_PACKET_QUEUE *pQueueToIndicate) | 47 HTC_PACKET_QUEUE *pQueueToIndicate) |
44 { | 48 { |
45 do { | 49 do { |
46 | 50 |
47 if (HTC_QUEUE_EMPTY(pQueueToIndicate)) { | 51 if (HTC_QUEUE_EMPTY(pQueueToIndicate)) { |
48 /* nothing to indicate */ | 52 /* nothing to indicate */ |
49 break; | 53 break; |
50 } | 54 } |
51 | 55 |
52 if (pEndpoint->EpCallBacks.EpTxCompleteMultiple != NULL) { | 56 if (pEndpoint->EpCallBacks.EpTxCompleteMultiple != NULL) { |
53 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" HTC calling ep %d, send complete
multiple callback (%d pkts) \n", | 57 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" HTC calling ep %d, send complete
multiple callback (%d pkts) \n", |
54 pEndpoint->Id, HTC_PACKET_QUEUE_DEPTH(pQueueToIndicate))); | 58 pEndpoint->Id, HTC_PACKET_QUEUE_DEPTH(pQueueToIndicate))); |
55 /* a multiple send complete handler is being used, pass the queu
e to the handler */ | 59 /* a multiple send complete handler is being used, pass the queu
e to the handler */ |
56 pEndpoint->EpCallBacks.EpTxCompleteMultiple(pEndpoint->EpCallBacks.p
Context, | 60 pEndpoint->EpCallBacks.EpTxCompleteMultiple(pEndpoint->EpCallBacks.p
Context, |
57 pQueueToIndicate); | 61 pQueueToIndicate); |
58 /* all packets are now owned by the callback, reset queue to be
safe */ | 62 /* all packets are now owned by the callback, reset queue to be
safe */ |
59 INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
| 63 INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
|
60 } else { | 64 } else { |
61 HTC_PACKET *pPacket; | 65 HTC_PACKET *pPacket; |
62 /* using legacy EpTxComplete */ | 66 /* using legacy EpTxComplete */ |
63 do { | 67 do { |
64 pPacket = HTC_PACKET_DEQUEUE(pQueueToIndicate); | 68 pPacket = HTC_PACKET_DEQUEUE(pQueueToIndicate); |
65 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" HTC calling ep %d send comple
te callback on packet 0x%X \n", \ | 69 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" HTC calling ep %d send comple
te callback on packet 0x%lX \n", \ |
66 pEndpoint->Id, (A_UINT32)(pPacket))); | 70 pEndpoint->Id, (unsigned long)(pPacket))); |
67 pEndpoint->EpCallBacks.EpTxComplete(pEndpoint->EpCallBacks.pCont
ext, pPacket); | 71 pEndpoint->EpCallBacks.EpTxComplete(pEndpoint->EpCallBacks.pCont
ext, pPacket); |
68 } while (!HTC_QUEUE_EMPTY(pQueueToIndicate));
| 72 } while (!HTC_QUEUE_EMPTY(pQueueToIndicate));
|
69 } | 73 } |
70 | 74 |
71 } while (FALSE); | 75 } while (FALSE); |
72 | 76 |
73 } | 77 } |
74 | 78 |
75 /* do final completion on sent packet */ | 79 /* do final completion on sent packet */ |
76 static INLINE void CompleteSentPacket(HTC_TARGET *target, HTC_ENDPOINT *pEndpoin
t, HTC_PACKET *pPacket) | 80 static INLINE void CompleteSentPacket(HTC_TARGET *target, HTC_ENDPOINT *pEndpoin
t, HTC_PACKET *pPacket) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 A_STATUS status; | 118 A_STATUS status; |
115 A_BOOL sync = FALSE; | 119 A_BOOL sync = FALSE; |
116 | 120 |
117 if (pPacket->Completion == NULL) { | 121 if (pPacket->Completion == NULL) { |
118 /* mark that this request was synchronously issued */ | 122 /* mark that this request was synchronously issued */ |
119 sync = TRUE; | 123 sync = TRUE; |
120 } | 124 } |
121 | 125 |
122 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, | 126 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, |
123 ("+-HTCIssueSend: transmit length : %d (%s) \n", | 127 ("+-HTCIssueSend: transmit length : %d (%s) \n", |
124 pPacket->ActualLength + HTC_HDR_LENGTH, | 128 pPacket->ActualLength + (A_UINT32)HTC_HDR_LENGTH, |
125 sync ? "SYNC" : "ASYNC" )); | 129 sync ? "SYNC" : "ASYNC" )); |
126 | 130 |
127 /* send message to device */ | 131 /* send message to device */ |
128 status = DevSendPacket(&target->Device, | 132 status = DevSendPacket(&target->Device, |
129 pPacket, | 133 pPacket, |
130 pPacket->ActualLength + HTC_HDR_LENGTH); | 134 pPacket->ActualLength + HTC_HDR_LENGTH); |
131 | 135 |
132 if (sync) { | 136 if (sync) { |
133 /* use local sync variable. If this was issued asynchronously, pPac
ket is no longer | 137 /* use local sync variable. If this was issued asynchronously, pPac
ket is no longer |
134 * safe to access. */ | 138 * safe to access. */ |
(...skipping 23 matching lines...) Expand all Loading... |
158 /* loop until we can grab as many packets out of the queue as we can */
| 162 /* loop until we can grab as many packets out of the queue as we can */
|
159 while (TRUE) { | 163 while (TRUE) { |
160 | 164 |
161 sendFlags = 0; | 165 sendFlags = 0; |
162 /* get packet at head, but don't remove it */ | 166 /* get packet at head, but don't remove it */ |
163 pPacket = HTC_GET_PKT_AT_HEAD(&pEndpoint->TxQueue); | 167 pPacket = HTC_GET_PKT_AT_HEAD(&pEndpoint->TxQueue); |
164 if (pPacket == NULL) { | 168 if (pPacket == NULL) { |
165 break; | 169 break; |
166 } | 170 } |
167 | 171 |
168 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Got head packet:0x%X , Queue Depth: %d
\n", | 172 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Got head packet:0x%lX , Queue Depth: %
d\n", |
169 (A_UINT32)pPacket, HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue)))
; | 173 (unsigned long)pPacket, HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQue
ue))); |
170 | 174 |
171 transferLength = DEV_CALC_SEND_PADDED_LEN(&target->Device, pPacket->Actu
alLength + HTC_HDR_LENGTH); | 175 transferLength = DEV_CALC_SEND_PADDED_LEN(&target->Device, pPacket->Actu
alLength + HTC_HDR_LENGTH); |
172 | 176 |
173 if (transferLength <= target->TargetCreditSize) { | 177 if (transferLength <= target->TargetCreditSize) { |
174 creditsRequired = 1; | 178 creditsRequired = 1; |
175 } else { | 179 } else { |
176 /* figure out how many credits this message requires */ | 180 /* figure out how many credits this message requires */ |
177 creditsRequired = transferLength / target->TargetCreditSize; | 181 creditsRequired = transferLength / target->TargetCreditSize; |
178 remainder = transferLength % target->TargetCreditSize; | 182 remainder = transferLength % target->TargetCreditSize; |
179 | 183 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 HTC_PREPARE_SEND_PKT(pPacket, | 418 HTC_PREPARE_SEND_PKT(pPacket, |
415 pPacket->PktInfo.AsTx.SendFlags | HTC_FLAGS_SEN
D_BUNDLE, | 419 pPacket->PktInfo.AsTx.SendFlags | HTC_FLAGS_SEN
D_BUNDLE, |
416 creditPad, | 420 creditPad, |
417 pPacket->PktInfo.AsTx.SeqNo); | 421 pPacket->PktInfo.AsTx.SeqNo); |
418 pScatterReq->ScatterList[i].pBuffer = pPacket->pBuffer; | 422 pScatterReq->ScatterList[i].pBuffer = pPacket->pBuffer; |
419 pScatterReq->ScatterList[i].Length = transferLength; | 423 pScatterReq->ScatterList[i].Length = transferLength; |
420 A_ASSERT(transferLength); | 424 A_ASSERT(transferLength); |
421 pScatterReq->TotalLength += transferLength; | 425 pScatterReq->TotalLength += transferLength; |
422 pScatterReq->ValidScatterEntries++; | 426 pScatterReq->ValidScatterEntries++; |
423 packetsInScatterReq++; | 427 packetsInScatterReq++; |
424 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" %d, Adding packet : 0x%X, len:%d
(remaining space:%d) \n", | 428 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" %d, Adding packet : 0x%lX, len:%d
(remaining space:%d) \n", |
425 i, (A_UINT32)pPacket,transferLength,scatterSpaceRemaining));
| 429 i, (unsigned long)pPacket,transferLength,scatterSpaceRemaini
ng)); |
426 } | 430 } |
427 | 431 |
428 if (packetsInScatterReq >= HTC_MIN_HTC_MSGS_TO_BUNDLE) { | 432 if (packetsInScatterReq >= HTC_MIN_HTC_MSGS_TO_BUNDLE) { |
429 /* send path is always asynchronous */ | 433 /* send path is always asynchronous */ |
430 pScatterReq->CompletionRoutine = HTCAsyncSendScatterCompletion; | 434 pScatterReq->CompletionRoutine = HTCAsyncSendScatterCompletion; |
431 pScatterReq->Context = pEndpoint; | 435 pScatterReq->Context = pEndpoint; |
432 bundlesSent++; | 436 bundlesSent++; |
433 totalPktsInBundle += packetsInScatterReq; | 437 totalPktsInBundle += packetsInScatterReq; |
434 packetsInScatterReq = 0; | 438 packetsInScatterReq = 0; |
435 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Send Scatter total bytes: %d , ent
ries: %d\n", | 439 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,(" Send Scatter total bytes: %d , ent
ries: %d\n", |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 HTC_ENDPOINT *pEndpoint, | 481 HTC_ENDPOINT *pEndpoint, |
478 HTC_PACKET_QUEUE *pCallersSendQueue) | 482 HTC_PACKET_QUEUE *pCallersSendQueue) |
479 { | 483 { |
480 HTC_PACKET_QUEUE sendQueue; /* temp queue to hold packets at various st
ages */ | 484 HTC_PACKET_QUEUE sendQueue; /* temp queue to hold packets at various st
ages */ |
481 HTC_PACKET *pPacket; | 485 HTC_PACKET *pPacket; |
482 int bundlesSent; | 486 int bundlesSent; |
483 int pktsInBundles; | 487 int pktsInBundles; |
484 int overflow; | 488 int overflow; |
485 HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK; | 489 HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK; |
486 | 490 |
487 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HTCTrySend (Queue:0x%X Depth:%d)\n", | 491 AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HTCTrySend (Queue:0x%lX Depth:%d)\n", |
488 (A_UINT32)pCallersSendQueue, | 492 (unsigned long)pCallersSendQueue, |
489 (pCallersSendQueue == NULL) ? 0 : HTC_PACKET_QUEUE_DEPTH(pCallersSen
dQueue))); | 493 (pCallersSendQueue == NULL) ? 0 : HTC_PACKET_QUEUE_DEPTH(pCallersSen
dQueue))); |
490 | 494 |
491 /* init the local send queue */ | 495 /* init the local send queue */ |
492 INIT_HTC_PACKET_QUEUE(&sendQueue); | 496 INIT_HTC_PACKET_QUEUE(&sendQueue); |
493 | 497 |
494 do { | 498 do { |
495 | 499 |
496 if (NULL == pCallersSendQueue) { | 500 if (NULL == pCallersSendQueue) { |
497 /* caller didn't provide a queue, just wants us to check queues
and send */ | 501 /* caller didn't provide a queue, just wants us to check queues
and send */ |
498 break; | 502 break; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 pPacket = HTC_PACKET_DEQUEUE(pCallersSendQueue); | 541 pPacket = HTC_PACKET_DEQUEUE(pCallersSendQueue); |
538 A_ASSERT(pPacket != NULL); | 542 A_ASSERT(pPacket != NULL); |
539 /* insert into local queue */ | 543 /* insert into local queue */ |
540 HTC_PACKET_ENQUEUE(&sendQueue,pPacket); | 544 HTC_PACKET_ENQUEUE(&sendQueue,pPacket); |
541 } | 545 } |
542 | 546 |
543 /* the caller's queue has all the packets that won't fit*/
| 547 /* the caller's queue has all the packets that won't fit*/
|
544 /* walk through the caller's queue and indicate each one to the
send full handler */ | 548 /* walk through the caller's queue and indicate each one to the
send full handler */ |
545 ITERATE_OVER_LIST_ALLOW_REMOVE(&pCallersSendQueue->QueueHead, pPacke
t, HTC_PACKET, ListLink) { | 549 ITERATE_OVER_LIST_ALLOW_REMOVE(&pCallersSendQueue->QueueHead, pPacke
t, HTC_PACKET, ListLink) { |
546 | 550 |
547 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Indicating overflowed TX pack
et: 0x%X \n", | 551 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Indicating overflowed TX pack
et: 0x%lX \n", |
548 (A_UINT32)pPacket)); | 552 (unsigned long)pPacket)); |
549 if (pEndpoint->EpCallBacks.EpSendFull(pEndpoint->EpCallBacks.pCo
ntext, | 553 if (pEndpoint->EpCallBacks.EpSendFull(pEndpoint->EpCallBacks.pCo
ntext, |
550 pPacket) == HTC_SEND_FULL_
DROP) { | 554 pPacket) == HTC_SEND_FULL_
DROP) { |
551 /* callback wants the packet dropped */ | 555 /* callback wants the packet dropped */ |
552 INC_HTC_EP_STAT(pEndpoint, TxDropped, 1); | 556 INC_HTC_EP_STAT(pEndpoint, TxDropped, 1); |
553 /* leave this one in the caller's queue for cleanup */ | 557 /* leave this one in the caller's queue for cleanup */ |
554 } else { | 558 } else { |
555 /* callback wants to keep this packet, remove from calle
r's queue */ | 559 /* callback wants to keep this packet, remove from calle
r's queue */ |
556 HTC_PACKET_REMOVE(pCallersSendQueue, pPacket); | 560 HTC_PACKET_REMOVE(pCallersSendQueue, pPacket); |
557 /* put it in the send queue */ | 561 /* put it in the send queue */ |
558 HTC_PACKET_ENQUEUE(&sendQueue,pPacket);
| 562 HTC_PACKET_ENQUEUE(&sendQueue,pPacket);
|
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 667 |
664 return HTC_SEND_QUEUE_OK; | 668 return HTC_SEND_QUEUE_OK; |
665 } | 669 } |
666 | 670 |
667 A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue) | 671 A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue) |
668 { | 672 { |
669 HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); | 673 HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); |
670 HTC_ENDPOINT *pEndpoint; | 674 HTC_ENDPOINT *pEndpoint; |
671 HTC_PACKET *pPacket; | 675 HTC_PACKET *pPacket; |
672 | 676 |
673 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCSendPktsMultiple: Queue: 0x%X, Pkts %d
\n", | 677 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCSendPktsMultiple: Queue: 0x%lX, Pkts %
d \n", |
674 (A_UINT32)pPktQueue, HTC_PACKET_QUEUE_DEPTH(pPktQueue))); | 678 (unsigned long)pPktQueue, HTC_PACKET_QUEUE_DEPTH(pPktQueue))
); |
675 | 679 |
676 /* get packet at head to figure out which endpoint these packets will go
into */ | 680 /* get packet at head to figure out which endpoint these packets will go
into */ |
677 pPacket = HTC_GET_PKT_AT_HEAD(pPktQueue); | 681 pPacket = HTC_GET_PKT_AT_HEAD(pPktQueue); |
678 if (NULL == pPacket) { | 682 if (NULL == pPacket) { |
679 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-HTCSendPktsMultiple \n")); | 683 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-HTCSendPktsMultiple \n")); |
680 return A_EINVAL; | 684 return A_EINVAL; |
681 } | 685 } |
682 | 686 |
683 AR_DEBUG_ASSERT(pPacket->Endpoint < ENDPOINT_MAX); | 687 AR_DEBUG_ASSERT(pPacket->Endpoint < ENDPOINT_MAX); |
684 pEndpoint = &target->EndPoint[pPacket->Endpoint]; | 688 pEndpoint = &target->EndPoint[pPacket->Endpoint]; |
(...skipping 18 matching lines...) Expand all Loading... |
703 | 707 |
704 return A_OK; | 708 return A_OK; |
705 } | 709 } |
706 | 710 |
707 /* HTC API - HTCSendPkt */ | 711 /* HTC API - HTCSendPkt */ |
708 A_STATUS HTCSendPkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket) | 712 A_STATUS HTCSendPkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket) |
709 { | 713 { |
710 HTC_PACKET_QUEUE queue; | 714 HTC_PACKET_QUEUE queue; |
711 | 715 |
712 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, | 716 AR_DEBUG_PRINTF(ATH_DEBUG_SEND, |
713 ("+-HTCSendPkt: Enter endPointId: %d, buffer: 0x%X, length:
%d \n", | 717 ("+-HTCSendPkt: Enter endPointId: %d, buffer: 0x%lX, length:
%d \n", |
714 pPacket->Endpoint, (A_UINT32)pPacket->pBuffer, pPacket->Actu
alLength)); | 718 pPacket->Endpoint, (unsigned long)pPacket->pBuffer, pPacket-
>ActualLength)); |
715 INIT_HTC_PACKET_QUEUE_AND_ADD(&queue,pPacket); | 719 INIT_HTC_PACKET_QUEUE_AND_ADD(&queue,pPacket); |
716 return HTCSendPktsMultiple(HTCHandle, &queue); | 720 return HTCSendPktsMultiple(HTCHandle, &queue); |
717 } | 721 } |
718 | 722 |
719 /* check TX queues to drain because of credit distribution update */ | 723 /* check TX queues to drain because of credit distribution update */ |
720 static INLINE void HTCCheckEndpointTxQueues(HTC_TARGET *target) | 724 static INLINE void HTCCheckEndpointTxQueues(HTC_TARGET *target) |
721 { | 725 { |
722 HTC_ENDPOINT *pEndpoint; | 726 HTC_ENDPOINT *pEndpoint; |
723 HTC_ENDPOINT_CREDIT_DIST *pDistItem; | 727 HTC_ENDPOINT_CREDIT_DIST *pDistItem; |
724 | 728 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 864 |
861 UNLOCK_HTC_TX(target); | 865 UNLOCK_HTC_TX(target); |
862 | 866 |
863 /* empty the discard queue */ | 867 /* empty the discard queue */ |
864 while (1) { | 868 while (1) { |
865 pPacket = HTC_PACKET_DEQUEUE(&discardQueue); | 869 pPacket = HTC_PACKET_DEQUEUE(&discardQueue); |
866 if (NULL == pPacket) { | 870 if (NULL == pPacket) { |
867 break; | 871 break; |
868 } | 872 } |
869 pPacket->Status = A_ECANCELED; | 873 pPacket->Status = A_ECANCELED; |
870 AR_DEBUG_PRINTF(ATH_DEBUG_TRC, (" Flushing TX packet:0x%X, length:%d, e
p:%d tag:0x%X \n", | 874 AR_DEBUG_PRINTF(ATH_DEBUG_TRC, (" Flushing TX packet:0x%lX, length:%d,
ep:%d tag:0x%X \n", |
871 (A_UINT32)pPacket, pPacket->ActualLength, pPacket->Endpoint, pPa
cket->PktInfo.AsTx.Tag)); | 875 (unsigned long)pPacket, pPacket->ActualLength, pPacket->Endpoint
, pPacket->PktInfo.AsTx.Tag)); |
872 INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket); | 876 INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket); |
873 DO_EP_TX_COMPLETION(pEndpoint,&container); | 877 DO_EP_TX_COMPLETION(pEndpoint,&container); |
874 } | 878 } |
875 | 879 |
876 } | 880 } |
877 | 881 |
878 void DumpCreditDist(HTC_ENDPOINT_CREDIT_DIST *pEPDist) | 882 void DumpCreditDist(HTC_ENDPOINT_CREDIT_DIST *pEPDist) |
879 { | 883 { |
880 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("--- EP : %d ServiceID: 0x%X -----------
---\n", | 884 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("--- EP : %d ServiceID: 0x%X -----------
---\n", |
881 pEPDist->Endpoint, pEPDist->ServiceID)); | 885 pEPDist->Endpoint, pEPDist->ServiceID)); |
882 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" this:0x%X next:0x%X prev:0x%X\n", | 886 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" this:0x%lX next:0x%lX prev:0x%lX\n", |
883 (A_UINT32)pEPDist, (A_UINT32)pEPDist->pNext, (A_UINT32)pEPDist->
pPrev)); | 887 (unsigned long)pEPDist, (unsigned long)pEPDist->pNext, (unsigned
long)pEPDist->pPrev)); |
884 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" DistFlags : 0x%X \n", pEPDist->Di
stFlags)); | 888 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" DistFlags : 0x%X \n", pEPDist->Di
stFlags)); |
885 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsNorm : %d \n", pEPDist->TxCr
editsNorm)); | 889 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsNorm : %d \n", pEPDist->TxCr
editsNorm)); |
886 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsMin : %d \n", pEPDist->TxCr
editsMin)); | 890 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsMin : %d \n", pEPDist->TxCr
editsMin)); |
887 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCredits : %d \n", pEPDist->TxCr
edits)); | 891 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCredits : %d \n", pEPDist->TxCr
edits)); |
888 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsAssigned : %d \n", pEPDist->TxCr
editsAssigned)); | 892 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsAssigned : %d \n", pEPDist->TxCr
editsAssigned)); |
889 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsSeek : %d \n", pEPDist->TxCr
editsSeek)); | 893 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsSeek : %d \n", pEPDist->TxCr
editsSeek)); |
890 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditSize : %d \n", pEPDist->TxCr
editSize)); | 894 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditSize : %d \n", pEPDist->TxCr
editSize)); |
891 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsPerMaxMsg : %d \n", pEPDist->TxCr
editsPerMaxMsg)); | 895 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsPerMaxMsg : %d \n", pEPDist->TxCr
editsPerMaxMsg)); |
892 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsToDist : %d \n", pEPDist->TxCr
editsToDist)); | 896 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsToDist : %d \n", pEPDist->TxCr
editsToDist)); |
893 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxQueueDepth : %d \n", | 897 AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxQueueDepth : %d \n", |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 if (pEndpoint->ServiceID == 0) { | 1014 if (pEndpoint->ServiceID == 0) { |
1011 return FALSE; | 1015 return FALSE; |
1012 } | 1016 } |
1013 | 1017 |
1014 if (pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE) { | 1018 if (pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE) { |
1015 return TRUE; | 1019 return TRUE; |
1016 } | 1020 } |
1017 | 1021 |
1018 return FALSE; | 1022 return FALSE; |
1019 } | 1023 } |
OLD | NEW |