Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prov/efa: set ep_attr->max_msg_size according to hints #9388

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions prov/efa/src/efa_user_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@ int efa_user_info_alter_rdm(int version, struct fi_info *info, const struct fi_i
EFA_INFO(FI_LOG_CORE,
"FI_MSG_PREFIX size = %ld\n", info->ep_attr->msg_prefix_size);
}

/* Handle other EP attributes */
if (hints->ep_attr) {
if (hints->ep_attr->max_msg_size) {
info->ep_attr->max_msg_size =
MIN(info->ep_attr->max_msg_size,
hints->ep_attr->max_msg_size);
}
}
}

/* Use a table for AV if the app has no strong requirement */
Expand Down
22 changes: 22 additions & 0 deletions prov/efa/test/efa_unit_test_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,28 @@ void test_info_open_ep_with_api_1_1_info()
assert_int_equal(err, 0);
}

/**
* @brief Verify info->ep_attr is set according to hints.
*
*/
void test_info_ep_attr()
{
struct fi_info *hints, *info;
int err;

hints = efa_unit_test_alloc_hints(FI_EP_RDM);
assert_non_null(hints);

hints->ep_attr->max_msg_size = 1024;

err = fi_getinfo(FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION), NULL, NULL, 0ULL, hints, &info);

assert_int_equal(err, 0);
assert_int_equal(hints->ep_attr->max_msg_size, info->ep_attr->max_msg_size);

fi_freeinfo(info);
}

static void test_info_check_shm_info_from_hints(struct fi_info *hints)
{
struct fi_info *info;
Expand Down
1 change: 1 addition & 0 deletions prov/efa/test/efa_unit_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ int main(void)
cmocka_unit_test_setup_teardown(test_rdm_fallback_to_ibv_create_cq_ex_cq_read_ignore_forgotton_peer, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
cmocka_unit_test_setup_teardown(test_info_open_ep_with_wrong_info, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
cmocka_unit_test_setup_teardown(test_info_open_ep_with_api_1_1_info, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
cmocka_unit_test_setup_teardown(test_info_ep_attr, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
cmocka_unit_test_setup_teardown(test_info_check_shm_info_hmem, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
cmocka_unit_test_setup_teardown(test_info_check_shm_info_op_flags, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
cmocka_unit_test_setup_teardown(test_info_check_shm_info_threading, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
Expand Down
1 change: 1 addition & 0 deletions prov/efa/test/efa_unit_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ void test_rdm_fallback_to_ibv_create_cq_ex_cq_read_ignore_forgotton_peer();
void test_ibv_cq_ex_read_ignore_removed_peer();
void test_info_open_ep_with_wrong_info();
void test_info_open_ep_with_api_1_1_info();
void test_info_ep_attr();
void test_info_check_shm_info_hmem();
void test_info_check_shm_info_op_flags();
void test_info_check_shm_info_threading();
Expand Down