Re: NdisMIndicateReceivePacket cost too much time, why?



from MiniportInitialize,
NdisMSetAttributesEx(
MiniportAdapterHandle,
(NDIS_HANDLE) pL1e,
0,
NDIS_ATTRIBUTE_BUS_MASTER |
NDIS_ATTRIBUTE_DESERIALIZE|
#ifdef NDIS51_MINIPORT
NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS|
#endif
0,
NdisInterfacePci);
"zhangfei" <fzhang@xxxxxxxxxxx> дÈëÏûÏ¢ÐÂÎÅ:O%23sSxaFJJHA.3548@xxxxxxxxxxxxxxxxxxxxxxx
I use the SmartBit to send random packets with the MAC address of my NIC,
my NIC driver makes 8 packets

receive indications with NdisMIndicateReceivePacket every time, and
NdisMIndicateReceivePacket will occupy more than

16us, too long time, so that the driver can¡¯t config the rx descriptions
for the NIC quickly enough.

The rx source code is like this:

PNDIS_PACKET PacketArray[8];
ULONG dwPacketCount = 0;

PNDIS_PACKET NdisPacket;
PNDIS_BUFFER NdisBuffer;

NDIS_TCP_IP_CHECKSUM_PACKET_INFO CheckSumInfo;

CheckSumInfo.Value = 0;

......

NdisDprAcquireSpinLock(&pL1c->RecvLock);

for( pDmaRrd=pL1c->RrdVirAddr+ulRrdConsumer; pDmaRrd->updt;
pDmaRrd=pL1c->RrdVirAddr+ulRrdConsumer )

{

pQueueUnit = QueueRemoveFromHeader( &pL1c->ReceiveQueue );
/* If there is enough free rx entry, there must be enough NdisPacket
from ReceiveQueue. So this could
never be NULL, check this to pass prefast. */
NdisPacket = MR_TO_PACKET( pQueueUnit );
pRxEntry = pL1c->ppRxEntryInUseArray[RfdStartIndex];

NdisBuffer = pRxEntry->NdisBuffer;

NdisAdjustBufferLength( NdisBuffer, FrameLen );/*FrameLen includes
the MAC header, excluded CRC.*/
NdisChainBufferAtBack( NdisPacket, NdisBuffer );

NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, TcpIpChecksumPacketInfo) =
(PVOID)(ULONG_PTR)CheckSumInfo.Value;

NDIS_SET_PACKET_STATUS(NdisPacket, NDIS_STATUS_SUCCESS);

PacketArray[dwPacketCount++] = NdisPacket;

if( dwPacketFreeCount >=
sizeof(PacketFreeArray)/sizeof(PacketFreeArray[0]) )

{

NdisDprReleaseSpinLock(&pL1c->RecvLock);
NdisMIndicateReceivePacket(pL1c->MiniportAdapterHandle,
PacketArray, dwPacketCount);
NdisDprAcquireSpinLock(&pL1c->RecvLock);

}

......
}

NdisDprReleaseSpinLock(&pL1c->RecvLock);







.



Relevant Pages

  • NdisMIndicateReceivePacket cost too much time, why?
    ... I use the SmartBit to send random packets with the MAC address of my NIC, ... my NIC driver makes 8 packets ... NdisMIndicateReceivePacket will occupy more than ...
    (microsoft.public.development.device.drivers)
  • Re: Problem using workitems in passthru driver.
    ... i am calling the NdisMIndicateReceivePacket() function. ... > return of the IRPs, forward the packets on their respective paths. ... > told here by Mr. Maxim Shatskih to use workitems to send the IRPs. ...
    (microsoft.public.development.device.drivers)
  • Re: NDIS IM and hidden proxy
    ... > SWM> host to NdisMIndicateReceivePacket(). ... Try and run some network sniffer on the same host (e.g. Network Monitor ... Does it show any of the packets you pass to ...
    (microsoft.public.development.device.drivers)
  • WHQL NDIS 2c_CheckConnections.wsf says that our card fails to receive packets but...
    ... We set a breakpoint and watch our driver call NdisMIndicateReceivePacket() ... we give it an ever increasing count of received packets. ...
    (microsoft.public.development.device.drivers)
  • Re: a question about MiniportReturnPacket
    ... "Yu Hao" wrote: ... packets up with NdisMIndicateReceivePacket ... NdisMIndicateReceivePacket(), it will get returned to your ... MiniportReturnPacket() when its reference count goes down to zero (i.e. ...
    (microsoft.public.development.device.drivers)