Concept of packet in NDIS5.0

Hi, all

I’m writing a Connection-Oriented NDIS Miniport drvier for an ATM card.
In the miniport driver I must realize the SAR function. And I want to do it
by this (take transfer as an example):

I do the transfer work in MiniportCoSendPackets function. The NDIS call
this functionby giving me a PacketArray. I think every packet in the PacketArray
shoud be thinked as a CPCS-PDU payload (in ATM AAL5). So in order to add a
trailer to every CPCS-PDU, I want to use the NdisCopyFromPacketToPacket() function
with the destination packet’s length plusing sizeof the trailer.

But before calling the NdisCopyFromPacketToPacket function, I should first allocate
a destination packet by first allocating packet pool then allocating packet.But
nither of them is relating to buffer operation, they are just descriptors.

So,I want to ask two questions:

  1. Whether my method to add trailer for a CPCS-PDU by using
    NdisCopyFromPacketToPacket is right?

2.Whether I should call the NdisChainBufferAtBack() function to chain the packet with
buffers?

Thank you for your help.

xhcai
Institute of Modern Communications , SJTU
Shanghai


Free Email/SMTP/POP, http://www.bn3.com, Hosting xxxxx@yoursite.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I wouldn’t copy the packet to add the AAL5 trailer. The only reason to
maintain a packet is if you are going to give the packet to another
NDIS aware module. Usually a MiniportCoSendPackets routine is talking
to a piece of hardware, not another NDIS driver.

The simplest thing for you to do is copy the contents of the packet
into a buffer with enough room at the end for an AAL5 trailer,
calculate the CRC, then start chopping the buffer into 48 byte
payloads for DMA to the card. Once you get that working, you can
eliminate the copy and do the calculations directly from the NDIS
packet. The tough part here is figuring out where the cell payloads
span NDIS buffers and dealing with that correctly.

Clark

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of encarta
Sent: Monday, April 10, 2000 3:28 AM
To: NT Developers Interest List
Subject: [ntdev] Concept of packet in NDIS5.0

Hi, all

I’m writing a Connection-Oriented NDIS Miniport drvier for an
ATM card.
In the miniport driver I must realize the SAR function. And I
want to do it
by this (take transfer as an example):

I do the transfer work in MiniportCoSendPackets function. The
NDIS call
this functionby giving me a PacketArray. I think every packet in
the PacketArray
shoud be thinked as a CPCS-PDU payload (in ATM AAL5). So in order
to add a
trailer to every CPCS-PDU, I want to use the
NdisCopyFromPacketToPacket() function
with the destination packet’s length plusing sizeof the trailer.

But before calling the NdisCopyFromPacketToPacket function, I
should first allocate
a destination packet by first allocating packet pool then
allocating packet.But
nither of them is relating to buffer operation, they are just
descriptors.

So,I want to ask two questions:

  1. Whether my method to add trailer for a CPCS-PDU by using
    NdisCopyFromPacketToPacket is right?

2.Whether I should call the NdisChainBufferAtBack() function to
chain the packet with
buffers?

Thank you for your help.

xhcai
Institute of Modern Communications , SJTU
Shanghai


Free Email/SMTP/POP, http://www.bn3.com, Hosting
xxxxx@yoursite.com


You are currently subscribed to ntdev as: xxxxx@wirespeed.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.0.2

iQA/AwUBOPM+yuB0WaKgfXz5EQIKbgCg4kOk3Trb7AloM5vGQowG+vIz6/cAnAgD
EO1m9V/d2PGLlGnubNyW9u9l
=nE2U
-----END PGP SIGNATURE-----

Hi,Williams

I’ve understood your meaning.

Yes, I shouldn’t use the packet again in the hardware related routine.
So, what I do is first to query the packet information using NdisQueryPacket and
then use the NdisMoveMemory to copy the buffer in the packet to my temperory buffers
or DMA buffers.

Is it right?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I wouldn’t copy the packet to add the AAL5 trailer. The only reason to
maintain a packet is if you are going to give the packet to another
NDIS aware module. Usually a MiniportCoSendPackets routine is talking
to a piece of hardware, not another NDIS driver.

The simplest thing for you to do is copy the contents of the packet
into a buffer with enough room at the end for an AAL5 trailer,
calculate the CRC, then start chopping the buffer into 48 byte
payloads for DMA to the card. Once you get that working, you can
eliminate the copy and do the calculations directly from the NDIS
packet. The tough part here is figuring out where the cell payloads
span NDIS buffers and dealing with that correctly.

Clark

Best Regards!

Xiaohua Cai
Institute of Modern Communications , SJTU
Shanghai


Free Email/SMTP/POP, http://www.bn3.com, Hosting xxxxx@yoursite.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

That is one way to do it.

You may find after implementing your segment/transmit routine that
copying from the packet hurts your performance. If your hardware is a
bus-master DMA device and can handle multiple DMA’s per cell, you may
want to try and DMA directly from the packet buffers. You could use a
buffer external to the packet to contain the AAL5 trailer. Each cell
would be at least two DMA descriptors (one for the cell header and one
for the cell payload). If a cell payload spans a buffer, you will have
to use more than one DMA descriptor for the payload.

But, if your performance is acceptable with the copy, then copying the
packet data to a temporary buffer will be much simpler.

Clark

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of encarta
Sent: Wednesday, April 12, 2000 7:22 AM
To: NT Developers Interest List
Subject: [ntdev] Re: [ntdev]: Concept of packet in NDIS5.0

Hi,Williams

I’ve understood your meaning.

Yes, I shouldn’t use the packet again in the hardware related
routine.
So, what I do is first to query the packet information using
NdisQueryPacket and
then use the NdisMoveMemory to copy the buffer in the packet to
my temperory buffers
or DMA buffers.

Is it right?

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>I wouldn’t copy the packet to add the AAL5 trailer. The only reason
to
>maintain a packet is if you are going to give the packet to another
>NDIS aware module. Usually a MiniportCoSendPackets routine is
talking
>to a piece of hardware, not another NDIS driver.
>
>The simplest thing for you to do is copy the contents of the packet
>into a buffer with enough room at the end for an AAL5 trailer,
>calculate the CRC, then start chopping the buffer into 48 byte
>payloads for DMA to the card. Once you get that working, you can
>eliminate the copy and do the calculations directly from the NDIS
>packet. The tough part here is figuring out where the cell payloads
>span NDIS buffers and dealing with that correctly.
>
>Clark

Best Regards!

Xiaohua Cai
Institute of Modern Communications , SJTU
Shanghai


Free Email/SMTP/POP, http://www.bn3.com, Hosting
xxxxx@yoursite.com


You are currently subscribed to ntdev as: xxxxx@wirespeed.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.0.2

iQA/AwUBOPSDquB0WaKgfXz5EQLjUgCg/pGr418/WSv4uVqq3DE2wJ+rr6UAoPuV
LHkCnAUOaM1Fhv0gbGtTF5fb
=YINj
-----END PGP SIGNATURE-----