My question is can we create a single MDL using chunks of another MDL.
we need this to optimise the performance of our driver. Copying the data to different buffer is taking considerable amount of time.
We get one Single large mdl from the top driver. What we need to do is pick up chunks of data which are spread across the original data from top driver, copy it into one contiguous buffer and then send it down.
This approach is taking lot of time because the size of the data is big.
We thought if there is a way using which we can Create a Single MDL from the Original MDL, using the chunks of data across it, that will save us lot of time copying data.
any suggestions are welcome.
Thanks
> We get one Single large mdl from the top driver. What we need to do is pick up chunks of data which
IoBuildPartialMdl helps a lot.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
>
> We get one Single large mdl from the top driver. What we need to do is
pick up chunks of data which
IoBuildPartialMdl helps a lot.
Using IoBuildPartialMdl i can create a MDL specifying only a particular
range of bytes in original MDL. So, i will end up creating multiple MDL’s
and multiple IRP to associate with each MDL. So, i thought if there is a way
i can create a single MDL using multiple buffers in the original MDL, then i
need not create multiple MDLs and multiple IRPs.
I tried creating multiple MDLs from the originall MDL and connect them using
mdl->next and form a MDL chain and then associated the Master(first) MDL
with a IRP. But, i need to send the IRP down to disk.sys and disk.sys
doesn’t seem to support MDL chains.
> > We get one Single large mdl from the top driver. What we need
to do is
pick up chunks of data which
IoBuildPartialMdl helps a lot.
Using IoBuildPartialMdl i can create a MDL specifying only a
particular range
of bytes in original MDL. So, i will end up creating multiple MDL’s
and
multiple IRP to associate with each MDL. So, i thought if there is a
way i can
create a single MDL using multiple buffers in the original MDL, then i
need
not create multiple MDLs and multiple IRPs.
I tried creating multiple MDLs from the originall MDL and connect them
using
mdl->next and form a MDL chain and then associated the Master(first)
MDL with
a IRP. But, i need to send the IRP down to disk.sys and disk.sys
doesn’t seem
to support MDL chains.
In an MDL, you can’t have part of a page except for the first and last
page. Do you know if all the MDL’s you want to join together fit this
requirement?
I asked about doing this a while back - I wanted to create an MDL from a
bunch of previously allocated pages - and the answer was no do it
another way.
James
> In an MDL, you can’t have part of a page except for the first and last page. Do you know if all
the MDL’s you want to join together fit this requirement?
True, but still you can work around it exactly the same way NDIS does, i.e. set up a linked list that link
MDLs that are, from MM’s perspective, totally unrelated. Look at how NDIS_PACKET composes separate
NDIS_BUFFERs into a single packet, and keep in mind that NDIS_BUFFER is just a typedef for MDL.
Judging from the OP’s presentation of a problem he is in exactly the same position network stack is, i.e. he wants to avoid copying data. Therefore, I think he may want to approach it the way NDIS does…
Anton Bassov
>
> In an MDL, you can’t have part of a page except for the first and
last page.
Do you know if all
> the MDL’s you want to join together fit this requirement?
True, but still you can work around it exactly the same way NDIS does,
i.e.
set up a linked list that link
MDLs that are, from MM’s perspective, totally unrelated. Look at how
NDIS_PACKET composes separate
NDIS_BUFFERs into a single packet, and keep in mind that NDIS_BUFFER
is just a
typedef for MDL.
Judging from the OP’s presentation of a problem he is in exactly the
same
position network stack is, i.e. he wants to avoid copying data.
Therefore, I
think he may want to approach it the way NDIS does…
The OP also said that whatever is consuming the MDL (disk.sys?) didn’t
support chained MDL’s.
James