forked from Myria-de/mt7610u_wifi_sta_v3002_dpo_20130916
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathrtusb_bulk.c
1495 lines (1203 loc) · 43.6 KB
/
rtusb_bulk.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2010, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************/
#ifdef RTMP_MAC_USB
#include "rt_config.h"
/* Match total 6 bulkout endpoint to corresponding queue.*/
UCHAR EpToQueue[6]={FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_EDCA, FIFO_MGMT};
#ifdef INF_AMAZON_SE
UINT16 MaxBulkOutsSizeLimit[5][4] =
{
/* Priority high -> low*/
{ 24576, 2048, 2048, 2048 }, /* 0 AC */
{ 24576, 2048, 2048, 2048 }, /* 1 AC */
{ 24576, 2048, 2048, 2048 }, /* 2 ACs*/
{ 24576, 6144, 2048, 2048 }, /* 3 ACs*/
{ 24576, 6144, 4096, 2048 } /* 4 ACs*/
};
VOID SoftwareFlowControl(
IN PRTMP_ADAPTER pAd)
{
BOOLEAN ResetBulkOutSize=FALSE;
UCHAR i=0,RunningQueueNo=0,QueIdx=0,HighWorkingAcCount=0;
UINT PacketsInQueueSize=0;
UCHAR Priority[]={1,0,2,3};
for (i=0;i<NUM_OF_TX_RING;i++)
{
if (pAd->TxContext[i].CurWritePosition>=pAd->TxContext[i].ENextBulkOutPosition)
{
PacketsInQueueSize=pAd->TxContext[i].CurWritePosition-pAd->TxContext[i].ENextBulkOutPosition;
}
else
{
PacketsInQueueSize=MAX_TXBULK_SIZE-pAd->TxContext[i].ENextBulkOutPosition+pAd->TxContext[i].CurWritePosition;
}
if (pAd->BulkOutDataSizeCount[i]>20480 || PacketsInQueueSize>6144)
{
RunningQueueNo++;
pAd->BulkOutDataFlag[i]=TRUE;
}
else
pAd->BulkOutDataFlag[i]=FALSE;
pAd->BulkOutDataSizeCount[i]=0;
}
if (RunningQueueNo>pAd->LastRunningQueueNo)
{
DBGPRINT(RT_DEBUG_INFO,("SoftwareFlowControl reset %d > %d \n",RunningQueueNo,pAd->LastRunningQueueNo));
ResetBulkOutSize=TRUE;
pAd->RunningQueueNoCount=0;
pAd->LastRunningQueueNo=RunningQueueNo;
}
else if (RunningQueueNo==pAd->LastRunningQueueNo)
{
pAd->RunningQueueNoCount=0;
}
else if (RunningQueueNo<pAd->LastRunningQueueNo)
{
DBGPRINT(RT_DEBUG_INFO,("SoftwareFlowControl reset %d < %d \n",RunningQueueNo,pAd->LastRunningQueueNo));
pAd->RunningQueueNoCount++;
if (pAd->RunningQueueNoCount>=6)
{
ResetBulkOutSize=TRUE;
pAd->RunningQueueNoCount=0;
pAd->LastRunningQueueNo=RunningQueueNo;
}
}
if (ResetBulkOutSize==TRUE)
{
for (QueIdx=0;QueIdx<NUM_OF_TX_RING;QueIdx++)
{
HighWorkingAcCount=0;
for (i=0;i<NUM_OF_TX_RING;i++)
{
if (QueIdx==i)
continue;
if (pAd->BulkOutDataFlag[i]==TRUE && Priority[i]>Priority[QueIdx])
HighWorkingAcCount++;
}
pAd->BulkOutDataSizeLimit[QueIdx]=MaxBulkOutsSizeLimit[RunningQueueNo][HighWorkingAcCount];
}
DBGPRINT(RT_DEBUG_TRACE, ("Reset bulkout size AC0(BE):%7d AC1(BK):%7d AC2(VI):%7d AC3(VO):%7d %d\n",pAd->BulkOutDataSizeLimit[0]
,pAd->BulkOutDataSizeLimit[1]
,pAd->BulkOutDataSizeLimit[2]
,pAd->BulkOutDataSizeLimit[3]
,RunningQueueNo));
}
}
#endif /* INF_AMAZON_SE */
VOID RTUSBInitTxDesc(
IN PRTMP_ADAPTER pAd,
IN PTX_CONTEXT pTxContext,
IN UCHAR BulkOutPipeId,
IN usb_complete_t Func)
{
PURB pUrb;
PUCHAR pSrc = NULL;
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
RTMP_CHIP_CAP *pChipCap = &pAd->chipCap;
pUrb = pTxContext->pUrb;
ASSERT(pUrb);
/* Store BulkOut PipeId*/
pTxContext->BulkOutPipeId = BulkOutPipeId;
if (pTxContext->bAggregatible)
{
pSrc = &pTxContext->TransferBuffer->Aggregation[2];
RTUSB_FILL_TX_BULK_URB(pUrb,
pObj->pUsb_Dev,
pChipCap->WMM0ACBulkOutAddr[BulkOutPipeId],
pSrc,
pTxContext->BulkOutSize,
Func,
pTxContext,
(pTxContext->data_dma + TX_BUFFER_NORMSIZE + 2));
}
else
{
pSrc = (PUCHAR) pTxContext->TransferBuffer->field.WirelessPacket;
RTUSB_FILL_TX_BULK_URB(pUrb,
pObj->pUsb_Dev,
pChipCap->WMM0ACBulkOutAddr[BulkOutPipeId],
pSrc,
pTxContext->BulkOutSize,
Func,
pTxContext,
pTxContext->data_dma);
}
}
VOID RTUSBInitHTTxDesc(
IN PRTMP_ADAPTER pAd,
IN PHT_TX_CONTEXT pTxContext,
IN UCHAR BulkOutPipeId,
IN ULONG BulkOutSize,
IN usb_complete_t Func)
{
PURB pUrb;
PUCHAR pSrc = NULL;
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
RTMP_CHIP_CAP *pChipCap = &pAd->chipCap;
pUrb = pTxContext->pUrb;
ASSERT(pUrb);
/* Store BulkOut PipeId*/
pTxContext->BulkOutPipeId = BulkOutPipeId;
pSrc = &pTxContext->TransferBuffer->field.WirelessPacket[pTxContext->NextBulkOutPosition];
RTUSB_FILL_HTTX_BULK_URB(pUrb,
pObj->pUsb_Dev,
pChipCap->WMM0ACBulkOutAddr[BulkOutPipeId],
pSrc,
BulkOutSize,
Func,
pTxContext,
(pTxContext->data_dma + pTxContext->NextBulkOutPosition));
}
VOID RTUSBInitRxDesc(
IN PRTMP_ADAPTER pAd,
IN PRX_CONTEXT pRxContext)
{
PURB pUrb;
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
ULONG RX_bulk_size;
RTMP_CHIP_CAP *pChipCap = &pAd->chipCap;
pUrb = pRxContext->pUrb;
ASSERT(pUrb);
if ( pAd->BulkInMaxPacketSize == 64)
RX_bulk_size = 4096;
else
RX_bulk_size = MAX_RXBULK_SIZE;
RTUSB_FILL_RX_BULK_URB(pUrb,
pObj->pUsb_Dev,
pChipCap->DataBulkInAddr,
&(pRxContext->TransferBuffer[pAd->NextRxBulkInPosition]),
RX_bulk_size - (pAd->NextRxBulkInPosition),
RtmpUsbBulkRxComplete,
(void *)pRxContext,
(pRxContext->data_dma + pAd->NextRxBulkInPosition));
}
/*
========================================================================
Routine Description:
Arguments:
Return Value:
Note:
========================================================================
*/
#define BULK_OUT_LOCK(pLock, IrqFlags) \
if(1 /*!(in_interrupt() & 0xffff0000)*/) \
RTMP_IRQ_LOCK((pLock), IrqFlags);
#define BULK_OUT_UNLOCK(pLock, IrqFlags) \
if(1 /*!(in_interrupt() & 0xffff0000)*/) \
RTMP_IRQ_UNLOCK((pLock), IrqFlags);
VOID RTUSBBulkOutDataPacket(
IN PRTMP_ADAPTER pAd,
IN UCHAR BulkOutPipeId,
IN UCHAR Index)
{
PHT_TX_CONTEXT pHTTXContext;
PURB pUrb;
int ret = 0;
TXINFO_STRUC *pTxInfo, *pLastTxInfo = NULL;
TXWI_STRUC *pTxWI;
ULONG TmpBulkEndPos, ThisBulkSize;
unsigned long IrqFlags = 0, IrqFlags2 = 0;
PUCHAR pWirelessPkt, pAppendant;
#ifdef USB_BULK_BUF_ALIGMENT
BOOLEAN bLasAlignmentsectiontRound = FALSE;
#else
BOOLEAN bTxQLastRound = FALSE;
UCHAR allzero[4]= {0x0,0x0,0x0,0x0};
#endif /* USB_BULK_BUF_ALIGMENT */
BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
if ((pAd->BulkOutPending[BulkOutPipeId] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX))
{
BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
return;
}
pAd->BulkOutPending[BulkOutPipeId] = TRUE;
if (((!OPSTATUS_TEST_FLAG(pAd, fOP_AP_STATUS_MEDIA_STATE_CONNECTED)) &&
( !OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED)))
)
{
pAd->BulkOutPending[BulkOutPipeId] = FALSE;
BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
return;
}
BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
pHTTXContext = &(pAd->TxContext[BulkOutPipeId]);
BULK_OUT_LOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2);
if ((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition)
#ifdef USB_BULK_BUF_ALIGMENT
|| ((pHTTXContext->CurWriteRealPos > pHTTXContext->CurWritePosition) &&(pHTTXContext->NextBulkIdx == pHTTXContext->CurWriteIdx) )
#else
|| ((pHTTXContext->ENextBulkOutPosition-8) == pHTTXContext->CurWritePosition)
#endif /* USB_BULK_BUF_ALIGMENT */
) /* druing writing. */
{
BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2);
BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
pAd->BulkOutPending[BulkOutPipeId] = FALSE;
/* Clear Data flag*/
RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId));
RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
return;
}
/* Clear Data flag*/
RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_FRAG << BulkOutPipeId));
RTUSB_CLEAR_BULK_FLAG(pAd, (fRTUSB_BULK_OUT_DATA_NORMAL << BulkOutPipeId));
/*DBGPRINT(RT_DEBUG_TRACE,("BulkOut-B:I=0x%lx, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", in_interrupt(), */
/* pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, */
/* pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad));*/
pHTTXContext->NextBulkOutPosition = pHTTXContext->ENextBulkOutPosition;
ThisBulkSize = 0;
TmpBulkEndPos = pHTTXContext->NextBulkOutPosition;
pWirelessPkt = &pHTTXContext->TransferBuffer->field.WirelessPacket[0];
#ifndef USB_BULK_BUF_ALIGMENT
if ((pHTTXContext->bCopySavePad == TRUE))
{
if (RTMPEqualMemory(pHTTXContext->SavedPad, allzero,4))
{
DBGPRINT_RAW(RT_DEBUG_ERROR,("e1, allzero : %x %x %x %x %x %x %x %x \n",
pHTTXContext->SavedPad[0], pHTTXContext->SavedPad[1], pHTTXContext->SavedPad[2],pHTTXContext->SavedPad[3]
,pHTTXContext->SavedPad[4], pHTTXContext->SavedPad[5], pHTTXContext->SavedPad[6],pHTTXContext->SavedPad[7]));
}
NdisMoveMemory(&pWirelessPkt[TmpBulkEndPos], pHTTXContext->SavedPad, 8);
pHTTXContext->bCopySavePad = FALSE;
if (pAd->bForcePrintTX == TRUE)
DBGPRINT(RT_DEBUG_TRACE,("RTUSBBulkOutDataPacket --> COPY PAD. CurWrite = %ld, NextBulk = %ld. ENextBulk = %ld.\n", pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition));
}
#endif /* USB_BULK_BUF_ALIGMENT */
do
{
pTxInfo = (TXINFO_STRUC *)&pWirelessPkt[TmpBulkEndPos];
pTxWI = (TXWI_STRUC *)&pWirelessPkt[TmpBulkEndPos + TXINFO_SIZE];
if (pAd->bForcePrintTX == TRUE)
DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkOutDataPacket AMPDU = %d.\n", pTxWI->TxWIAMPDU));
/* add by Iverson, limit BulkOut size to 4k to pass WMM b mode 2T1R test items*/
/*if ((ThisBulkSize != 0) && (pTxWI->AMPDU == 0))*/
if ((ThisBulkSize != 0) && (pTxWI->TxWIPHYMODE == MODE_CCK))
{
#ifdef INF_AMAZON_SE
/*Iverson Add for AMAZON USB (RT2070 && RT3070) to pass WMM A2-T4 ~ A2-T10*/
if(OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_WMM_INUSED))
{
/*Iverson patch for WMM A5-T07 ,WirelessStaToWirelessSta do not bulk out aggregate*/
if(pTxWI->PacketId == 6)
{
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
else if (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&pAd->BulkOutDataSizeLimit[BulkOutPipeId]) == pAd->BulkOutDataSizeLimit[BulkOutPipeId]))
{
/*printk("===Bulkout size limit :%d ===\n",MaxBulkOutSize);*/
/*DBGPRINT(RT_DEBUG_TRACE,("b mode BulkOutPipeId %d pAd->BulkOutDataSizeLimit[BulkOutPipeId] %d \n",BulkOutPipeId,pAd->BulkOutDataSizeLimit[BulkOutPipeId]));*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
}
else if (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&0x1000) == 0x1000))
{
/* Limit BulkOut size to about 4k bytes.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
#endif /* INF_AMAZON_SE */
#ifndef INF_AMAZON_SE
#ifndef USB_BULK_BUF_ALIGMENT
if (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&0x1000) == 0x1000))
{
/* Limit BulkOut size to about 4k bytes.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
#else
if (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&0x6000) == 0x6000))
{
/* Limit BulkOut size to about 24k bytes.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
/*
when bulk size is > 6000, it mean that this is the lasttround at this alignmnet section.
*/
bLasAlignmentsectiontRound = TRUE;
break;
}
#endif /* USB_BULK_BUF_ALIGMENT */
#endif /* INF_AMAZON_SE */
#ifndef USB_BULK_BUF_ALIGMENT
else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize&0xfffff800) != 0) ) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0))*/)
{
/* For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. */
/* For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
#else
else if (((pAd->BulkOutMaxPacketSize < 512) && (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&0x6000) == 0x6000)) ))
{
/* Limit BulkOut size to about 24k bytes.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
/*
when bulk size is > 6000, it mean that this is the lasttround at this alignmnet section.
*/
bLasAlignmentsectiontRound = TRUE;
break;
}
#endif /* USB_BULK_BUF_ALIGMENT */
}
/* end Iverson*/
else
{
if (((ThisBulkSize&0xfffe0000) != 0) || ((ThisBulkSize&0x10000) == 0x10000))
{ /* Limit BulkOut size to about 24k bytes.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
#ifdef USB_BULK_BUF_ALIGMENT
/*
when bulk size is > 0x6000, it mean that this is the lasttround at this alignmnet section.
*/
bLasAlignmentsectiontRound = TRUE;
/* printk("data bulk out bLasAlignmentsectiontRound \n");*/
#endif /* USB_BULK_BUF_ALIGMENT */
break;
}
#ifdef INF_AMAZON_SE
else if (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&pAd->BulkOutDataSizeLimit[BulkOutPipeId]) == pAd->BulkOutDataSizeLimit[BulkOutPipeId]))
{
/*printk("===Bulkout size limit :%d ===\n",ThisBulkSize);*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
#endif /* INF_AMAZON_SE */
#ifndef USB_BULK_BUF_ALIGMENT
else if (((pAd->BulkOutMaxPacketSize < 512) && ((ThisBulkSize&0xfffff800) != 0) ) /*|| ( (ThisBulkSize != 0) && (pTxWI->AMPDU == 0))*/)
{ /* For USB 1.1 or peer which didn't support AMPDU, limit the BulkOut size. */
/* For performence in b/g mode, now just check for USB 1.1 and didn't care about the APMDU or not! 2008/06/04.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
#else
else if (((pAd->BulkOutMaxPacketSize < 512) && (((ThisBulkSize&0xffff8000) != 0) || ((ThisBulkSize&0x6000) == 0x6000)) ))
{
/* Limit BulkOut size to about 24k bytes.*/
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
/*
when bulk size is > 6000, it mean that this is the lasttround at this alignmnet section.
*/
bLasAlignmentsectiontRound = TRUE;
break;
}
#endif /* USB_BULK_BUF_ALIGMENT */
}
if (TmpBulkEndPos == pHTTXContext->CurWritePosition)
{
pHTTXContext->ENextBulkOutPosition = TmpBulkEndPos;
break;
}
if (pTxInfo->TxInfoQSEL != FIFO_EDCA)
{
DBGPRINT(RT_DEBUG_ERROR, ("%s(): ====> pTxInfo->QueueSel(%d)!= FIFO_EDCA!!!!\n",
__FUNCTION__, pTxInfo->TxInfoQSEL));
DBGPRINT(RT_DEBUG_ERROR, ("\tCWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n",
pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition,
pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad));
hex_dump("Wrong QSel Pkt:", (PUCHAR)&pWirelessPkt[TmpBulkEndPos], (pHTTXContext->CurWritePosition - pHTTXContext->NextBulkOutPosition));
}
if (pTxInfo->TxInfoPktLen <= 8)
{
BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2);
DBGPRINT(RT_DEBUG_ERROR /*RT_DEBUG_TRACE*/,("e2, TxInfoPktLen==0, Size=%ld, bCSPad=%d, CWPos=%ld, NBPos=%ld, CWRPos=%ld!\n",
pHTTXContext->BulkOutSize, pHTTXContext->bCopySavePad, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, pHTTXContext->CurWriteRealPos));
{
DBGPRINT_RAW(RT_DEBUG_ERROR /*RT_DEBUG_TRACE*/,("%x %x %x %x %x %x %x %x \n",
pHTTXContext->SavedPad[0], pHTTXContext->SavedPad[1], pHTTXContext->SavedPad[2],pHTTXContext->SavedPad[3]
,pHTTXContext->SavedPad[4], pHTTXContext->SavedPad[5], pHTTXContext->SavedPad[6],pHTTXContext->SavedPad[7]));
}
pAd->bForcePrintTX = TRUE;
BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
pAd->BulkOutPending[BulkOutPipeId] = FALSE;
BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
/*DBGPRINT(RT_DEBUG_LOUD,("Out:pTxInfo->TxInfoPktLen=%d!\n", pTxInfo->TxInfoPktLen));*/
return;
}
/* Increase Total transmit byte counter*/
pAd->RalinkCounters.OneSecTransmittedByteCount += pTxWI->TxWIMPDUByteCnt;
pAd->RalinkCounters.TransmittedByteCount += pTxWI->TxWIMPDUByteCnt;
pLastTxInfo = pTxInfo;
/* Make sure we use EDCA QUEUE. */
pTxInfo->TxInfoQSEL = FIFO_EDCA;
ThisBulkSize += (pTxInfo->TxInfoPktLen+4);
TmpBulkEndPos += (pTxInfo->TxInfoPktLen+4);
if (TmpBulkEndPos != pHTTXContext->CurWritePosition)
pTxInfo->TxInfoUDMANextVld = 1;
#ifdef USB_BULK_BUF_ALIGMENT
/*
this is for frag packet , because it will finish this section
when ((((pHTTXContext->CurWritePosition + 3906)& 0x00007fff) & 0xffff6000) == 0x00006000)
*/
if (pTxInfo->bFragLasAlignmentsectiontRound == 1)
{
bLasAlignmentsectiontRound = TRUE;
break;
}
#else
if (pTxInfo->TxInfoSwLstRnd == 1)
{
if (pHTTXContext->CurWritePosition == 8)
pTxInfo->TxInfoUDMANextVld = 0;
pTxInfo->TxInfoSwLstRnd = 0;
bTxQLastRound = TRUE;
pHTTXContext->ENextBulkOutPosition = 8;
#ifdef RT_BIG_ENDIAN
RTMPDescriptorEndianChange((PUCHAR)pTxInfo, TYPE_TXINFO);
RTMPWIEndianChange(pAd, (PUCHAR)pTxWI, TYPE_TXWI);
#endif /* RT_BIG_ENDIAN */
break;
}
#endif /* USB_BULK_BUF_ALIGMENT */
#ifdef RT_BIG_ENDIAN
RTMPDescriptorEndianChange((PUCHAR)pTxInfo, TYPE_TXINFO);
RTMPWIEndianChange(pAd, (PUCHAR)pTxWI, TYPE_TXWI);
#endif /* RT_BIG_ENDIAN */
}while (TRUE);
/* adjust the pTxInfo->TxInfoUDMANextVld value of last pTxInfo.*/
if (pLastTxInfo)
{
#ifdef RT_BIG_ENDIAN
RTMPDescriptorEndianChange((PUCHAR)pLastTxInfo, TYPE_TXINFO);
#endif /* RT_BIG_ENDIAN */
pLastTxInfo->TxInfoUDMANextVld = 0;
#ifdef RT_BIG_ENDIAN
RTMPDescriptorEndianChange((PUCHAR)pLastTxInfo, TYPE_TXINFO);
#endif /* RT_BIG_ENDIAN */
}
/*
We need to copy SavedPad when following condition matched!
1. Not the last round of the TxQueue and
2. any match of following cases:
(1). The End Position of this bulk out is reach to the Currenct Write position and
the TxInfo and related header already write to the CurWritePosition.
=>(ENextBulkOutPosition == CurWritePosition) && (CurWriteRealPos > CurWritePosition)
(2). The EndPosition of the bulk out is not reach to the Current Write Position.
=>(ENextBulkOutPosition != CurWritePosition)
*/
#ifndef USB_BULK_BUF_ALIGMENT
if ((bTxQLastRound == FALSE) &&
(((pHTTXContext->ENextBulkOutPosition == pHTTXContext->CurWritePosition) && (pHTTXContext->CurWriteRealPos > pHTTXContext->CurWritePosition)) ||
(pHTTXContext->ENextBulkOutPosition != pHTTXContext->CurWritePosition))
)
{
NdisMoveMemory(pHTTXContext->SavedPad, &pWirelessPkt[pHTTXContext->ENextBulkOutPosition], 8);
pHTTXContext->bCopySavePad = TRUE;
if (RTMPEqualMemory(pHTTXContext->SavedPad, allzero,4))
{
PUCHAR pBuf = &pHTTXContext->SavedPad[0];
DBGPRINT_RAW(RT_DEBUG_ERROR,("WARNING-Zero-3:%02x%02x%02x%02x%02x%02x%02x%02x,CWPos=%ld, CWRPos=%ld, bCW=%d, NBPos=%ld, TBPos=%ld, TBSize=%ld\n",
pBuf[0], pBuf[1], pBuf[2],pBuf[3],pBuf[4], pBuf[5], pBuf[6],pBuf[7], pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos,
pHTTXContext->bCurWriting, pHTTXContext->NextBulkOutPosition, TmpBulkEndPos, ThisBulkSize));
pBuf = &pWirelessPkt[pHTTXContext->CurWritePosition];
DBGPRINT_RAW(RT_DEBUG_ERROR,("\tCWPos=%02x%02x%02x%02x%02x%02x%02x%02x\n", pBuf[0], pBuf[1], pBuf[2],pBuf[3],pBuf[4], pBuf[5], pBuf[6],pBuf[7]));
}
/*DBGPRINT(RT_DEBUG_LOUD,("ENPos==CWPos=%ld, CWRPos=%ld, bCSPad=%d!\n", pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->bCopySavePad));*/
}
#endif /* USB_BULK_BUF_ALIGMENT */
if (pAd->bForcePrintTX == TRUE)
DBGPRINT(RT_DEBUG_TRACE,("BulkOut-A:Size=%ld, CWPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d!\n", ThisBulkSize, pHTTXContext->CurWritePosition, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad));
/*DBGPRINT(RT_DEBUG_LOUD,("BulkOut-A:Size=%ld, CWPos=%ld, CWRPos=%ld, NBPos=%ld, ENBPos=%ld, bCopy=%d, bLRound=%d!\n", ThisBulkSize, pHTTXContext->CurWritePosition, pHTTXContext->CurWriteRealPos, pHTTXContext->NextBulkOutPosition, pHTTXContext->ENextBulkOutPosition, pHTTXContext->bCopySavePad, bTxQLastRound));*/
/* USB DMA engine requires to pad extra 4 bytes. This pad doesn't count into real bulkoutsize.*/
pAppendant = &pWirelessPkt[TmpBulkEndPos];
NdisZeroMemory(pAppendant, 8);
ThisBulkSize += 4;
pHTTXContext->LastOne = TRUE;
pHTTXContext->BulkOutSize = ThisBulkSize;
#ifdef USB_BULK_BUF_ALIGMENT
/*
if it is the last alignment section round,that we just need to add nextbulkindex,
otherwise we both need to add nextbulkindex and CurWriteIdx
(because when alignment section round happened, the CurWriteIdx is added at function writing resource.)
*/
if(bLasAlignmentsectiontRound == TRUE)
{
pHTTXContext->ENextBulkOutPosition = ((CUR_WRITE_IDX_INC(pHTTXContext->NextBulkIdx, BUF_ALIGMENT_RINGSIZE)) * 0x8000);
}
else
{
pHTTXContext->ENextBulkOutPosition = ((CUR_WRITE_IDX_INC(pHTTXContext->NextBulkIdx, BUF_ALIGMENT_RINGSIZE)) * 0x8000);
pHTTXContext->CurWritePosition = ((CUR_WRITE_IDX_INC(pHTTXContext->CurWriteIdx, BUF_ALIGMENT_RINGSIZE)) * 0x8000);
}
#endif /* USB_BULK_BUF_ALIGMENT */
pAd->watchDogTxPendingCnt[BulkOutPipeId] = 1;
BULK_OUT_UNLOCK(&pAd->TxContextQueueLock[BulkOutPipeId], IrqFlags2);
/* Init Tx context descriptor*/
RTUSBInitHTTxDesc(pAd, pHTTXContext, BulkOutPipeId, ThisBulkSize, (usb_complete_t)RtmpUsbBulkOutDataPacketComplete);
pUrb = pHTTXContext->pUrb;
if((ret = RTUSB_SUBMIT_URB(pUrb))!=0)
{
DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutDataPacket: Submit Tx URB failed %d\n", ret));
BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
pAd->BulkOutPending[BulkOutPipeId] = FALSE;
pAd->watchDogTxPendingCnt[BulkOutPipeId] = 0;
BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
return;
}
BULK_OUT_LOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
pHTTXContext->IRPPending = TRUE;
BULK_OUT_UNLOCK(&pAd->BulkOutLock[BulkOutPipeId], IrqFlags);
pAd->BulkOutReq++;
}
USBHST_STATUS RTUSBBulkOutDataPacketComplete(URBCompleteStatus Status, purbb_t pURB, pregs *pt_regs)
{
PHT_TX_CONTEXT pHTTXContext;
PRTMP_ADAPTER pAd;
POS_COOKIE pObj;
UCHAR BulkOutPipeId;
pHTTXContext = (PHT_TX_CONTEXT)RTMP_OS_USB_CONTEXT_GET(pURB);
pAd = pHTTXContext->pAd;
pObj = (POS_COOKIE) pAd->OS_Cookie;
/* Store BulkOut PipeId*/
BulkOutPipeId = pHTTXContext->BulkOutPipeId;
pAd->BulkOutDataOneSecCount++;
switch (BulkOutPipeId)
{
case EDCA_AC0_PIPE:
#ifdef RALINK_ATE
if (!ATE_ON(pAd))
{
#endif /* RALINK_ATE */
RTMP_NET_TASK_DATA_ASSIGN(&pObj->ac0_dma_done_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->ac0_dma_done_task);
#ifdef RALINK_ATE
}
else
{
RTMP_NET_TASK_DATA_ASSIGN(&pObj->ate_ac0_dma_done_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->ate_ac0_dma_done_task);
}
#endif /* RALINK_ATE */
break;
case EDCA_AC1_PIPE:
RTMP_NET_TASK_DATA_ASSIGN(&pObj->ac1_dma_done_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->ac1_dma_done_task);
break;
case EDCA_AC2_PIPE:
RTMP_NET_TASK_DATA_ASSIGN(&pObj->ac2_dma_done_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->ac2_dma_done_task);
break;
case EDCA_AC3_PIPE:
RTMP_NET_TASK_DATA_ASSIGN(&pObj->ac3_dma_done_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->ac3_dma_done_task);
break;
case HCCA_PIPE:
RTMP_NET_TASK_DATA_ASSIGN(&pObj->hcca_dma_done_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->hcca_dma_done_task);
break;
}
}
/*
========================================================================
Routine Description:
Arguments:
Return Value:
Note: NULL frame use BulkOutPipeId = 0
========================================================================
*/
VOID RTUSBBulkOutNullFrame(
IN PRTMP_ADAPTER pAd)
{
PTX_CONTEXT pNullContext = &(pAd->NullContext);
PURB pUrb;
int ret = 0;
unsigned long IrqFlags;
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags);
if ((pAd->BulkOutPending[0] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX))
{
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags);
return;
}
pAd->BulkOutPending[0] = TRUE;
pAd->watchDogTxPendingCnt[0] = 1;
pNullContext->IRPPending = TRUE;
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags);
/* Increase Total transmit byte counter*/
pAd->RalinkCounters.TransmittedByteCount += pNullContext->BulkOutSize;
/* Clear Null frame bulk flag*/
RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL);
#ifdef RT_BIG_ENDIAN
RTMPDescriptorEndianChange((PUCHAR)pNullContext->TransferBuffer, TYPE_TXINFO);
#endif /* RT_BIG_ENDIAN */
/* Init Tx context descriptor*/
RTUSBInitTxDesc(pAd, pNullContext, 0, (usb_complete_t)RtmpUsbBulkOutNullFrameComplete);
pUrb = pNullContext->pUrb;
if((ret = RTUSB_SUBMIT_URB(pUrb))!=0)
{
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags);
pAd->BulkOutPending[0] = FALSE;
pAd->watchDogTxPendingCnt[0] = 0;
pNullContext->IRPPending = FALSE;
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags);
DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutNullFrame: Submit Tx URB failed %d\n", ret));
return;
}
}
/* NULL frame use BulkOutPipeId = 0*/
USBHST_STATUS RTUSBBulkOutNullFrameComplete(URBCompleteStatus Status, purbb_t pURB, pregs *pt_regs)
{
PRTMP_ADAPTER pAd;
PTX_CONTEXT pNullContext;
NTSTATUS Status;
POS_COOKIE pObj;
pNullContext = (PTX_CONTEXT)RTMP_OS_USB_CONTEXT_GET(pURB);
pAd = pNullContext->pAd;
Status = RTMP_OS_USB_STATUS_GET(pURB); /*->rtusb_urb_status;*/
pObj = (POS_COOKIE) pAd->OS_Cookie;
RTMP_NET_TASK_DATA_ASSIGN(&pObj->null_frame_complete_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->null_frame_complete_task);
}
/*
========================================================================
Routine Description:
Arguments:
Return Value:
Note: MLME use BulkOutPipeId = 0
========================================================================
*/
VOID RTUSBBulkOutMLMEPacket(
IN PRTMP_ADAPTER pAd,
IN UCHAR Index)
{
PTX_CONTEXT pMLMEContext;
PURB pUrb;
int ret = 0;
unsigned long IrqFlags;
pMLMEContext = (PTX_CONTEXT)pAd->MgmtRing.Cell[pAd->MgmtRing.TxDmaIdx].AllocVa;
pUrb = pMLMEContext->pUrb;
if ((pAd->MgmtRing.TxSwFreeIdx >= MGMT_RING_SIZE) ||
(pMLMEContext->InUse == FALSE) ||
(pMLMEContext->bWaitingBulkOut == FALSE))
{
/* Clear MLME bulk flag*/
RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME);
return;
}
RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
if ((pAd->BulkOutPending[MGMTPIPEIDX] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX))
{
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
return;
}
pAd->BulkOutPending[MGMTPIPEIDX] = TRUE;
pAd->watchDogTxPendingCnt[MGMTPIPEIDX] = 1;
pMLMEContext->IRPPending = TRUE;
pMLMEContext->bWaitingBulkOut = FALSE;
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
/* Increase Total transmit byte counter*/
pAd->RalinkCounters.TransmittedByteCount += pMLMEContext->BulkOutSize;
/* Clear MLME bulk flag*/
RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_MLME);
#ifdef RT_BIG_ENDIAN
RTMPDescriptorEndianChange((PUCHAR)pMLMEContext->TransferBuffer, TYPE_TXINFO);
#endif /* RT_BIG_ENDIAN */
/* Init Tx context descriptor*/
RTUSBInitTxDesc(pAd, pMLMEContext, MGMTPIPEIDX, (usb_complete_t)RtmpUsbBulkOutMLMEPacketComplete);
RTUSB_URB_DMA_MAPPING(pUrb);
pUrb = pMLMEContext->pUrb;
if((ret = RTUSB_SUBMIT_URB(pUrb))!=0)
{
DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutMLMEPacket: Submit MLME URB failed %d\n", ret));
RTMP_IRQ_LOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
pAd->BulkOutPending[MGMTPIPEIDX] = FALSE;
pAd->watchDogTxPendingCnt[MGMTPIPEIDX] = 0;
pMLMEContext->IRPPending = FALSE;
pMLMEContext->bWaitingBulkOut = TRUE;
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[MGMTPIPEIDX], IrqFlags);
return;
}
}
USBHST_STATUS RTUSBBulkOutMLMEPacketComplete(URBCompleteStatus Status, purbb_t pURB, pregs *pt_regs)
{
PTX_CONTEXT pMLMEContext;
PRTMP_ADAPTER pAd;
NTSTATUS Status;
POS_COOKIE pObj;
int index;
pMLMEContext = (PTX_CONTEXT)RTMP_OS_USB_CONTEXT_GET(pURB);
pAd = pMLMEContext->pAd;
pObj = (POS_COOKIE)pAd->OS_Cookie;
Status = RTMP_OS_USB_STATUS_GET(pURB);
index = pMLMEContext->SelfIdx;
RTMP_NET_TASK_DATA_ASSIGN(&pObj->mgmt_dma_done_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->mgmt_dma_done_task);
}
/*
========================================================================
Routine Description:
Arguments:
Return Value:
Note: PsPoll use BulkOutPipeId = 0
========================================================================
*/
VOID RTUSBBulkOutPsPoll(
IN PRTMP_ADAPTER pAd)
{
PTX_CONTEXT pPsPollContext = &(pAd->PsPollContext);
PURB pUrb;
int ret = 0;
unsigned long IrqFlags;
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags);
if ((pAd->BulkOutPending[0] == TRUE) || RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NEED_STOP_TX))
{
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags);
return;
}
pAd->BulkOutPending[0] = TRUE;
pAd->watchDogTxPendingCnt[0] = 1;
pPsPollContext->IRPPending = TRUE;
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags);
/* Clear PS-Poll bulk flag*/
RTUSB_CLEAR_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL);
#ifdef RT_BIG_ENDIAN
RTMPDescriptorEndianChange((PUCHAR)pPsPollContext->TransferBuffer, TYPE_TXINFO);
#endif /* RT_BIG_ENDIAN */
/* Init Tx context descriptor*/
RTUSBInitTxDesc(pAd, pPsPollContext, MGMTPIPEIDX, (usb_complete_t)RtmpUsbBulkOutPsPollComplete);
pUrb = pPsPollContext->pUrb;
if((ret = RTUSB_SUBMIT_URB(pUrb))!=0)
{
RTMP_IRQ_LOCK(&pAd->BulkOutLock[0], IrqFlags);
pAd->BulkOutPending[0] = FALSE;
pAd->watchDogTxPendingCnt[0] = 0;
pPsPollContext->IRPPending = FALSE;
RTMP_IRQ_UNLOCK(&pAd->BulkOutLock[0], IrqFlags);
DBGPRINT(RT_DEBUG_ERROR, ("RTUSBBulkOutPsPoll: Submit Tx URB failed %d\n", ret));
return;
}
}
/* PS-Poll frame use BulkOutPipeId = 0*/
USBHST_STATUS RTUSBBulkOutPsPollComplete(URBCompleteStatus Status, purbb_t pURB, pregs *pt_regs)
{
PRTMP_ADAPTER pAd;
PTX_CONTEXT pPsPollContext;
NTSTATUS Status;
POS_COOKIE pObj;
pPsPollContext= (PTX_CONTEXT)RTMP_OS_USB_CONTEXT_GET(pURB);
pAd = pPsPollContext->pAd;
Status = RTMP_OS_USB_STATUS_GET(pURB);
pObj = (POS_COOKIE) pAd->OS_Cookie;
RTMP_NET_TASK_DATA_ASSIGN(&pObj->pspoll_frame_complete_task, (unsigned long)pURB);
RTMP_OS_TASKLET_SCHE(&pObj->pspoll_frame_complete_task);
}
VOID DoBulkIn(IN RTMP_ADAPTER *pAd)
{
PRX_CONTEXT pRxContext;
PURB pUrb;
int ret = 0;
unsigned long IrqFlags;