From: Eliyas Yakub To: NT Developers Interest List Subject: [ntdev] RE: NT Deserial driver and MiniportReturnPacket Date: Tuesday, February 27, 2001 2:25 PM I just found out that there are some issues in the return packet logic of NDIS in NT4.0. You should implement your code based on the logic given in the "Multipacket Receives from Connectionless and Connection-Oriented Miniports" section. According to that: The driver keeps two addtional flags in its receive packet reserved area. these are fInRcvDpc and fReturnPacketsCalled. Before you indicate a packet to ndis you do the following. This code will note that a packet is in the context of a receive indication. It will also check when the receive indication returns if the packet was completed synchronously or if the packet was returned to the miniport while it was in the indication routine. If any of these cases are true then you requeue the packet for later use as it has been returned to me. NdisAcquireSpinLock(&RcvLock); Packet->fInRcvDpc = TRUE; Packet->fReturnPacketsCalled = FALSE; NdisReleaseSpinLock(&RcvLock); NdisMIndicateReceivePacket(); NdisAcquireSpinLock(&RcvLock); Packet->fInRcvDpc = FALSE; Status = NDIS_GET_PACKET_STATUS(Packet); if ((NDIS_STATUS_SUCCESS == Status) || (NDIS_STATUS_RESOURCES == Status) || ((NDIS_STATUS_PENDING == Status) && Packet->fReturnPacketsCalled)) { ProcessReturnPacket(packet); } NdisReleaseSpinLock(&RcvLock); In your MiniportReturnPacket routine you do the following. This checks to see if a packet that is being returned by the protocol is returned in the context of the indication. If so then it simply sets a flag noting that the protocol's processing of the packet is complete and returns so that the miniport's indication code can do the clean up on it. If we are not in the context of the indication then we will do the clean up here. NdisAcquireSpinLock(&RcvLock); if (Packet->fInRcvDpc) { Packet->fReturnPacketsCalled = TRUE; NdisReleaseSpinLock(&RcvLock); return; } NdisReleaseSpinLock(&RcvLock); ProcessReturnPacket(Packet); -Eliyas -----Original Message----- From: Ramit Bhalla [mailto:ramit.bhalla@wipro.com] Sent: Tuesday, February 27, 2001 12:57 AM To: NT Developers Interest List Subject: NT Deserial driver and MiniportReturnPacket Hi, I'm developing a NT Deserial driver. I'm using a version of ndis.h and ndis.lib that was given to me by someone at microsoft. I'm also using sp6. The problem is no matter what i try the MiniportReturnPacket function is not being called by NDIS. I'm going by the documentation of Win2K since there is no documentation for NT and deserial support. I have tried setting the packet status to everything and nothing seems to work. No matter what I try it doesn't call my miniportreturnpacket function. The only way i've found around this is setting the packet status to RESOURCES, but this hits the performance drastically. The same driver is also adapter to run as a serial driver that is when the DESERIAL flag is not set. Then it function fine and the minportreturnpacket is called, as soon as I specify the DESERIAL flag, it stops calling the miniportreturn packet. This driver has a common source code for NDIS 4 and NDIS 5, that is it also runs on win2K and it runs absolutely perfectly and the miniportreturnpacket function is called. I'm only facing this problem on WINNT. Has anyone seen this problem and I'll appreciate any help/clue to this problem. Does anyone know about any documentation related to this??? Thanks Ramit. --- You are currently subscribed to ntdev as: tdivine@pcausa.com To unsubscribe send a blank email to leave-ntdev-154L@lists.osr.com