NDIS ProtocolReceivePacket question

Hi all,

I have a question regarding the ndis_packet passed to
ProtocolReceivePacket of a protocol driver. I know a packet contains a
set of buffers and that drivers can chain or unchain buffers to the
packet descriptor.

What I would like to know is how many buffers are typically chained to
a receive packet by the ethernet miniport driver, that is the packet
received by ProtocolReceivePacket ? I’ve had a look through the Intel
EtherExpress E100BEX driver example in the DDK, seems that E100BEX
receive buffers are always initialized to NIC_MAX_PACKET_SIZE = 1514,
which makes sense for ethernet packets. The buffer size is then
adjusted to the actual packet size. Can I then assume that all
ethernet miniport drivers will allocate the full packet size in one
buffer ?

If not, can one at least expect that none of the layer 2 and 3
protocol headers will cross buffer boundaries ?

Thanks in advance.

Beyers Cronje

See the “NDIS Packet Discussion” at NDIS.com:

http://www.ndis.com/papers/default.htm

Good luck,

Thomas F. Divine, Windows DDK MVP
http://www.rawether.net

“Beyers Cronje” wrote in message news:xxxxx@ntdev…
Hi all,

I have a question regarding the ndis_packet passed to
ProtocolReceivePacket of a protocol driver. I know a packet contains a
set of buffers and that drivers can chain or unchain buffers to the
packet descriptor.

What I would like to know is how many buffers are typically chained to
a receive packet by the ethernet miniport driver, that is the packet
received by ProtocolReceivePacket ? I’ve had a look through the Intel
EtherExpress E100BEX driver example in the DDK, seems that E100BEX
receive buffers are always initialized to NIC_MAX_PACKET_SIZE = 1514,
which makes sense for ethernet packets. The buffer size is then
adjusted to the actual packet size. Can I then assume that all
ethernet miniport drivers will allocate the full packet size in one
buffer ?

If not, can one at least expect that none of the layer 2 and 3
protocol headers will cross buffer boundaries ?

Thanks in advance.

Beyers Cronje

You can rely on the fact that TCP/IP headers are all in the very first
buffer.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Beyers Cronje”
To: “Windows System Software Devs Interest List”
Sent: Monday, July 11, 2005 11:20 PM
Subject: [ntdev] NDIS ProtocolReceivePacket question

Hi all,

I have a question regarding the ndis_packet passed to
ProtocolReceivePacket of a protocol driver. I know a packet contains a
set of buffers and that drivers can chain or unchain buffers to the
packet descriptor.

What I would like to know is how many buffers are typically chained to
a receive packet by the ethernet miniport driver, that is the packet
received by ProtocolReceivePacket ? I’ve had a look through the Intel
EtherExpress E100BEX driver example in the DDK, seems that E100BEX
receive buffers are always initialized to NIC_MAX_PACKET_SIZE = 1514,
which makes sense for ethernet packets. The buffer size is then
adjusted to the actual packet size. Can I then assume that all
ethernet miniport drivers will allocate the full packet size in one
buffer ?

If not, can one at least expect that none of the layer 2 and 3
protocol headers will cross buffer boundaries ?

Thanks in advance.

Beyers Cronje


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thank you Thomas & Maxim,

http://www.pcausa.com/support/KB01060101.htm seems to incline the same.

Beyers

On 7/11/05, Maxim S. Shatskih wrote:
> You can rely on the fact that TCP/IP headers are all in the very first
> buffer.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Beyers Cronje”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, July 11, 2005 11:20 PM
> Subject: [ntdev] NDIS ProtocolReceivePacket question
>
>
> Hi all,
>
> I have a question regarding the ndis_packet passed to
> ProtocolReceivePacket of a protocol driver. I know a packet contains a
> set of buffers and that drivers can chain or unchain buffers to the
> packet descriptor.
>
> What I would like to know is how many buffers are typically chained to
> a receive packet by the ethernet miniport driver, that is the packet
> received by ProtocolReceivePacket ? I’ve had a look through the Intel
> EtherExpress E100BEX driver example in the DDK, seems that E100BEX
> receive buffers are always initialized to NIC_MAX_PACKET_SIZE = 1514,
> which makes sense for ethernet packets. The buffer size is then
> adjusted to the actual packet size. Can I then assume that all
> ethernet miniport drivers will allocate the full packet size in one
> buffer ?
>
> If not, can one at least expect that none of the layer 2 and 3
> protocol headers will cross buffer boundaries ?
>
> Thanks in advance.
>
> Beyers Cronje
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

. only because TCPIP.SYS does (for now) but you should not casually assume
that it must or always will or that other components in the system will
preserve this behavior.

As the PCAUSA / NDIS.COM treatise on NDIS Packets covers, NDIS only
specifies that the MAC header must be in the first buffer and that protocols
*may* specify a minimum look-a-head buffer for receive that the NIC should
endeavor to honor.

However, a ‘loopback’ packet which is the result of NDIS itself sending a
packet into the RX path that is currently a packet in the TX path of another
binding (or the same binding) does not necessarily need to meet any
requirement other than that the MAC header be in the first buffer.

The old IETF protocol maxim applies here: “Be conservative in what you
generate and liberal in what you accept.”

It is not much more difficult to write a NDIS packet parser that can deal
with L3 headers straddling buffers and since it happens very infrequently
(if at all) it generally costs very little in real performance.

Most non-loopback RX packets in NDIS have one buffer.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 5:11 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] NDIS ProtocolReceivePacket question

You can rely on the fact that TCP/IP headers are all in the very first
buffer.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Beyers Cronje”
To: “Windows System Software Devs Interest List”
Sent: Monday, July 11, 2005 11:20 PM
Subject: [ntdev] NDIS ProtocolReceivePacket question

Hi all,

I have a question regarding the ndis_packet passed to
ProtocolReceivePacket of a protocol driver. I know a packet contains a
set of buffers and that drivers can chain or unchain buffers to the
packet descriptor.

What I would like to know is how many buffers are typically chained to
a receive packet by the ethernet miniport driver, that is the packet
received by ProtocolReceivePacket ? I’ve had a look through the Intel
EtherExpress E100BEX driver example in the DDK, seems that E100BEX
receive buffers are always initialized to NIC_MAX_PACKET_SIZE = 1514,
which makes sense for ethernet packets. The buffer size is then
adjusted to the actual packet size. Can I then assume that all
ethernet miniport drivers will allocate the full packet size in one
buffer ?

If not, can one at least expect that none of the layer 2 and 3
protocol headers will cross buffer boundaries ?

Thanks in advance.

Beyers Cronje


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@lists.osr.com