Skip to content

prov/efa: subtract prefix size in inject assertion for dgram#12138

Merged
jiaxiyan merged 1 commit intoofiwg:mainfrom
jiaxiyan:dgram_inline
Apr 14, 2026
Merged

prov/efa: subtract prefix size in inject assertion for dgram#12138
jiaxiyan merged 1 commit intoofiwg:mainfrom
jiaxiyan:dgram_inline

Conversation

@jiaxiyan
Copy link
Copy Markdown
Contributor

The assertions in efa_ep_msg_inject() and efa_ep_msg_injectdata() compared the raw len (including the dgram prefix) against inline_buf_size. For dgram endpoints with a 40-byte prefix, this caused a false assertion failure when the application called fi_inject with payload that fits in inline_buf_size but total len (payload + prefix) exceeds it.

Subtract msg_prefix_size before comparing, consistent with how efa_post_send() already handles it. For non-dgram endpoints, msg_prefix_size is 0 so behavior is unchanged.

@jiaxiyan jiaxiyan requested a review from a team April 13, 2026 21:01
sunkuamzn
sunkuamzn previously approved these changes Apr 13, 2026
Comment thread prov/efa/src/efa_msg.c Outdated
struct iovec iov;

assert(len <= base_ep->domain->device->efa_attr.inline_buf_size);
assert(len - base_ep->info->ep_attr->msg_prefix_size <= base_ep->domain->device->efa_attr.inline_buf_size);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment

For non-dgram endpoints, msg_prefix_size is 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when len < base_ep->info->ep_attr->msg_prefix_size, is this still safe? Can we do len <= base_ep->domain->device->efa_attr.inline_buf_size + base_ep->info->ep_attr->msg_prefix_size

The assertions in efa_ep_msg_inject() and efa_ep_msg_injectdata()
compared the raw len (including the dgram prefix) against
inline_buf_size. For dgram endpoints with a 40-byte prefix, this
caused a false assertion failure when the application called
fi_inject with payload that fits in inline_buf_size but total len
(payload + prefix) exceeds it.

Subtract msg_prefix_size before comparing, consistent with how
efa_post_send() already handles it. For non-dgram endpoints,
msg_prefix_size is 0 so behavior is unchanged.

Signed-off-by: Jessie Yang <jiaxiyan@amazon.com>
@jiaxiyan jiaxiyan merged commit ceedd42 into ofiwg:main Apr 14, 2026
22 checks passed
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.

3 participants