diff --git a/prov/efa/src/efa_user_info.c b/prov/efa/src/efa_user_info.c index c0c3d88b8ba..167ea71b32d 100644 --- a/prov/efa/src/efa_user_info.c +++ b/prov/efa/src/efa_user_info.c @@ -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 */ diff --git a/prov/efa/test/efa_unit_test_info.c b/prov/efa/test/efa_unit_test_info.c index f9b9c90ed81..123f54dab85 100644 --- a/prov/efa/test/efa_unit_test_info.c +++ b/prov/efa/test/efa_unit_test_info.c @@ -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; diff --git a/prov/efa/test/efa_unit_tests.c b/prov/efa/test/efa_unit_tests.c index 6b706da8a29..9667ebd2098 100644 --- a/prov/efa/test/efa_unit_tests.c +++ b/prov/efa/test/efa_unit_tests.c @@ -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), diff --git a/prov/efa/test/efa_unit_tests.h b/prov/efa/test/efa_unit_tests.h index 8e28ef2989f..fea976ecf9c 100644 --- a/prov/efa/test/efa_unit_tests.h +++ b/prov/efa/test/efa_unit_tests.h @@ -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();