Doubt in handling receive for Miniport driver with WDM loweredge.

Hi ppl,

I am developing a NDIS Deserialized Miniport driver with WDM lower edge for
a virtual NIC device that emulates Ethernet medium.
In the receive direction, I have to construct NDIS packet after framing an
Ethernet packet with the received IP packet. I am maintaining a pool of
Packet descriptors & Buffer descriptors to do this. I have to allocate
memory for the actual data (Ethernet Frame) in my driver, I can’t use the
buffers given to me from lower layers.

My doubts are

  1. Is it better to allocate & free memory for such buffers on the fly or
    Should i maintain a pool of fixed/variable size buffers to do this ?
  2. Will NdisFreeBuffer also free the memory that was mapped in the buffer
    descriptor by NdisAllocateBuffer ? If not which NdisXXX macro should be used
    to do this ?
  3. In my case i’ll be using the same EthernetHeader for all received IP
    packets irrespective of the source, so i want to avoid allocating & freeing
    memory for EthernetHeader for each received packet, instead use a
    pre-allocated memory for EthernetHeader. This memory should be released only
    when my driver unloads.
    If the answer to question (2) is YES how do i avoid NdisFreeBuffer releasing
    memory alocated for EthernetHeader ?

Thanx in advance
Regards
Anandhi


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

> 2) Will NdisFreeBuffer also free the memory that was mapped in the buffer

descriptor by NdisAllocateBuffer ? If not which NdisXXX macro should be
used
to do this ?

No. NdisFreeBuffer is defined as IoFreeMdl on NT.

  1. In my case i’ll be using the same EthernetHeader for all received IP
    packets irrespective of the source, so i want to avoid allocating &
    freeing
    memory for EthernetHeader for each received packet, instead use a
    pre-allocated memory for EthernetHeader. This memory should be released
    only
    when my driver unloads.

Are you sure the lower level will not indicate you 2 packets concurrently?

Max


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