If I want to inject self-crafted raw Ethernet frames into the network, I use the WinPkFilter function SendPacketToAdapter() which issues a IOCTL_NDISRD_ADAPTER_QUEUE_SIZE call to the ndisrd driver. This works fine if I send just a few packets. But if I have to send a larger amount of packets, e.g. 1000 packets at once, the greatest part of the packets is never sent to the network though the return code of SendPacketToAdapter() indicates each time a successful operation.
It is clear what happens here: The SendPacketToAdapter() function just passes the packet to the ndisrd driver and returns immediately. It does not block until the packet is actually sent by the adapter. The ndisrd driver seems to have a queue for outgoing packets which quickly overflows when dispatching a large amount of packets with SendPacketToAdapter().
Why does the SendPacketToAdapter() call not block when the outgoing packet queue of the ndisrd driver becomes full? How can I make it block if I want to send a large pile of self-crafted packets at once and must be sure that they were actually sent by the network adapter?
It is interesting to note that there are no packet losses when running the PassThrough demo where the packets to be sent with SendPacketToAdapter() come from an application. Even if some application sends TCP data at a high rate, there aren’t any retransmissions, i.e. each packet passed to the adapter is actually sent and no packet got lost.
Many thanks for your help in advance!
—-
Max
edited:
I also noticed that the packets get dropped only if they are large enough. When dispatching 1000 packets with a length of 1000 bytes, only 150 – 200 packets get actually sent. But when dispatching 1000 packets with a length of 250 bytes, all 1000 packets are actually sent by the network adapter.