Skip to content

Commit 1b70635

Browse files
committed
prov/efa: Require FI_RX_CQ_DATA on devices without unsolicited write recv
When unsolicited write recv is not supported, RDMA write with immediate data operations consume an RX buffer, requiring the FI_RX_CQ_DATA mode bit to be set for FI_RMA. cq_data_size shouldn't be used to indicate support for fi_writedata because there are reasonable use cases where the cq_data_size is 0 and the completion needs to be generated. Signed-off-by: Jessie Yang <[email protected]>
1 parent 0bf920f commit 1b70635

File tree

4 files changed

+13
-31
lines changed

4 files changed

+13
-31
lines changed

prov/efa/src/efa_user_info.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -478,18 +478,12 @@ int efa_user_info_alter_direct(int version, struct fi_info *info, const struct f
478478
* RDMA with immediate needs to consume a recv buffer
479479
* when unsolicited write recv is not supported. So
480480
* FI_RX_CQ_DATA is required when application requests
481-
* a non-zero cq data size in this situation.
481+
* FI_RMA.
482482
*/
483-
if (hints->domain_attr &&
484-
hints->domain_attr->cq_data_size > 0) {
485-
EFA_INFO(FI_LOG_CORE,
486-
"FI_RX_CQ_DATA is required for FI_RMA + "
487-
"non-zero cq data when unsolicited write recv "
488-
"is not supported \n");
489-
return -FI_ENODATA;
490-
} else {
491-
info->domain_attr->cq_data_size = 0;
492-
}
483+
EFA_INFO(FI_LOG_CORE,
484+
"FI_RX_CQ_DATA is required for FI_RMA when "
485+
"unsolicited write recv is not supported.\n");
486+
return -FI_ENODATA;
493487
}
494488
/*
495489
* Handle user-provided hints and adapt the info object passed back up

prov/efa/test/efa_unit_test_info.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,7 @@ void test_info_reuse_domain_via_name()
944944
test_info_reuse_fabric_domain(setup_domain_name_hints, true, true);
945945
}
946946
static void test_info_direct_rma_common(bool mock_unsolicited_write_recv, bool set_rx_cq_data,
947-
size_t request_cq_data_size, int expected_err,
948-
size_t expected_cq_data_size, bool expect_rx_cq_data_mode)
947+
int expected_err, size_t expected_cq_data_size, bool expect_rx_cq_data_mode)
949948
{
950949
struct fi_info *hints, *info;
951950
int err;
@@ -959,8 +958,6 @@ static void test_info_direct_rma_common(bool mock_unsolicited_write_recv, bool s
959958
hints->caps |= FI_RMA;
960959
if (set_rx_cq_data)
961960
hints->mode |= FI_RX_CQ_DATA;
962-
if (request_cq_data_size > 0)
963-
hints->domain_attr->cq_data_size = request_cq_data_size;
964961

965962
err = fi_getinfo(FI_VERSION(1, 18), NULL, NULL, 0ULL, hints, &info);
966963
fi_freeinfo(hints);
@@ -989,15 +986,15 @@ static void test_info_direct_rma_common(bool mock_unsolicited_write_recv, bool s
989986
*/
990987
void test_info_direct_rma_when_no_unsolicited_write_recv_and_rx_cq_data()
991988
{
992-
test_info_direct_rma_common(false, true, 0, 0, 4, true);
989+
test_info_direct_rma_common(false, true, 0, 4, true);
993990
}
994991

995992
/**
996-
* @brief Test that when FI_RX_CQ_DATA is not requested and unsolicited write recv is OFF, cq_data_size is 0
993+
* @brief Test that when FI_RX_CQ_DATA is not requested and unsolicited write recv is OFF, fi_getinfo fails
997994
*/
998-
void test_info_direct_rma_when_no_rx_cq_data_and_zero_cq_data_size()
995+
void test_info_direct_rma_when_no_unsolicited_write_recv_and_no_rx_cq_data()
999996
{
1000-
test_info_direct_rma_common(false, false, 0, 0, 0, false);
997+
test_info_direct_rma_common(false, false, -FI_ENODATA, 0, false);
1001998
}
1002999

10031000
/**
@@ -1006,12 +1003,5 @@ void test_info_direct_rma_when_no_rx_cq_data_and_zero_cq_data_size()
10061003
void test_info_direct_rma_when_unsolicited_write_recv_on_and_no_rx_cq_data()
10071004
{
10081005
return;
1009-
test_info_direct_rma_common(true, false, 0, 0, 4, false);
1010-
}
1011-
/**
1012-
* @brief Test that when user requests non-zero cq_data_size but unsolicited write recv is OFF, fi_getinfo fails
1013-
*/
1014-
void test_info_direct_rma_when_no_unsolicited_write_recv_and_nonzero_cq_data_size_and_no_rx_cq_data()
1015-
{
1016-
test_info_direct_rma_common(false, false, 4, -FI_ENODATA, 0, false);
1006+
test_info_direct_rma_common(true, false, 0, 4, false);
10171007
}

prov/efa/test/efa_unit_tests.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,8 @@ int main(void)
267267
cmocka_unit_test_setup_teardown(test_efa_use_device_rdma_opt0, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
268268
cmocka_unit_test_setup_teardown(test_efa_use_device_rdma_opt_old, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
269269
cmocka_unit_test_setup_teardown(test_info_direct_rma_when_no_unsolicited_write_recv_and_rx_cq_data, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
270-
cmocka_unit_test_setup_teardown(test_info_direct_rma_when_no_rx_cq_data_and_zero_cq_data_size, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
270+
cmocka_unit_test_setup_teardown(test_info_direct_rma_when_no_unsolicited_write_recv_and_no_rx_cq_data, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
271271
cmocka_unit_test_setup_teardown(test_info_direct_rma_when_unsolicited_write_recv_on_and_no_rx_cq_data, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
272-
cmocka_unit_test_setup_teardown(test_info_direct_rma_when_no_unsolicited_write_recv_and_nonzero_cq_data_size_and_no_rx_cq_data, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),
273272
/* end efa_unit_test_info.c */
274273

275274
cmocka_unit_test_setup_teardown(test_efa_hmem_info_update_neuron, efa_unit_test_mocks_setup, efa_unit_test_mocks_teardown),

prov/efa/test/efa_unit_tests.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,8 @@ void test_efa_use_device_rdma_env1();
230230
void test_efa_use_device_rdma_env0();
231231
void test_efa_use_device_rdma_opt_old();
232232
void test_info_direct_rma_when_no_unsolicited_write_recv_and_rx_cq_data();
233-
void test_info_direct_rma_when_no_rx_cq_data_and_zero_cq_data_size();
233+
void test_info_direct_rma_when_no_unsolicited_write_recv_and_no_rx_cq_data();
234234
void test_info_direct_rma_when_unsolicited_write_recv_on_and_no_rx_cq_data();
235-
void test_info_direct_rma_when_no_unsolicited_write_recv_and_nonzero_cq_data_size_and_no_rx_cq_data();
236235
/* end efa_unit_test_info.c */
237236

238237
void test_efa_srx_min_multi_recv_size();

0 commit comments

Comments
 (0)