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
|
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.
Module Name:
nic_send.c
Abstract:
This module contains routines to write packets.
Environment:
Kernel mode
--*/
#include "precomp.h"
#if defined(EVENT_TRACING)
#include "nic_send.tmh"
#endif
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
_Requires_lock_held_(FdoData->SendLock)
__inline
VOID
MP_FREE_SEND_PACKET(
IN PFDO_DATA FdoData,
IN PMP_TCB pMpTcb,
IN NTSTATUS Status
)
/*++
Routine Description:
Recycle a MP_TCB and complete the packet if necessary
Assumption: This function is called with the Send SPINLOCK held.
Arguments:
FdoData Pointer to our FdoData
pMpTcb Pointer to MP_TCB
Return Value:
None
--*/
{
WDFREQUEST request;
WDFDMATRANSACTION dmaTransaction;
size_t length;
ASSERT(MP_TEST_FLAG(pMpTcb, fMP_TCB_IN_USE));
dmaTransaction = pMpTcb->DmaTransaction;
pMpTcb->DmaTransaction = NULL;
MP_CLEAR_FLAGS(pMpTcb);
FdoData->CurrSendHead = FdoData->CurrSendHead->Next;
FdoData->nBusySend--;
request = WdfDmaTransactionGetRequest(dmaTransaction);
length = WdfDmaTransactionGetBytesTransferred(dmaTransaction);
WdfObjectDelete( dmaTransaction );
if (request)
{
WdfSpinLockRelease(FdoData->SendLock);
WdfRequestCompleteWithInformation(request, Status, length);
FdoData->BytesTransmitted += length;
WdfSpinLockAcquire(FdoData->SendLock);
}
}
VOID
PciDrvEvtIoWrite(
IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t Length
)
/*++
Routine Description:
Called by the framework as soon as it receive a write IRP.
If the device is not ready, fail the request. Otherwise
get scatter-gather list for this request and send the
packet to the hardware for DMA.
Arguments:
Queue - Handle to the framework queue object that is associated
with the I/O request.
Request - Handle to a framework request object.
Length - Length of the IO operation
The default property of the queue is to not dispatch
zero lenght read & write requests to the driver and
complete is with status success. So we will never get
a zero length request.
Return Value:
--*/
{
NTSTATUS status;
PFDO_DATA FdoData;
WDFDEVICE hDevice;
PMDL mdl = NULL;
UNREFERENCED_PARAMETER(Length);
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"--> PciDrvEvtIoWrite Request %p\n", Request);
hDevice = WdfIoQueueGetDevice(Queue);
FdoData = FdoGetData(hDevice);
status = WdfRequestRetrieveInputWdmMdl(Request, &mdl);
if (!NT_SUCCESS(status))
{
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"WdfRequestRetrieveInputWdmMdl failed %x\n", status);
WdfRequestCompleteWithInformation(Request, status, 0);
} else {
status = NICInitiateDmaTransfer(FdoData, Request);
if(!NT_SUCCESS(status)) {
WdfRequestCompleteWithInformation(Request, status, 0);
}
}
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"<-- PciDrvEvtIoWrite %X\n", status);
return;
}
NTSTATUS
NICInitiateDmaTransfer(
IN PFDO_DATA FdoData,
IN WDFREQUEST Request
)
{
WDFDMATRANSACTION dmaTransaction;
NTSTATUS status;
BOOLEAN bCreated = FALSE;
do {
//
// Create a new DmaTransaction.
//
status = WdfDmaTransactionCreate( FdoData->WdfDmaEnabler,
WDF_NO_OBJECT_ATTRIBUTES,
&dmaTransaction );
if(!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"WdfDmaTransactionCreate failed %X\n", status);
break;
}
bCreated = TRUE;
//
// Initialize the new DmaTransaction.
//
status = WdfDmaTransactionInitializeUsingRequest(
dmaTransaction,
Request,
NICEvtProgramDmaFunction,
WdfDmaDirectionWriteToDevice );
if(!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"WdfDmaTransactionInitalizeUsingRequest failed %X\n",
status);
break;
}
//
// Execute this DmaTransaction.
//
status = WdfDmaTransactionExecute( dmaTransaction,
dmaTransaction );
if(!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"WdfDmaTransactionExecute failed %X\n", status);
break;
}
} WHILE (FALSE);
if(!NT_SUCCESS(status)){
if(bCreated) {
WdfObjectDelete( dmaTransaction );
}
}
return status;
}
BOOLEAN
NICEvtProgramDmaFunction(
IN WDFDMATRANSACTION Transaction,
IN WDFDEVICE Device,
IN PVOID Context,
IN WDF_DMA_DIRECTION Direction,
IN PSCATTER_GATHER_LIST ScatterGather
)
/*++
Routine Description:
Arguments:
Return Value:
--*/
{
PFDO_DATA fdoData;
WDFREQUEST request;
NTSTATUS status;
UNREFERENCED_PARAMETER( Context );
UNREFERENCED_PARAMETER( Direction );
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"--> NICEvtProgramDmaFunction\n");
fdoData = FdoGetData(Device);
request = WdfDmaTransactionGetRequest(Transaction);
WdfSpinLockAcquire(fdoData->SendLock);
//
// If tcb or link is not available, queue the request
//
if (!MP_TCB_RESOURCES_AVAIABLE(fdoData) ||
MP_TEST_FLAG(fdoData, fMP_ADAPTER_LINK_DETECTION))
{
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"Resource is not available: queue Request %p\n", request);
//
// Must abort the transaction before deleting.
//
(VOID) WdfDmaTransactionDmaCompletedFinal(Transaction, 0, &status);
ASSERT(NT_SUCCESS(status));
WdfObjectDelete( Transaction );
//
// Queue the request for later processing.
//
status = WdfRequestForwardToIoQueue(request,
fdoData->PendingWriteQueue);
if(!NT_SUCCESS(status)) {
ASSERTMSG(" WdfRequestForwardToIoQueue failed ", FALSE);
WdfSpinLockRelease(fdoData->SendLock);
WdfRequestCompleteWithInformation(request, STATUS_UNSUCCESSFUL, 0);
return FALSE;
}
fdoData->nWaitSend++;
} else {
status = NICWritePacket(fdoData, Transaction, ScatterGather);
if(!NT_SUCCESS(status)){
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"<-- NICEvtProgramDmaFunction returning %!STATUS!\n",
status);
//
// Must abort the transaction before deleting.
//
(VOID )WdfDmaTransactionDmaCompletedFinal(Transaction, 0, &status);
ASSERT(NT_SUCCESS(status));
WdfObjectDelete( Transaction );
WdfSpinLockRelease(fdoData->SendLock);
WdfRequestCompleteWithInformation(request, STATUS_UNSUCCESSFUL, 0);
return FALSE;
}
}
WdfSpinLockRelease(fdoData->SendLock);
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"<-- NICEvtProgramDmaFunction\n");
return TRUE;
}
NTSTATUS
NICWritePacket(
IN PFDO_DATA FdoData,
IN WDFDMATRANSACTION DmaTransaction,
IN PSCATTER_GATHER_LIST SGList
)
/*++
Routine Description:
Do the work to send a packet
Assumption: This function is called with the Send SPINLOCK held.
Arguments:
FdoData Pointer to our FdoData
Return Value:
--*/
{
PMP_TCB pMpTcb = NULL;
NTSTATUS status;
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"--> NICWritePacket: SGList %p\n", SGList);
//
// Initialize the Transfer Control Block.
//
pMpTcb = FdoData->CurrSendTail;
ASSERT(!MP_TEST_FLAG(pMpTcb, fMP_TCB_IN_USE));
pMpTcb->DmaTransaction = DmaTransaction;
MP_SET_FLAG(pMpTcb, fMP_TCB_IN_USE);
//
// Call the send handler, it only needs to deal with the ScatterGather list
//
status = NICSendPacket(FdoData, pMpTcb, SGList);
if(!NT_SUCCESS(status)){
MP_CLEAR_FLAG(pMpTcb, fMP_TCB_IN_USE);
return status;
}
FdoData->nBusySend++;
ASSERT(FdoData->nBusySend <= FdoData->NumTcb);
FdoData->CurrSendTail = FdoData->CurrSendTail->Next;
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE, "<-- NICWritePacket\n");
return status;
}
NTSTATUS
NICSendPacket(
IN PFDO_DATA FdoData,
IN PMP_TCB pMpTcb,
IN PSCATTER_GATHER_LIST ScatterGather
)
/*++
Routine Description:
NIC specific send handler
Assumption: This function is called with the Send SPINLOCK held.
Arguments:
FdoData Pointer to our FdoData
pMpTcb Pointer to MP_TCB
ScatterGather The pointer to the frag list to be filled
Return Value:
NTSTATUS code
--*/
{
NTSTATUS status;
ULONG index;
UCHAR TbdCount = 0;
PHW_TCB pHwTcb = pMpTcb->HwTcb;
PTBD_STRUC pHwTbd = pMpTcb->HwTbd;
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE, "--> NICSendPacket\n");
for (index = 0; index < ScatterGather->NumberOfElements; index++)
{
if (ScatterGather->Elements[index].Length)
{
pHwTbd->TbdBufferAddress =
ScatterGather->Elements[index].Address.LowPart;
pHwTbd->TbdCount = ScatterGather->Elements[index].Length;
pHwTbd++;
TbdCount++;
}
}
pHwTcb->TxCbHeader.CbStatus = 0;
pHwTcb->TxCbHeader.CbCommand = CB_S_BIT | CB_TRANSMIT | CB_TX_SF_BIT;
pHwTcb->TxCbTbdPointer = pMpTcb->HwTbdPhys;
pHwTcb->TxCbTbdNumber = TbdCount;
pHwTcb->TxCbCount = 0;
pHwTcb->TxCbThreshold = (UCHAR) FdoData->AiThreshold;
status = NICStartSend(FdoData, pMpTcb);
if(!NT_SUCCESS(status)){
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"NICStartSend returned error %x\n", status);
}
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE, "<-- NICSendPacket\n");
return status;
}
NTSTATUS
NICStartSend(
IN PFDO_DATA FdoData,
IN PMP_TCB pMpTcb
)
/*++
Routine Description:
Issue a send command to the NIC
Assumption: This function is called with the Send SPINLOCK held.
Arguments:
FdoData Pointer to our FdoData
pMpTcb Pointer to MP_TCB
Return Value:
NTSTATUS code
--*/
{
NTSTATUS status;
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE, "--> NICStartSend\n");
//
// If the transmit unit is idle (very first transmit) then we must
// setup the general pointer and issue a full CU-start
//
if (FdoData->TransmitIdle)
{
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"CU is idle -- First TCB added to Active List\n");
//
// Wait for the SCB to clear before we set the general pointer
//
if (!WaitScb(FdoData))
{
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"NICStartSend -- WaitScb returned error\n");
status = STATUS_DEVICE_DATA_ERROR;
goto exit;
}
//
// Don't try to start the transmitter if the command unit is not
// idle ((not idle) == (Cu-Suspended or Cu-Active)).
//
if ((FdoData->CSRAddress->ScbStatus & SCB_CUS_MASK) != SCB_CUS_IDLE)
{
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"FdoData = %p, CU Not IDLE\n", FdoData);
MP_SET_HARDWARE_ERROR(FdoData);
KeStallExecutionProcessor(25);
}
FdoData->CSRAddress->ScbGeneralPointer = pMpTcb->HwTcbPhys;
status = D100IssueScbCommand(FdoData, SCB_CUC_START, FALSE);
FdoData->TransmitIdle = FALSE;
FdoData->ResumeWait = TRUE;
}
else
{
//
// If the command unit has already been started, then append this
// TCB onto the end of the transmit chain, and issue a CU-Resume.
//
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"adding TCB to Active chain\n");
//
// Clear the suspend bit on the previous packet.
//
pMpTcb->PrevHwTcb->TxCbHeader.CbCommand &= ~CB_S_BIT;
//
// Issue a CU-Resume command to the device. We only need to do a
// WaitScb if the last command was NOT a RESUME.
//
status = D100IssueScbCommand(FdoData,
SCB_CUC_RESUME,
FdoData->ResumeWait);
}
exit:
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE, "<-- NICStartSend\n");
return status;
}
_Requires_lock_held_(FdoData->SendLock)
NTSTATUS
NICHandleSendInterrupt(
IN PFDO_DATA FdoData
)
/*++
Routine Description:
Interrupt handler for sending processing. Re-claim the send resources,
complete sends and get more to send from the send wait queue.
Assumption: This function is called with the Send SPINLOCK held.
Arguments:
FdoData Pointer to our FdoData
Return Value:
NTSTATUS code
--*/
{
NTSTATUS status = STATUS_SUCCESS;
PMP_TCB pMpTcb;
#if DBG
ULONG i;
#endif
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"--> NICHandleSendInterrupt\n");
//
// Any packets being sent? Any packet waiting in the send queue?
//
if (FdoData->nBusySend == 0)
{
ASSERT(FdoData->CurrSendHead == FdoData->CurrSendTail);
return status;
}
//
// Check the first TCB on the send list
//
while (FdoData->nBusySend > 0)
{
#if DBG
pMpTcb = FdoData->CurrSendHead;
for (i = 0; i < FdoData->nBusySend; i++)
{
pMpTcb = pMpTcb->Next;
}
if (pMpTcb != FdoData->CurrSendTail)
{
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"nBusySend= %d\n", FdoData->nBusySend);
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"CurrSendhead= %p\n", FdoData->CurrSendHead);
TraceEvents(TRACE_LEVEL_ERROR, DBG_WRITE,
"CurrSendTail= %p\n", FdoData->CurrSendTail);
ASSERT(FALSE);
}
#endif
pMpTcb = FdoData->CurrSendHead;
//
// Is this TCB completed?
//
if (pMpTcb->HwTcb->TxCbHeader.CbStatus & CB_STATUS_COMPLETE)
{
//
// Check if this is a multicast hw workaround packet
//
if ((pMpTcb->HwTcb->TxCbHeader.CbCommand & CB_CMD_MASK) != CB_MULTICAST)
{
BOOLEAN transactionComplete;
ASSERT(pMpTcb->DmaTransaction);
//
// Indicate this DMA operation has completed:
// This may drive the transfer on the next packet if
// there is still data to be transfered in the DmaTransaction.
//
transactionComplete =
WdfDmaTransactionDmaCompleted( pMpTcb->DmaTransaction,
&status );
if(transactionComplete == TRUE) {
ASSERT(status == STATUS_SUCCESS);
MP_FREE_SEND_PACKET(FdoData, pMpTcb, status);
} else {
//
// NOTE: For this ethernet driver this should never
// be returned as the packets are <= 1514 bytes.
// It is included to show the complete DmaTransaction
// coding pattern.
//
ASSERT(!"STATUS_MORE_PROCESSING_REQUIRED");
}
}
else
{
// Multicast workaround would be here (???)
}
}
else
{
break;
}
}
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"<-- NICHandleSendInterrupt\n");
return status;
}
VOID
NICCheckForQueuedSends(
IN PFDO_DATA FdoData
)
/*++
Routine Description:
Arguments:
FdoData Pointer to our FdoData
Return Value:
--*/
{
WDFREQUEST request;
WDFDMATRANSACTION dmaTransaction;
NTSTATUS status;
UNREFERENCED_PARAMETER( dmaTransaction );
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"--> NICCheckForQueuedSends\n");
//
// If we queued any transmits because we didn't have any TCBs earlier,
// dequeue and send those packets now, as long as we have free TCBs.
//
while (MP_TCB_RESOURCES_AVAIABLE(FdoData))
{
status = WdfIoQueueRetrieveNextRequest(
FdoData->PendingWriteQueue,
&request
);
if(!NT_SUCCESS(status) ) {
if(STATUS_NO_MORE_ENTRIES != status) {
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"WdfIoQueueRetrieveNextRequest failed %X\n", status);
}
break;
}
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"\t processing Request %p \n", request);
status = NICInitiateDmaTransfer(FdoData, request);
if(!NT_SUCCESS(status)) {
WdfRequestCompleteWithInformation(request, status, 0);
}
FdoData->nWaitSend--;
}
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"<-- NICCheckForQueuedSends\n");
}
_Requires_lock_held_(FdoData->SendLock)
VOID
NICFreeBusySendPackets(
IN PFDO_DATA FdoData
)
/*++
Routine Description:
Free and complete the stopped active sends
Assumption: This function is called with the Send SPINLOCK held.
Arguments:
FdoData Pointer to our FdoData
Return Value:
None
--*/
{
PMP_TCB pMpTcb;
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"--> NICFreeBusySendPackets\n");
//
// Any packets being sent? Check the first TCB on the send list
//
while (FdoData->nBusySend > 0)
{
pMpTcb = FdoData->CurrSendHead;
//
// Is this TCB completed?
//
if ((pMpTcb->HwTcb->TxCbHeader.CbCommand & CB_CMD_MASK) != CB_MULTICAST)
{
MP_FREE_SEND_PACKET(FdoData, pMpTcb, STATUS_SUCCESS);
}
else
{
break;
}
}
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"<-- NICFreeBusySendPackets\n");
}
_IRQL_requires_same_
_IRQL_requires_(DISPATCH_LEVEL)
_Requires_lock_held_(FdoData->SendLock)
VOID
NICFreeQueuedSendPackets(
IN PFDO_DATA FdoData
)
/*++
Routine Description:
Free and complete the pended sends on SendQueueHead
Assumption: This function is called with the Send SPINLOCK held.
Arguments:
FdoData Pointer to our FdoData
Return Value:
None
--*/
{
WDFREQUEST request;
NTSTATUS status = MP_GET_STATUS_FROM_FLAGS(FdoData);
if (STATUS_UNSUCCESSFUL == status) {
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"MP_GET_STATUS_FROM_FLAGS failed %x\n", status);
}
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"--> NICFreeQueuedSendPackets\n");
do {
status = WdfIoQueueRetrieveNextRequest(
FdoData->PendingWriteQueue,
&request
);
if(!NT_SUCCESS(status) ) {
if(STATUS_NO_MORE_ENTRIES != status){
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"WdfIoQueueRetrieveNextRequest failed %x\n", status);
}
break;
}
FdoData->nWaitSend--;
WdfSpinLockRelease(FdoData->SendLock);
WdfRequestCompleteWithInformation(request, status, 0);
WdfSpinLockAcquire(FdoData->SendLock);
} WHILE (TRUE);
TraceEvents(TRACE_LEVEL_VERBOSE, DBG_WRITE,
"<-- NICFreeQueuedSendPackets\n");
}
|