Home Forums Discussions General Discussion OID_GEN_TRANSMIT_QUEUE_LENGTH

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #11471


    I’m evaluating the driver for use in a network gateway – and successfully passing traffic in excess of 1Gbit/s. However, if I generate traffic too quickly – then the kernel memory usage grows quickly and then runs-out – causing a fatal error.

    I would like to control the rate at which data is sent according to the throughput available, so I am querying OID_GEN_TRANSMIT_QUEUE_LENGTH using NdisrdRequest. This always succeeds (returns true) but always returns zero as the queue length. Is this expected? Or is there another way to monitor the transmit queue within the driver/card?


    Vadim Smirnov


    Well, OID_GEN_TRANSMIT_QUEUE_LENGTH is an optional, so you are not guaranteed to receive anything useful.

    I had not tried to overflow the network card, but I think you could limit your packet sending rate according the card transmit speed. Anyway, faulting the system at high rates looks confusing, I would rather expect card to drop packets if the rate exceeds its capabilities.



    Thanks for your reply Vadim.

    The issue is that the Pool Nonpaged Bytes reduces as traffic increases – and when it reaches zero, the program fails.

    If I stop sending, then the Pool Nonpaged Bytes slowly reduces to normal levels as the packets I have sent to the driver are sent to the network.

    I was wondering whether there was any way to read the length of this queue, in a similar way as GetAdapterPacketQueueSize for reading the queue for packets queued in the other direction.

    Generally, the driver is working very well – great work.


    Vadim Smirnov

    I think you could try to monitor non paged pool usage via ZwQuerySystemInformation with SystemPerformanceInformation class. Although SYSTEM_PERFORMANCE_INFORMATION is not officially documented but I don’t think that in Windows 10 it is very different (if different at all) from the one below (I think this definition is from times of NT 4.0/2000/XP):

        LARGE_INTEGER IdleProcessTime;
        LARGE_INTEGER IoReadTransferCount;
        LARGE_INTEGER IoWriteTransferCount;
        LARGE_INTEGER IoOtherTransferCount;
        ULONG IoReadOperationCount;
        ULONG IoWriteOperationCount;
        ULONG IoOtherOperationCount;
        ULONG AvailablePages;
        ULONG CommittedPages;
        ULONG CommitLimit;
        ULONG PeakCommitment;
        ULONG PageFaultCount;
        ULONG CopyOnWriteCount;
        ULONG TransitionCount;
        ULONG CacheTransitionCount;
        ULONG DemandZeroCount;
        ULONG PageReadCount;
        ULONG PageReadIoCount;
        ULONG CacheReadCount;
        ULONG CacheIoCount;
        ULONG DirtyPagesWriteCount;
        ULONG DirtyWriteIoCount;
        ULONG MappedPagesWriteCount;
        ULONG MappedWriteIoCount;
        ULONG PagedPoolPages;
        ULONG NonPagedPoolPages;
        ULONG PagedPoolAllocs;
        ULONG PagedPoolFrees;
        ULONG NonPagedPoolAllocs;
        ULONG NonPagedPoolFrees;
        ULONG FreeSystemPtes;
        ULONG ResidentSystemCodePage;
        ULONG TotalSystemDriverPages;
        ULONG TotalSystemCodePages;
        ULONG NonPagedPoolLookasideHits;
        ULONG PagedPoolLookasideHits;
        ULONG Spare3Count;
        ULONG ResidentSystemCachePage;
        ULONG ResidentPagedPoolPage;
        ULONG ResidentSystemDriverPage;
        ULONG CcFastReadNoWait;
        ULONG CcFastReadWait;
        ULONG CcFastReadResourceMiss;
        ULONG CcFastReadNotPossible;
        ULONG CcFastMdlReadNoWait;
        ULONG CcFastMdlReadWait;
        ULONG CcFastMdlReadResourceMiss;
        ULONG CcFastMdlReadNotPossible;
        ULONG CcMapDataNoWait;
        ULONG CcMapDataWait;
        ULONG CcMapDataNoWaitMiss;
        ULONG CcMapDataWaitMiss;
        ULONG CcPinMappedDataCount;
        ULONG CcPinReadNoWait;
        ULONG CcPinReadWait;
        ULONG CcPinReadNoWaitMiss;
        ULONG CcPinReadWaitMiss;
        ULONG CcCopyReadNoWait;
        ULONG CcCopyReadWait;
        ULONG CcCopyReadNoWaitMiss;
        ULONG CcCopyReadWaitMiss;
        ULONG CcMdlReadNoWait;
        ULONG CcMdlReadWait;
        ULONG CcMdlReadNoWaitMiss;
        ULONG CcMdlReadWaitMiss;
        ULONG CcReadAheadIos;
        ULONG CcLazyWriteIos;
        ULONG CcLazyWritePages;
        ULONG CcDataFlushes;
        ULONG CcDataPages;
        ULONG ContextSwitches;
        ULONG FirstLevelTbFills;
        ULONG SecondLevelTbFills;
        ULONG SystemCalls;

    Here you can find SYSTEM_PERFORMANCE_INFORMATION for Windows 8 and later.


    Thanks you for the advice – I’ll have a look into ZwQuerySystemInformation.

    In the mean time, I have taken your advice and queried the speed of the interface (using OID_GEN_LINK_STATE Oid) – and created a rate limiter. This has solved the problem and allowed me to progress.


Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.