Protocol Packet Allocation

Hi,

I’m working on a de-serialized driver and I’m facing some problems with the packets passed down by NDIS.

It is assumed that in a deserialized driver the driver has to maintain an internal queue for the pending packets.

What I’m seeing here is that ( I assume the Protocol is allocating the packets and sending it down ) when I receive the packets from NDIS I queue them internally. But when I try and reference them later on to transmit them ( say in the next batch of packets ) I am seeing that the pointer to the packets are corrupted and they are pointing to values such as 0x1 and 0x5. Because of this I’m getting a panic which says that I’m trying to access Paged memory at a high IRQL.

Are the packets that are passed down to the driver allocated on the stack (prototol stack) ?
and do I have to allocate another packet and copy the packet sent down to the driver and then queue it?
Is there any way that I can queue these packets and then access them afterwards?

Thanx
Ramit.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Normally, there is no problem with queuing packets in deserialized driver.
Check if you’re returning pending status for every queued packet. Protocol
must not touch pending packets sent down until NdisMSendComplete() is
called.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: Ramit Bhalla[SMTP:xxxxx@wipro.com]
Reply To: NT Developers Interest List
Sent: Wednesday, December 13, 2000 11:21 AM
To: NT Developers Interest List
Subject: [ntdev] Protocol Packet Allocation

Hi,

I’m working on a de-serialized driver and I’m facing some problems with
the packets passed down by NDIS.

It is assumed that in a deserialized driver the driver has to maintain an
internal queue for the pending packets.

What I’m seeing here is that ( I assume the Protocol is allocating the
packets and sending it down ) when I receive the packets from NDIS I queue
them internally. But when I try and reference them later on to transmit
them ( say in the next batch of packets ) I am seeing that the pointer to
the packets are corrupted and they are pointing to values such as 0x1 and
0x5. Because of this I’m getting a panic which says that I’m trying to
access Paged memory at a high IRQL.

Are the packets that are passed down to the driver allocated on the stack
(prototol stack) ?
and do I have to allocate another packet and copy the packet sent down to
the driver and then queue it?
Is there any way that I can queue these packets and then access them
afterwards?

Thanx
Ramit.

You are currently subscribed to ntdev as: xxxxx@rkk.cz
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,

I’m not setting the packet status to anything ( I don’t think that in a deserialized driver the upper layers check this according to the documentation it totally for personal use ) and I had even tried this strategy, but it didn’t work.

I’m also seeing one thing - I’m getting 2 sends simultaneously

The 1st send acquires the lock and manipulates the list and queues the packets sent. Just after it releases the lock the context changes and the 2nd send starts manipulating the list and starts queueing the new packets, but for doing this I need to access the packets queued by the 1st send.
When I try and access the packets queued by the first send, it panics or hangs, from debug messgaes and by using the debugger I find that the pointer to the packets are either corrupted( then it panics) otherwise If I debug step by step then it does not get corrupted but it hangs when I try and access the packets queued by the 1st send from the 2nd send’s context.

Anybody has any idea as to why this might be happening and is it possible to access the packets queued in the 1st (NDIS)send in the another (NDIS)send context ??

Thanx a lot,
Regards
Ramit.
----- Original Message -----
From: Vodicka, Michal
To: NT Developers Interest List
Sent: Thursday, December 14, 2000 3:04 AM
Subject: [ntdev] RE: Protocol Packet Allocation

Normally, there is no problem with queuing packets in deserialized driver.
Check if you’re returning pending status for every queued packet. Protocol
must not touch pending packets sent down until NdisMSendComplete() is
called.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


> From: Ramit Bhalla[SMTP:xxxxx@wipro.com]
> Reply To: NT Developers Interest List
> Sent: Wednesday, December 13, 2000 11:21 AM
> To: NT Developers Interest List
> Subject: [ntdev] Protocol Packet Allocation
>
> Hi,
>
> I’m working on a de-serialized driver and I’m facing some problems with
> the packets passed down by NDIS.
>
> It is assumed that in a deserialized driver the driver has to maintain an
> internal queue for the pending packets.
>
> What I’m seeing here is that ( I assume the Protocol is allocating the
> packets and sending it down ) when I receive the packets from NDIS I queue
> them internally. But when I try and reference them later on to transmit
> them ( say in the next batch of packets ) I am seeing that the pointer to
> the packets are corrupted and they are pointing to values such as 0x1 and
> 0x5. Because of this I’m getting a panic which says that I’m trying to
> access Paged memory at a high IRQL.
>
> Are the packets that are passed down to the driver allocated on the stack
> (prototol stack) ?
> and do I have to allocate another packet and copy the packet sent down to
> the driver and then queue it?
> Is there any way that I can queue these packets and then access them
> afterwards?
>
> Thanx
> Ramit.
> —
> You are currently subscribed to ntdev as: xxxxx@rkk.cz
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> ----------

From: Ramit Bhalla[SMTP:xxxxx@wipro.com]
Reply To: NT Developers Interest List
Sent: Thursday, December 14, 2000 07:37
To: NT Developers Interest List
Subject: [ntdev] RE: Protocol Packet Allocation

Hi,

I’m not setting the packet status to anything ( I don’t think that in a
deserialized driver the upper layers check this according to the
documentation it totally for personal use ) and I had even tried this
strategy, but it didn’t work.

