From: miki on
Hi

I am writing an NDIS6 miniport driver and I have a question:

I indicate NBL to NDIS using NdisMIndicateReceiveNetBufferLists. Those
NBL are allocated
using NdisAllocateNetBufferAndNetBufferList (i.e. each NBL is paired
with a single NB).
Each NB has a single MDL (which I allocated seperately using
NdisAllocateMdl).

When Ndis return the NBL to me (in MiniportReturnNetBufferLists) I
notice that the NB containes now more than a single MDL (the original
MDL is chained to another MDL).

1. Is that Normal ? i.e. can Ndis and above protocols can add MDLs to
the NB after
I indicate an NBL?

2. Should I release the new MDLs (which I did not allocated)?

3. Is it possible that Ndis will remove my original MDLs from the NB?
In that case I guess
that Ndis is also responsible for freeing it right?


Thanks
Miki

From: Alireza Dabagh [MS] on
This is not normal. What do you have installed in this system? IM drivers?
lightweight filters? protocols?
Have you set up your MDL and NB fields such as DataOffset and DataLength
properly? Are these fields (NB->DataOffset and NB->DataLength) back to their
original value when the call returns. Is the only problem MDL->Next field
not being NULL after the call returns?

-ali

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"miki" <michael.waksman(a)gmail.com> wrote in message
news:1167047941.868125.233260(a)73g2000cwn.googlegroups.com...
> Hi
>
> I am writing an NDIS6 miniport driver and I have a question:
>
> I indicate NBL to NDIS using NdisMIndicateReceiveNetBufferLists. Those
> NBL are allocated
> using NdisAllocateNetBufferAndNetBufferList (i.e. each NBL is paired
> with a single NB).
> Each NB has a single MDL (which I allocated seperately using
> NdisAllocateMdl).
>
> When Ndis return the NBL to me (in MiniportReturnNetBufferLists) I
> notice that the NB containes now more than a single MDL (the original
> MDL is chained to another MDL).
>
> 1. Is that Normal ? i.e. can Ndis and above protocols can add MDLs to
> the NB after
> I indicate an NBL?
>
> 2. Should I release the new MDLs (which I did not allocated)?
>
> 3. Is it possible that Ndis will remove my original MDLs from the NB?
> In that case I guess
> that Ndis is also responsible for freeing it right?
>
>
> Thanks
> Miki
>


From: Pavel A. on
The docum on MiniportReturnNetBufferLists says that caller can pass a linked
list of NET_BUFFER_LIST's from multiple previous calls to
NdisMIndicateReceiveNetBufferLists.

So, should MiniportReturnNetBufferLists loop over the list and free each
element?

Regards,
--PA
From: Alireza Dabagh [MS] on
Pavel, his question was on having multiple MDLs on the same NB by the time
the call returns even though he indicated only one NBL. If you meant to ask
if NDIS or an upper layer driver can coalesce multiple MDLs from different
NBs (and NBLs) into one before returning the call, it does not.

And yes, when a driver gets a chain of NBLs in MiniportReturnNetBufferLists,
it should loop through them and return them back to its own list of free
NBLs (most common miniport implementations do not call NDIS to allocate/free
on every IndicateReceiveNbl/ReturnNbl because it is cheaper to do it on its
own list).

-thanks, ali

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Pavel A." <pavel_a(a)NOwritemeNO.com> wrote in message
news:9F30777E-3F88-4521-8A86-D4664D7128BE(a)microsoft.com...
> The docum on MiniportReturnNetBufferLists says that caller can pass a
> linked
> list of NET_BUFFER_LIST's from multiple previous calls to
> NdisMIndicateReceiveNetBufferLists.
>
> So, should MiniportReturnNetBufferLists loop over the list and free each
> element?
>
> Regards,
> --PA


From: miki on
Thanks Ali,

Sorry, it was a false alarm.
After your answer that this is not a normal behaviour I rechecked my
code
and found a bug on it, after I fixed it the problem disappeared.

Thanks
Miki


Alireza Dabagh [MS] wrote:
> Pavel, his question was on having multiple MDLs on the same NB by the time
> the call returns even though he indicated only one NBL. If you meant to ask
> if NDIS or an upper layer driver can coalesce multiple MDLs from different
> NBs (and NBLs) into one before returning the call, it does not.
>
> And yes, when a driver gets a chain of NBLs in MiniportReturnNetBufferLists,
> it should loop through them and return them back to its own list of free
> NBLs (most common miniport implementations do not call NDIS to allocate/free
> on every IndicateReceiveNbl/ReturnNbl because it is cheaper to do it on its
> own list).
>
> -thanks, ali
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Pavel A." <pavel_a(a)NOwritemeNO.com> wrote in message
> news:9F30777E-3F88-4521-8A86-D4664D7128BE(a)microsoft.com...
> > The docum on MiniportReturnNetBufferLists says that caller can pass a
> > linked
> > list of NET_BUFFER_LIST's from multiple previous calls to
> > NdisMIndicateReceiveNetBufferLists.
> >
> > So, should MiniportReturnNetBufferLists loop over the list and free each
> > element?
> >
> > Regards,
> > --PA