Skip to content

Commit 5966533

Browse files
authored
Add ut for _ibv_query_gid_ex _ibv_query_gid_table calls (#30472)
1 parent 30bfd7f commit 5966533

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

ydb/library/actors/interconnect/rdma/ut/ibv_ut.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,33 @@ TEST_F(TIbvSuite, ListDevice) {
2020
ibv_device_attr devAttrs;
2121
UNIT_ASSERT_C(ibv_query_device(ctx, &devAttrs) == 0, strerror(errno));
2222

23+
{
24+
std::array<ibv_gid_entry, 10> entries;
25+
ssize_t rv = ibv_query_gid_table(ctx, entries.data(), entries.size(), 0);
26+
UNIT_ASSERT(rv > 0);
27+
bool roceV2Found = false;
28+
for (ssize_t i = 0; i < rv; i++) {
29+
roceV2Found |= (entries[i].gid_type == IBV_GID_TYPE_ROCE_V2);
30+
}
31+
UNIT_ASSERT(roceV2Found);
32+
}
33+
2334
for (int port = 1; port <= devAttrs.phys_port_cnt; ++port) {
2435
ibv_port_attr portAttrs;
2536
UNIT_ASSERT_C(ibv_query_port(ctx, port, &portAttrs) == 0, strerror(errno));
2637
Cerr << "port " << port << " speed: " << (int)portAttrs.active_speed << Endl;
38+
39+
bool roceV2Found = false;
40+
for (int gidIndex = 0; gidIndex < portAttrs.gid_tbl_len; gidIndex++ ) {
41+
struct ibv_gid_entry entry;
42+
Cerr << "port: " << port << " " << gidIndex << Endl;
43+
int rv = ibv_query_gid_ex(ctx, port, gidIndex, &entry, 0);
44+
if (rv < 0) {
45+
continue;
46+
}
47+
roceV2Found |= (entry.gid_type == IBV_GID_TYPE_ROCE_V2);
48+
}
49+
UNIT_ASSERT(roceV2Found);
2750
}
2851

2952
UNIT_ASSERT(ibv_close_device(ctx) == 0);

0 commit comments

Comments
 (0)