Skip to content

Commit

Permalink
prov/efa: set ep_attr->max_msg_size according to hints
Browse files Browse the repository at this point in the history
ep_attr->max_msg_size is currently set to UINT64_MAX. As a result the
application cannot enable zero-copy recv.

Signed-off-by: Wenduo Wang <[email protected]>
  • Loading branch information
wenduwan authored and shijin-aws committed Apr 3, 2024
1 parent d187bde commit 642fc3a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
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

0 comments on commit 642fc3a

Please sign in to comment.