diff --git a/prov/efa/src/efa_user_info.c b/prov/efa/src/efa_user_info.c index 8eef343d9d0..1484deb629a 100644 --- a/prov/efa/src/efa_user_info.c +++ b/prov/efa/src/efa_user_info.c @@ -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 diff --git a/prov/efa/test/efa_unit_test_info.c b/prov/efa/test/efa_unit_test_info.c index bec039a6462..5c5b6743fd3 100644 --- a/prov/efa/test/efa_unit_test_info.c +++ b/prov/efa/test/efa_unit_test_info.c @@ -99,6 +99,26 @@ 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); + 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(hints->ep_attr->max_msg_size, info->ep_attr->max_msg_size); + + fi_freeinfo(info); + fi_freeinfo(hints); +} + static void test_info_check_shm_info_from_hints(struct fi_info *hints) { struct fi_info *info; diff --git a/prov/efa/test/efa_unit_tests.c b/prov/efa/test/efa_unit_tests.c index 1091d4540ff..c1a11f4721a 100644 --- a/prov/efa/test/efa_unit_tests.c +++ b/prov/efa/test/efa_unit_tests.c @@ -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), diff --git a/prov/efa/test/efa_unit_tests.h b/prov/efa/test/efa_unit_tests.h index dc5b01c664d..c5b1d9c73ea 100644 --- a/prov/efa/test/efa_unit_tests.h +++ b/prov/efa/test/efa_unit_tests.h @@ -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();