mctpd: Support MCTP Discovery Notify command - #165
Open
chajasmine-bit wants to merge 1 commit into
Open
Conversation
chajasmine-bit
force-pushed
the
discovery-notify
branch
4 times, most recently
from
August 3, 2026 05:23
4bee8eb to
9274ea2
Compare
In MCTP networks, endpoints broadcast or send a Discovery Notify control request (0x0D) to inform the Bus Owner when they boot up, reset, or are hot-plugged. Currently, mctpd relies on active bus scanning or static configurations, leaving newly online endpoints undiscovered until the next poll cycle. This change adds support for handling Discovery Notify requests when mctpd is in the Bus Owner role: - Immediately acknowledges Discovery Notify requests over the physical socket with MCTP_CTRL_CC_SUCCESS inside handle_control_discovery_notify() to prevent hardware endpoints (e.g. PCIe VDMs / SMBus sequencers) from dropping subsequent Set Endpoint ID requests while waiting for an ACK. - Asynchronously defers EID assignment and route programming (RTM_NEWROUTE) to the systemd event loop (sd_event_add_defer) to prevent thread blocking. - Safely handles event deferral failures by dropping the request and returning -ENOMEM rather than executing synchronously in receive context, eliminating re-entrance and event loop corruption risks. - Scopes request deduplication to (ifindex, dest_phys) composite keys to prevent cross-bus address collisions on multi-bus platforms. - Enforces per-interface rate-limiting (maximum 5 discovery requests per second) to protect against discovery request floods. - Correctly supports Bridge Endpoints by reserving EID pools and invoking endpoint_allocate_eids() for downstream pool allocation and gateway routing. - Includes comprehensive unit test coverage in test_mctpd.py and test_mctpd_endpoint.py. Assisted-by: Antigravity:Gemini-Next Signed-off-by: Jasmine Cha <chajasmine@google.com>
chajasmine-bit
force-pushed
the
discovery-notify
branch
from
August 4, 2026 03:50
9274ea2 to
f6fbc3b
Compare
Member
|
I see there's been a few updates; let me know when this is stable and you'd like a review. |
Author
The code is ready for review, please take a look at this. Thanks. |
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.
Implement support for the MCTP Discovery Notify control command in mctpd. When an MCTP endpoint issues a Discovery Notify control request to the Bus Owner, mctpd immediately acknowledges the request over the physical socket and defers EID assignment to the main systemd event loop.
This avoids blocking the event thread during control message processing and safely handles EID re-assignments via change_peer_eid(), keeping D-Bus object paths and netlink kernel routing tables synchronized. Also include unit test coverage for Discovery Notify in the test suite.
Assisted-by: Antigravity:Gemini-Next