NDIS: Getting incomplete lookahead buffers in PtReceive

Discussion in 'Windows Vista Drivers' started by Tierrie, Dec 14, 2005.

  1. Tierrie

    Tierrie Guest

    Regarding lookaheads and packet descriptors in PtReceive:

    I seem to get more lookaheads during WLAN operation than in normal LAN
    operations. However in almost all of my cases the lookahead buffers
    contain the entire packet buffer (minus header which is in
    HeaderBuffer).

    However that's not guarenteed and there are some cases where the
    LookAheadSize < PacketSize which I need to account for. I wrote the
    code for it but it almost never goes through that code path!

    Is there a way I can generate more incomplete lookahead buffers so I
    can test PtTransferData?
     
    Tierrie, Dec 14, 2005
    #1
    1. Advertisements

  2. Tierrie

    Tierrie Guest

    Sort of a follow up question to the above ---

    According to WinDDK I should be
    a) allocate memory for 14 ( + LookAheadBufferSize )
    b) copying the HeaderBuffer (and maybe the LookAheadBuffer) to a
    BufferDescriptor ( describing at least 14 ( + LookAheadBufferSize )
    bytes in memory? )
    c) chain the buffer descriptor to a packet descriptor
    d) call NdisTransferData with byte offset = HeaderBufferSize ( +
    LookAheadBufferSize if included )

    There were a few variety of methods I saw, some that just copied
    HeaderBuffer, some that included the LookAheadBuffer into the first
    buffer descriptor.

    I was wondering why not just allocate memory = 1500 bytes and
    NdisTransferData with byteoffset 0 and size = HeaderBufferSize +
    PacketSize?


    Second question is:
    If we want to reuse the packet after doing the NdisTransferData, will a
    UnchainBufferAtXXX( pPacket, &pBuffer ), ReinitializePacket( pPacket ),
    ChainBufferAtXXX( pPacket, pBuffer ) work? That way I don't have to
    reallocate memory and reallocate buffers as well.
     
    Tierrie, Dec 14, 2005
    #2
    1. Advertisements

  3. I was wondering why not just allocate memory = 1500 bytes and
    NdisTransferData cannot go backward, it can only go forward taking the packet
    bytes to the memory. In some miniports for IO-space-mapped hardware, the
    MiniportTransferData is READ_REGISTER_BUFFER_UCHAR.
    You can have 1 and only 1 buffer for the whole packet, not need in 2 buffers.
    Just do RtlCopyMemory of HeaderBuffer, then RtlCopyMemory of LookaheadBuffer,
    then NdisTransferData. Your TransferDataComplete handler will be called with
    the ready packet.

    No need to unchain the buffers, ReinitializePacket is enough.
     
    Maxim S. Shatskih, Dec 15, 2005
    #3
  4. Tierrie

    Tierrie Guest

    Thank you Maxim. Any tips on how to create an enviroment with some of
    those uncommon (lookaheadbuffers that don't include the entire packet)
    so I can test that portion of the code?
     
    Tierrie, Dec 15, 2005
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.