Skip to content

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

Merged
jk-ozlabs merged 7 commits into
CodeConstruct:mainfrom
jk-ozlabs:dev/refactor-retry
May 28, 2026
Merged

Command submission / completion refactor, making retry logic common#154
jk-ozlabs merged 7 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.

@FreddieJheng-quanta
Copy link
Copy Markdown
Contributor

Thanks for the refactor

jk-ozlabs and others added 7 commits May 28, 2026 13:22
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>
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>
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>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
@jk-ozlabs jk-ozlabs force-pushed the dev/refactor-retry branch from d616ab5 to 4186b5a Compare May 28, 2026 05:26
@jk-ozlabs jk-ozlabs merged commit 4186b5a into CodeConstruct:main May 28, 2026
3 checks passed
@jk-ozlabs jk-ozlabs deleted the dev/refactor-retry branch May 28, 2026 05:30
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