Hi,

My NDIS miniport driver is always crashing under heavy load when
SendComplete is being called. What does SendComplete do?

NDIS called SendPackets()

Within SendPackets, I call transmit which tries to post packets to the
hardware. If I cant, I call SendComplete wth STATUS_PENDING and throw
the pkt onto a queue, otherwise I call SendComplete with
STATUS_SUCCESS.

What am I missing here?

Please help!

Re: NDIS SendComplete- Please help! by Maxim

Maxim
Thu Mar 09 18:07:25 CST 2006

> Within SendPackets, I call transmit which tries to post packets to the
> hardware. If I cant, I call SendComplete wth STATUS_PENDING and throw
> the pkt onto a queue

This is a bad idea. In such a case, you must not call SendComplete from inside
Send. Just queue the packets and return STATUS_PENDING from Send.

SendComplete must be called later, with STATUS_SUCCESS, after the packet will
be consumed from the queue and actually transmitted.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: NDIS SendComplete- Please help! by odomae

odomae
Thu Mar 09 18:55:17 CST 2006

The problem I am seeing is, if I call SendComplete after I get the HW
interrupt(transmit done), I see that output queue length counter in
perfmon grow under load. Eventually traffic stops .
And, when I actually stop the traffic, that counter does not seem to go
back to zero?

How do I fix this?


Re: NDIS SendComplete- Please help! by Pavel

Pavel
Thu Mar 09 18:59:55 CST 2006

"odomae" <hemasreeram@gmail.com> wrote in message news:1141948847.564850.50390@j52g2000cwj.googlegroups.com...
> Hi,
>
> My NDIS miniport driver is always crashing under heavy load when
> SendComplete is being called. What does SendComplete do?

A good question :) Besides of, er... completing send, it can recursively
call back your SendPackets. Probably you didn't expect this.

Do as Maxim advices - first, queue all packets, then unqueue and push
into the hardware and/or complete.


Regards,
--PA



Re: NDIS SendComplete- Please help! by odomae

odomae
Thu Mar 09 20:42:07 CST 2006


void SendPackets(PacketArray, NumberOfPackets)
{
for (i=0; i<NumberOfPackets; i++)
queue.inserttail(PacketArray[i];

for (i=0; i<NumberOfPackets; i++)
Transmit();

}


And for the transmit function,
Transmit()
{
Allocate TCB();
if (tcb != NULL)
queue to hardware.

}

When hardware completes and I get an interrupt, I call TxComplete
TxComplete()
{

SendComplete();

}

Does this sound about right ? The current problem I have as I mentioned
before is that the output queue length in perfmon keeps increasing and
after a certain point, transmit stops.

Is this because I may not reporting SendComplete() for all packets that
I got from NDIS?

Pavel A. wrote:
> "odomae" <hemasreeram@gmail.com> wrote in message news:1141948847.564850.50390@j52g2000cwj.googlegroups.com...
> > Hi,
> >
> > My NDIS miniport driver is always crashing under heavy load when
> > SendComplete is being called. What does SendComplete do?
>
> A good question :) Besides of, er... completing send, it can recursively
> call back your SendPackets. Probably you didn't expect this.
>
> Do as Maxim advices - first, queue all packets, then unqueue and push
> into the hardware and/or complete.
>
>
> Regards,
> --PA


Re: NDIS SendComplete- Please help! by Pavel

Pavel
Sat Mar 11 16:17:01 CST 2006

Now this is certainly better, but think what happens if
Transmit() fails to allocate TCB? then the unsent packets
will stay and accumulate in the queue.
You can retry transmit in TxComplete. You'll need to sync accesses
to the queue (perhaps a spinlock).

Good luck,
--PA


"odomae" <hemasreeram@gmail.com> wrote in message news:1141958527.567732.23180@j33g2000cwa.googlegroups.com...
>
> void SendPackets(PacketArray, NumberOfPackets)
> {
> for (i=0; i<NumberOfPackets; i++)
> queue.inserttail(PacketArray[i];
>
> for (i=0; i<NumberOfPackets; i++)
> Transmit();
>
> }
>
>
> And for the transmit function,
> Transmit()
> {
> Allocate TCB();
> if (tcb != NULL)
> queue to hardware.
>
> }
>
> When hardware completes and I get an interrupt, I call TxComplete
> TxComplete()
> {
>
> SendComplete();
>
> }
>
> Does this sound about right ? The current problem I have as I mentioned
> before is that the output queue length in perfmon keeps increasing and
> after a certain point, transmit stops.
>
> Is this because I may not reporting SendComplete() for all packets that
> I got from NDIS?
>
> Pavel A. wrote:
>> "odomae" <hemasreeram@gmail.com> wrote in message news:1141948847.564850.50390@j52g2000cwj.googlegroups.com...
>> > Hi,
>> >
>> > My NDIS miniport driver is always crashing under heavy load when
>> > SendComplete is being called. What does SendComplete do?
>>
>> A good question :) Besides of, er... completing send, it can recursively
>> call back your SendPackets. Probably you didn't expect this.
>>
>> Do as Maxim advices - first, queue all packets, then unqueue and push
>> into the hardware and/or complete.
>>
>>
>> Regards,
>> --PA
>