Skip to content

mctpd: Improve sequencing of Set Endpoint ID responses in endpoint mode#157

Open
jk-ozlabs wants to merge 3 commits into
CodeConstruct:mainfrom
jk-ozlabs:dev/endpoint-set-eid-sequencing
Open

mctpd: Improve sequencing of Set Endpoint ID responses in endpoint mode#157
jk-ozlabs wants to merge 3 commits into
CodeConstruct:mainfrom
jk-ozlabs:dev/endpoint-set-eid-sequencing

Conversation

@jk-ozlabs

@jk-ozlabs jk-ozlabs commented Jun 11, 2026

Copy link
Copy Markdown
Member

When running in endpoint mode, mctpd's Set Endpoint ID command handler will trigger an enumeration of the peer (ie, the bus owner that issued the Set Endpoint ID command).

Currently, that enumeration occurs before we send the Set Endpoint ID response, which is a little unexpected: at that point, the bus owner has not received any indication that the command completed successfully. Also, the wait on the set of peer-enumeration commands may delay the Set Endpoint ID response beyond a command timeout.

So, respond to the Set Endpoint ID command first, then perform peer enumeration. This requires a minor rework to the setup_endpoint_peer() process, as we will need to establish routes beforehand.

setup_added_peer() does a few things:

 - adds the local route
 - queries the peer for UUID and message types
 - publishes the peer to dbus

We will need the local route established earlier in some cases, so move
this out of setup_added_peer.

We have five current callers:

 - peer_endpoint_poll(), which already relies on a bridge pool route to
   be present

 - the endpoint Set Endpoint ID handler, where we add a new
   add_peer_route()

 - endpoint_assign_eid(), which already has an add_peer_route()

 - get_endpoint_peer(), which only needs a route added in some cases,
   where the endpoint was not previously known (the change_peer_eid()
   will also set up the new route)

 - method_setup_endpoint, where we add a new add_peer_route()

This involves correcting the route counts in a couple of test cases:
these are was expecting two routes to be present (assumed to be the
local route and the new peer route), but they are duplicates, as a
result of the existing add_peer_route(), setup_added_peer() in the
existing Set Endpoint ID handler.

Conveniently, the setup_added_peer()'s comment will now match the
implementation.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
The peer setup will issue queries to the (bus owner) peer, and we will
block waiting on responses to those.

Respond to the Set Endpoint ID command first, then perform the queries.

Reported-by: Nidhin MS <nidhin.ms@intel.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant