I want to have some reserved fields in NDIS_PACKET for my purpose at
the “receive” side.
I do “not” want to use MiniportReserved fields of NDIS_PACKET as it is
of less size (2*sizeof(PVOID)) for me. Instead I want to use ‘ProtocolReserved’.
For this I am using following NDIS API to get additional memory allocated…
The ProtocolReserved field is reserved for the overlying protocol driver which means your
miniport must leave this alone. NdisAllocatePacketPool in the latest DDK states the following
for the ProtocolReservedLength parameter:
“Specifies the number of bytes to be allocated for the ProtocolReserved array of each packet
descriptor. For packet descriptors to be used in receive indications, this parameter is
4*sizeof(PVOID), which is reserved for use by protocols.”
That said, what you can do is define mystruct as follows:
struct MyStruct
{
char ProtocolReserved[PROTOCOL_RESERVED_SIZE_IN_PACKET]; // don’t ever touch this
… your miniport specific fields follow …
}
Dave
“anita.verma” wrote:
Hi All,
I am writing a NDIS miniport driver for NIC.
I want to have some reserved fields in NDIS_PACKET for my purpose at
the “receive” side.
I do “not” want to use MiniportReserved fields of NDIS_PACKET as it is
of less size (2*sizeof(PVOID)) for me. Instead I want to use ‘ProtocolReserved’.
For this I am using following NDIS API to get additional memory allocated…
----- Original Message -----
From: “anita.verma” To: “NT Developers Interest List” Sent: Tuesday, April 30, 2002 3:58 PM Subject: [ntdev] ProtocolReserved in NDIS_PACKET
> Hi All, > > I am writing a NDIS miniport driver for NIC. > > I want to have some reserved fields in NDIS_PACKET for my purpose at > the “receive” side. > I do “not” want to use MiniportReserved fields of NDIS_PACKET as it is > of less size (2sizeof(PVOID)) for me. Instead I want to use ‘ProtocolReserved’. > > For this I am using following NDIS API to get additional memory allocated… > > NdisAllocatePacketPoolEx(&status, &hPool, MAX_PKTS, 0, sizeof(mystruct)); > > and plan to use … > > (mystruct) &ndispkt->ProtocolReserved > > > Is this fine to use ProtocolReserved field as mentioned above. > > Thanks in advance. > > Anita > > > Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com > > Buy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in > > > — > You are currently subscribed to ntdev as: xxxxx@storagecraft.com > To unsubscribe send a blank email to %%email.unsub%% >
Yes, it could work which doesn’t mean it is quite correct or reasonable. The
problem is it misuses the packet area which isn’t intended for miniport use.
Imagine a protocol which also doesn’t behave quite correctly and computes
protocol reserved size using info in the packet descriptor. It founds there
is even more space available, uses it all for some smart purpose and
destroys miniport info there.
Instead, allocate a structure of necessary info and store its address to
MiniportReserved field. Maybe not so efficient but safer. Or change desing
so 8 bytes (12 for deserialized) is enough for per-packet info.
Best regards,
Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]
The ProtocolReserved field is reserved for the overlying protocol driver
which means your
miniport must leave this alone. NdisAllocatePacketPool in the latest DDK
states the following
for the ProtocolReservedLength parameter:
“Specifies the number of bytes to be allocated for the ProtocolReserved
array of each packet
descriptor. For packet descriptors to be used in receive indications, this
parameter is
4*sizeof(PVOID), which is reserved for use by protocols.”
That said, what you can do is define mystruct as follows:
struct MyStruct
{
char ProtocolReserved[PROTOCOL_RESERVED_SIZE_IN_PACKET]; // don’t ever
touch this
… your miniport specific fields follow …
}
Dave
“anita.verma” wrote:
> Hi All,
>
> I am writing a NDIS miniport driver for NIC.
>
> I want to have some reserved fields in NDIS_PACKET for my purpose at
> the “receive” side.
> I do “not” want to use MiniportReserved fields of NDIS_PACKET as it is
> of less size (2*sizeof(PVOID)) for me. Instead I want to use
‘ProtocolReserved’.
>
> For this I am using following NDIS API to get additional memory
allocated…
>
> NdisAllocatePacketPoolEx(&status, &hPool, MAX_PKTS, 0,
sizeof(mystruct));
>
> and plan to use …
>
> (mystruct*) &ndispkt->ProtocolReserved
>
> Is this fine to use ProtocolReserved field as mentioned above.
>
> Thanks in advance.
>
> Anita
>
> Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com
>
> Buy Music, Video, CD-ROM, Audio-Books and Music Accessories from http://www.planetm.co.in
>
> —
> You are currently subscribed to ntdev as: xxxxx@okena.com
> To unsubscribe send a blank email to %%email.unsub%%
You are currently subscribed to ntdev as: michal.vodicka@st.com
To unsubscribe send a blank email to %%email.unsub%%