@@ -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