|
|
NdisReinitializePacket
|
|
Knowledge Base ID |
KB05050101 |
| Category | INFO |
|
Effected Product |
NDIS Intermediate Drivers |
|
Effected Versions |
Unknown |
| Effected Platforms | Windows 2000 |
![]()
NdisReinitializePacket does not reinitialize some fields in the NDIS_PACKET. The fields of interest is the unnamed union containing these fields:
| MiniportReserved, WrapperReserved | |
| MiniportReservedEx, WrapperReservedEx | |
| MacReserved |
Failure to reinitialize these fields can cause unpredictable faults in drivers (particularly NDIS Intermediate drivers) that use a common NDIS packet pool for both Miniport and Protocol operations on an adapter.
The problem occurs when a packet that was previously used for a call to NdisSend is recycled and then re-used in a call to NdisMIndicateReceive.
The most serious fault that can be caused by failing to reinitialize these fields is that a NDIS IM driver's call to NdisMIndicateReceive may fail unexpectedly within NDIS when operating on some adapters (but not all adapters).
The fact that these fields are not reinitialized by NdisReinitializePacket is not a problem for most uses of NDIS_PACKETs by NDIS Protocols, NDIS Miniports or NDIS full-MAC drivers. In fact, it may not be desirable to perform the additional reinitialization steps described below at all for these types of drivers.
However, the fact that these fields are not reinitialized by NdisReinitializePacket can cause unpredictable faults in an NDIS Intermediate (IM) driver that uses a common NDIS packet pool with packet recycling for both its Miniport-edge and Protocol-edge.
Here is s step-by-step description of the problem:
On Windows 2000 the uninitialized fields may lead to a fault in efilter.c:
Failure: PNDIS_REFERENCE_FROM_NDIS_PACKET(Packet)->RefCount==0
The problem may manifest itself differently, perhaps because of differing contents of the uninitialized fields. Other observed faults include:
Miniport X MSR LastExceptionFromIp
Without a debugger the behavior observed in this case is a BSOD and system reboot.
The problem is made difficult to debug because some NDIS Miniport drivers do not elect to use the MiniportReserved or MiniportReservedEx fields in the unnamed union or may use them differently. The fault does not occur on these drivers.
This problem can be fixed by simply zeroing the aforementioned unnamed union after calling NdisReinitializePacket when reallocating a previously used NDIS packet.
The simplest way is to zero the 32-byte field named MacReserved. Zeroing this field should zero the unnamed union in its entirety.
This problem can also be fixed by simply zeroing the aforementioned unnamed union after each send completes. That is, zero the field before recycling the NDIS packet.
It has been mentioned that this behavior has been fixed in Windows XP by having NDIS zero the necessary fields as it completes each send operation.
Such fix for Windows XP offers little joy for those who must support other versions of Windows. In fact, it makes development more complex. It might have been better to have the bug exhibit itself consistently instead of having it occur on some platforms but not others.
Stephan Wolf provided some additional insight and another suggestion:
"IM drivers that use the same NDIS_PACKETs for both send and receive operations should save the value of the 'MiniportReservedEx' field before the send operation and restore it in their send complete handler"
Click here to read the complete text of Stephan's comment.
Using separate NDIS packet pools for protocol and miniport operations would also seem to be an approach that would eliminate this problem.
This solution is recommended by Microsoft. They apparently identified this problem in August, 1999 but forgot to document it.
However, this solution would complicate the design of most practical NDIS IM drivers.
This particular fault can, of course, be eliminated by eliminating the call to NdisMIndicateReceive. One could use explicit calls to NdisMEthIndicateReceive, etc.
However, this solution would also complicate the design of most practical NDIS IM drivers.
| September 17, 2001 | Information posted. |
| May 5, 2001 | Information posted. |
Please click the following link to send e-mail relating to this PCAUSA Knowledge Base topic:
![]()
| Keywords | NdisMIndicateReceive, NdisReintiializePacket, INFO |
| Created | May 5, 2001 |
| Last Reviewed | September 17, 2001 |
![]()
|
PCAUSA Home ·
Privacy Statement ·
Products ·
Ordering ·
Support ·
Utilities ·
Resources
|