Skip to content

Commit

Permalink
assert MDL reuse correctness in generic XDP (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfriesen authored Apr 11, 2023
1 parent b29fda4 commit 0811c9d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/xdplwf/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0811c9d

Please sign in to comment.