Should NdisMAllocateNetBufferSGList be called only from MiniportSendNetBufferLists?

Question on the NDIS API NdisMAllocateNetBufferSGList API

Should this API be only called from within the context of the thread that calls MiniportSendNetBufferLists?.
What I mean is that should the NDIS API be called only after the miniport’s MiniportSendNetBufferLists() is called but before it returns?.

Or is it ok for me to store the NBL in some driver owned list and have a deferred context (timer callback, another thread) call NdisMAllocateNetBufferSGList?.

The documentation here seems to imply that the NDIS API is called only from MiniportSendNetBufferLists. I just am not sure if the wording is strong enough that this NDIS API cannot be called from anywhere else.

Thanks,
RK

NdisMAllocateNetBufferSGList does not require that you call it within a particular thread/processor/callback. You can call it from any context, including a timer or another thread. The only real contextual requirement it has is that the current IRQL is DISPATCH_LEVEL.

It is very reasonable to defer NB translation if you know that you’re not going to make progress anyway, e.g., if your transmit ring is already full.

1 Like

Jeff, thank you very much for the reply. That answers my question and also clarifies that what we are doing in our code is not braindead and/or buggy.