I meant status returned from you MiniportSend() handler.

I’m also seeing one thing - I’m getting 2 sends simultaneously

It is possible for deserialized drivers especially on SMP machines.

The 1st send acquires the lock and manipulates the list and queues the
packets sent. Just after it releases the lock the context changes and the
2nd send starts manipulating the list and starts queueing the new packets,
but for doing this I need to access the packets queued by the 1st send.
When I try and access the packets queued by the first send, it panics or
hangs, from debug messgaes and by using the debugger I find that the
pointer to the packets are either corrupted( then it panics) otherwise If
I debug step by step then it does not get corrupted but it hangs when I
try and access the packets queued by the 1st send from the 2nd send’s
context.

Seems as a bug somewhere in your code. You can try to use memory breakpoint
to see where is memory rewritten. BTW, which part of packet do you use for
queuing i.e. where do you store pointer to the next packet? MiniportReserved
should be used for this purpose.

Anybody has any idea as to why this might be happening and is it possible
to access the packets queued in the 1st (NDIS)send in the another
(NDIS)send context ??

It is really possible to queue sent packets. At least it works in my driver
with no problem even when more sends occur at once :slight_smile:

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> ----------

From: Ramit Bhalla[SMTP:xxxxx@wipro.com]
Reply To: NT Developers Interest List
Sent: Thursday, December 14, 2000 07:37
To: NT Developers Interest List
Subject: [ntdev] RE: Protocol Packet Allocation

Anybody has any idea as to why this might be happening and is it possible
to access the packets queued in the 1st (NDIS)send in the another
(NDIS)send context ??
I forgot: packets are allocated from non paged pool and can be accessed from
any context. There is no “send context”, assume that MiniportSend() is
called in an arbitrary thread context.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi Michal,
Thanx for the help, but i’m still facing the problem.

I’ve done some more testing and I’ve found this (i’ve used breakpoints also) :

The pointer to the packet that I queue shifts between the time that i queue and the next time I access the queue ( that is in the next send i get ).

The time it takes for this pointer value to change is dependent upon the protocol that I use, if I ues TCP/IP it changes almost immidately after I exit the send routine. With NetBEUI it takes some 2-3 sends after which I find that the value changes.

With HCT it changes consistently by shifting to +0xB0 everytime.

With WinME this problem doesn’t seem to be there.

Anybody has ANY idea as to why the pointer to the packet passed down is changing by itself and why the time it takes to change depends upon the upper protocol ?? ( i’m not manipulating the pointer to the packet, just queueing it ).

I’ll be grateful for any help whatsoever.

Thanx
Ramit.
----- Original Message -----
From: Vodicka, Michal
To: NT Developers Interest List
Sent: Friday, December 15, 2000 2:44 AM
Subject: [ntdev] RE: Protocol Packet Allocation


> From: Ramit Bhalla[SMTP:xxxxx@wipro.com]
> Reply To: NT Developers Interest List
> Sent: Thursday, December 14, 2000 07:37
> To: NT Developers Interest List
> Subject: [ntdev] RE: Protocol Packet Allocation
>
> Hi,
>
> I’m not setting the packet status to anything ( I don’t think that in a
> deserialized driver the upper layers check this according to the
> documentation it totally for personal use ) and I had even tried this
> strategy, but it didn’t work.
>
I meant status returned from you MiniportSend() handler.
>
> I’m also seeing one thing - I’m getting 2 sends simultaneously
>
It is possible for deserialized drivers especially on SMP machines.
>
> The 1st send acquires the lock and manipulates the list and queues the
> packets sent. Just after it releases the lock the context changes and the
> 2nd send starts manipulating the list and starts queueing the new packets,
> but for doing this I need to access the packets queued by the 1st send.
> When I try and access the packets queued by the first send, it panics or
> hangs, from debug messgaes and by using the debugger I find that the
> pointer to the packets are either corrupted( then it panics) otherwise If
> I debug step by step then it does not get corrupted but it hangs when I
> try and access the packets queued by the 1st send from the 2nd send’s
> context.
>
Seems as a bug somewhere in your code. You can try to use memory breakpoint
to see where is memory rewritten. BTW, which part of packet do you use for
queuing i.e. where do you store pointer to the next packet? MiniportReserved
should be used for this purpose.
>
> Anybody has any idea as to why this might be happening and is it possible
> to access the packets queued in the 1st (NDIS)send in the another
> (NDIS)send context ??
>
It is really possible to queue sent packets. At least it works in my driver
with no problem even when more sends occur at once :slight_smile:

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> ----------

From: Ramit Bhalla[SMTP:xxxxx@wipro.com]
Reply To: NT Developers Interest List
Sent: Friday, December 15, 2000 5:27 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Protocol Packet Allocation

Anybody has ANY idea as to why the pointer to the packet passed down is
changing by itself and why the time it takes to change depends upon the
upper protocol ?? ( i’m not manipulating the pointer to the packet, just
queueing it ).

I’m sorry if my assumption is wrong but from above description it seems
you’re storing the parameter passed to your MiniportSend() handler. Maybe
you should post part of your code used for queuing to make things clear. If
you’re really doing this, the problem is obvious. Function parameters are
stored on the stack and are valid only during function call (as local
variables). NDIS packet itself is permanent (until completed) but the stack
variable containing its address isn’t.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com