prov/efa: subtract prefix size in inject assertion for dgram#12138
Merged
jiaxiyan merged 1 commit intoofiwg:mainfrom Apr 14, 2026
Merged
prov/efa: subtract prefix size in inject assertion for dgram#12138jiaxiyan merged 1 commit intoofiwg:mainfrom
jiaxiyan merged 1 commit intoofiwg:mainfrom
Conversation
sunkuamzn
previously approved these changes
Apr 13, 2026
| 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); |
Contributor
There was a problem hiding this comment.
Could you please add a comment
For non-dgram endpoints, msg_prefix_size is 0
Contributor
There was a problem hiding this comment.
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>
sunkuamzn
approved these changes
Apr 13, 2026
shijin-aws
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.