Skip to content

mctp-linux: Use sendmsg() with iovecs instead of concatenating buffers#55

Merged
mkj merged 1 commit into
CodeConstruct:mainfrom
nathanjian7:use-iovecs
Jul 10, 2026
Merged

mctp-linux: Use sendmsg() with iovecs instead of concatenating buffers#55
mkj merged 1 commit into
CodeConstruct:mainfrom
nathanjian7:use-iovecs

Conversation

@nathanjian7

Copy link
Copy Markdown
Contributor

send_vectored() previously concatenated the caller's buffers into an allocated Vec before passing it to sendto().
This copied the entire message payload on every send.

Add MctpSocket::io_sendmsg() (and an async MctpSocketAsync::sendmsg() wrapper) that builds an iovec array
referencing the caller's buffers directly and passes it to sendmsg().

All four send_vectored() implementations (MctpLinuxReq, MctpLinuxAsyncReq, MctpLinuxResp,
MctpLinuxAsyncResp) are updated to use the new path, resolving the existing "implement sendmsg()
with iovecs" TODOs.

send_vectored() previously concatenated the caller's buffers into a
allocated Vec before passing it to sendto(). This copied the entire
message payload on every send.

Add MctpSocket::io_sendmsg() (and an async MctpSocketAsync::sendmsg()
wrapper) that builds an iovec array referencing the caller's buffers
directly and passes it to sendmsg().

All four send_vectored() implementations (MctpLinuxReq, MctpLinuxAsyncReq,
MctpLinuxResp, MctpLinuxAsyncResp) are updated to use the new path,
resolving the existing "implement sendmsg() with iovecs" TODOs.

Signed-off-by: Nathan Jian <nathan.jian7@gmail.com>
@mkj mkj merged commit 9a443f2 into CodeConstruct:main Jul 10, 2026
3 checks passed
@mkj

mkj commented Jul 10, 2026

Copy link
Copy Markdown
Member

Thanks! Out of curiosity, did you notice the old path being slow?

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