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 committed Oct 2, 2023
1 parent 967f914 commit b8feb5a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions prov/efa/src/efa_user_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ int efa_user_info_alter_rdm(int version, struct fi_info *info, const struct fi_i
if (hints->domain_attr && hints->domain_attr->mr_mode & FI_MR_LOCAL)
info->domain_attr->mr_mode |= FI_MR_LOCAL;

if (hints->ep_attr)
info->ep_attr->max_msg_size =
MIN(info->ep_attr->max_msg_size,
hints->ep_attr->max_msg_size);

/*
* Same goes for prefix mode, where the protocol does not
* absolutely need a prefix before receive buffers, but it can
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 @@ -99,6 +99,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 @@ -103,6 +103,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 @@ -112,6 +112,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 b8feb5a

Please sign in to comment.