Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Low DMA speed of data sending

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hello ,
i am trying to send very big files of MBs through DMA , i begin from
application till DMA Driver and use DeviceioControl function with input
size data = 32kb .

for example if i want to send file of 1 mb , i divide it into several
packets of each = 32kb and for each packet i send it via deviceiocontrol
function.

Myquestion is , is there a better approach since i am getting very bad
performance data rate ?
how would you send such big file to DMA in such case ?


pseudo code is :

for (each packet of 32kb in our big file)

{
DeviceIOControl (hdmadevice , IOCode , myPacket which is 32kb
,........)

}
Thanks

--
Mohamed Abdel Rauof.
communication and electronics Engineer Cairo University BSc. 2011.

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,851
    First question: Why use such small packets? Why not send 1MB at a time?

    Peter
    OSR
    @OSRDrivers

    Peter Viscarola
    OSR
    @OSRDrivers

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    HW limitation at reciever driver

    On Feb 6, 2017 1:26 AM, wrote:

    First question: Why use such small packets? Why not send 1MB at a time?

    Peter
    OSR
    @OSRDrivers


    ---
    NTDEV is sponsored by OSR

    Visit the list online at:

    MONTHLY seminars on crash dump analysis, WDF, Windows internals and
    software drivers!
    Details at

    To unsubscribe, visit the List Server section of OSR Online at <
    http://www.osronline.com/page.cfm?name=ListServer&gt;
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,450
    On Feb 5, 2017, at 8:07 PM, mohamed rauof <[email protected]> wrote:
    >
    > HW limitation at reciever driver

    Still, you can send the 1MB in one DeviceIoControl call and chop it up in kernel. That way, it only gets locked and mapped once.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    but i heard that maximum buffer size of one deviceIOControl request buffer
    is depending on page of memory which is several KBs , i am not sure of that
    . are there any refrances for that info ?
    @Tim Roberts , thanks alot for your appreciated help !

    On Mon, Feb 6, 2017 at 7:51 AM, Tim Roberts wrote:

    > On Feb 5, 2017, at 8:07 PM, mohamed rauof
    > wrote:
    > >
    > > HW limitation at reciever driver
    >
    > Still, you can send the 1MB in one DeviceIoControl call and chop it up in
    > kernel. That way, it only gets locked and mapped once.
    > —
    > Tim Roberts, [email protected]
    > Providenza & Boekelheide, Inc.
    >
    >
    > ---
    > NTDEV is sponsored by OSR
    >
    > Visit the list online at: showlists.cfm?list=ntdev>
    >
    > MONTHLY seminars on crash dump analysis, WDF, Windows internals and
    > software drivers!
    > Details at
    >
    > To unsubscribe, visit the List Server section of OSR Online at <
    > http://www.osronline.com/page.cfm?name=ListServer&gt;
    >



    --
    Mohamed Abdel Rauof.
    communication and electronics Engineer Cairo University BSc. 2011.
  • Dzmitry_AltukhouDzmitry_Altukhou Member - All Emails Posts: 16
    It's meaningful for Windows XP, the maximum IO buffer size in this case
    defines/limited by the following equation: PAGE_SIZE * (65535 -
    sizeof(MDL)) / sizeof(ULONG_PTR))).
    And yes, in result of calculation you'll get the value a bit less than 64K.

    But for Windows 7 and later OS versions this limit has been extended,
    namely: 4 * 1024 * 1024 * 1024LL - PAGE_SIZE.

    Therefore, if the target OS version in your case Windows 7 or later, it's
    shouldn't disturb you.

    Best Regards,
    Dzmitry

    On Mon, Feb 6, 2017 at 9:21 AM, mohamed rauof
    wrote:

    > but i heard that maximum buffer size of one deviceIOControl request buffer
    > is depending on page of memory which is several KBs , i am not sure of that
    > . are there any refrances for that info ?
    > @Tim Roberts , thanks alot for your appreciated help !
    >
    > On Mon, Feb 6, 2017 at 7:51 AM, Tim Roberts wrote:
    >
    >> On Feb 5, 2017, at 8:07 PM, mohamed rauof
    >> wrote:
    >> >
    >> > HW limitation at reciever driver
    >>
    >> Still, you can send the 1MB in one DeviceIoControl call and chop it up in
    >> kernel. That way, it only gets locked and mapped once.
    >> —
    >> Tim Roberts, [email protected]
    >> Providenza & Boekelheide, Inc.
    >>
    >>
    >> ---
    >> NTDEV is sponsored by OSR
    >>
    >> Visit the list online at: > lists.cfm?list=ntdev>
    >>
    >> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
    >> software drivers!
    >> Details at
    >>
    >> To unsubscribe, visit the List Server section of OSR Online at <
    >> http://www.osronline.com/page.cfm?name=ListServer&gt;
    >>
    >
    >
    >
    > --
    > Mohamed Abdel Rauof.
    > communication and electronics Engineer Cairo University BSc. 2011.
    > --- NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars
    > on crash dump analysis, WDF, Windows internals and software drivers!
    > Details at To unsubscribe, visit the List Server section of OSR Online at
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,450
    mohamed rauof wrote:
    >
    > but i heard that maximum buffer size of one deviceIOControl request
    > buffer is depending on page of memory which is several KBs , i am not
    > sure of that . are there any refrances for that info ?

    Only indirectly, as Dmitry pointed out. A page is 4KB. In the older
    systems (prior to Vista), DeviceIoControl is limited to a single MDL,
    which could only contain just over 16,000 page entries, which comes to
    64MB. In Vista and beyond, the limit is several gigabytes.

    --
    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Dzmitry_AltukhouDzmitry_Altukhou Member - All Emails Posts: 16
    I apologize for typo, the limitation for Windows XP is less than 64MB not
    64K.





    On Mon, Feb 6, 2017 at 8:54 PM, Tim Roberts wrote:

    > mohamed rauof wrote:
    > >
    > > but i heard that maximum buffer size of one deviceIOControl request
    > > buffer is depending on page of memory which is several KBs , i am not
    > > sure of that . are there any refrances for that info ?
    >
    > Only indirectly, as Dmitry pointed out. A page is 4KB. In the older
    > systems (prior to Vista), DeviceIoControl is limited to a single MDL,
    > which could only contain just over 16,000 page entries, which comes to
    > 64MB. In Vista and beyond, the limit is several gigabytes.
    >
    > --
    > Tim Roberts, [email protected]
    > Providenza & Boekelheide, Inc.
    >
    >
    > ---
    > NTDEV is sponsored by OSR
    >
    > Visit the list online at: showlists.cfm?list=ntdev>
    >
    > MONTHLY seminars on crash dump analysis, WDF, Windows internals and
    > software drivers!
    > Details at
    >
    > To unsubscribe, visit the List Server section of OSR Online at <
    > http://www.osronline.com/page.cfm?name=ListServer&gt;
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA