From 47585511b0c60c62f107472711ee05ed4c56b1a8 Mon Sep 17 00:00:00 2001 From: Michael Friesen <3517159+mtfriesen@users.noreply.github.com> Date: Tue, 11 Apr 2023 13:44:17 -0400 Subject: [PATCH] assert MDL reuse correctness in generic XDP --- src/xdplwf/send.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/xdplwf/send.c b/src/xdplwf/send.c index 21a9c5ae..0bdc3d1c 100644 --- a/src/xdplwf/send.c +++ b/src/xdplwf/send.c @@ -220,6 +220,17 @@ XdpGenericCompleteTx( *CompletionContext = NblTxContext(Nbl)->CompletionContext; } + // + // In lieu of calling MmPrepareMdlForReuse, assert our MDL did not get + // mapped by the memory manager: the original MDL should have been + // mapped by XDP itself, and the partial MDL inherited that mapping, + // precluding the need for it to be mapped by itself. + // + ASSERT(Nbl->FirstNetBuffer->Next == NULL); + ASSERT(Nbl->FirstNetBuffer->MdlChain->Next == NULL); + ASSERT(Nbl->FirstNetBuffer->MdlChain->MdlFlags & MDL_PARTIAL); + ASSERT((Nbl->FirstNetBuffer->MdlChain->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) == 0); + // Return the NBL to the TX free list. NT_VERIFY(TxQueue->OutstandingCount-- > 0); Nbl->Next = TxQueue->FreeNbls;