pktmon: add support for dynamic pktmon registration#1034
Merged
Conversation
When pktmon loads after XDP has already established bindings, the XdpPktMonRegistrationCallback is invoked by the NMR provider attach. Previously this callback was a no-op, so XDP bindings established before pktmon would not appear in pktmon traces. Maintain a global list of active XDP_LWF_GENERIC instances protected by an EX_PUSH_LOCK. On generic attach, add the instance to the list; on detach, remove it. When the pktmon registration callback fires, iterate the list and register (or re-register) pktmon component contexts for each active generic. Use WritePointerRelease when publishing PktMonContext to ensure the datapath sees consistent state. Fix a pre-existing race between the control path freeing PktMonContext and the datapath reading it at DISPATCH_LEVEL. Add EX_RUNDOWN_REF to XDP_LWF_GENERIC so the datapath acquires rundown protection before accessing PktMonContext, and the control path waits for all in-flight references to drain before freeing the context. Add TryDisable/TryEnable helpers to TestInterface and a functional test (GenericPktMonRegistration) that exercises four scenarios: 1. Adapter enabled while pktmon is loaded -> xdp.sys registered. 2. Adapter disabled -> xdp.sys unregistered. 3. Adapter enabled before pktmon is loaded -> xdp.sys registered. 4. Pktmon restarted while adapter is enabled -> xdp.sys re-registered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mtfriesen
reviewed
Jun 16, 2026
mtfriesen
reviewed
Jun 16, 2026
mtfriesen
reviewed
Jun 16, 2026
Contributor
Author
|
Clearly something broken according to CI, investigating... UPDATE: narrowed down to Mellanox issue. Disabling Mellanox Virtual Adapter during the test case as a workaround |
mtfriesen
reviewed
Jun 20, 2026
This reverts commit 9ee7590.
mtfriesen
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add support for dynamic pktmon registration (pktmon can load after XDP bindings are established).
Testing
Documentation
N/A
Installation
N/A