Skip to content

Command submission / completion refactor, making retry logic common#154

Open
jk-ozlabs wants to merge 8 commits into
CodeConstruct:mainfrom
jk-ozlabs:dev/refactor-retry
Open

Command submission / completion refactor, making retry logic common#154
jk-ozlabs wants to merge 8 commits into
CodeConstruct:mainfrom
jk-ozlabs:dev/refactor-retry

Conversation

@jk-ozlabs
Copy link
Copy Markdown
Member

A bit of a refactor to the MCTP command submission path, which allows us to implement a common retry mechanism (rather than having each top-level command caller implement its own retry logic).

Commands are now represented via a new struct:

struct mctp_ctrl_cmd {
	/* populated by caller */
	void *req;
	size_t req_len;
	bool disable_retry;

	/* populated on response RX */
	void *resp;
	size_t resp_len;
	struct sockaddr_mctp_ext resp_addr;
};

- which encapsulates the request & response buf/length, and retry behaviour.

This PR is based on functionality requested in #152; we want to re-use the command IID for retries.

jk-ozlabs and others added 8 commits April 30, 2026 16:29
We're a MCTP Control Protocol implementation, all our messages will be
the control protocol type.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Our arguments for endpoint_query_* are getting large; create a struct to
represent the command/response pair, and pass that around instead.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
We have a number of separate retry loops when querying peer properties.
Instead, use a common retry loop in the endpoint_query_addr path, which
can be disabled by a new 'disable_retry' member on struct mctp_ctrl_cmd.

This now enables retries for all commands, except the Get Endpoint ID
probe during a recover.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
We're currently reporting a failure from a Get Endpoint UUID command
through query_peer_properties, which will prevent endpoint setup.

Instead, don't return an error if the Get Endpoint UUID command fails;
this makes query_peer_properties() infallible, so change the return type
to void, and remove caller error handling.

Reported-by: Freddie Jheng <Freddie.Jheng@quantatw.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Add a test to verify that Control Protocol IIDs are re-used on a command
retry.

[This is based on an originial commit from Freddie Jheng
<Freddie.Jheng@quantatw.com>, containing the test cases from that
commit. Minor modifications from Jeremy Kerr <jk@codeconstruct.com.au>]

Signed-off-by: Freddie Jheng <Freddie.Jheng@quantatw.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
…t setup

The three peer query commands (Get Message Type Support, Get VDM
Support, and Get Endpoint UUID) may be unimplemented, but that shouldn't
prevent endpoint setup. Add a test for failures of these three commands.

In this case, "failure" may take two forms: the command response reports
ERROR_UNSUPPORTED_CMD, or the command is dropped altogether (not ideal,
but a lot of endpoints seem to do this). Check that either behaviour is
accepted.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Avoid multiple timeouts while polling downstream bridge endpoints. We'll
continue to poll on a command timeout anyway.

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.

2 participants