Skip to content

Commit 48952dc

Browse files
authored
UCT/IB: Only query RoCE type for valid GID to avoid logs (#11237)
1 parent c2855a4 commit 48952dc

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

src/uct/ib/base/ib_device.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,8 @@ static unsigned long uct_ib_device_get_ib_gid_index(uct_ib_md_t *md)
766766
}
767767
}
768768

769-
ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
770-
unsigned flags)
769+
static ucs_status_t
770+
uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num, unsigned flags)
771771
{
772772
uct_ib_md_t *md = ucs_container_of(dev, uct_ib_md_t, dev);
773773
const uct_ib_device_spec_t *dev_info;
@@ -827,6 +827,11 @@ ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
827827
status = uct_ib_device_query_gid(dev, port_num, gid_index, &gid,
828828
UCS_LOG_LEVEL_DIAG);
829829
if (status != UCS_OK) {
830+
if (status == UCS_ERR_INVALID_ADDR) {
831+
ucs_trace("%s:%d (%s) has invalid address", uct_ib_device_name(dev),
832+
port_num, dev_info->name);
833+
}
834+
830835
return status;
831836
}
832837

@@ -934,6 +939,10 @@ uct_ib_device_query_gid_info(struct ibv_context *ctx, const char *dev_name,
934939

935940
ret = ibv_query_gid(ctx, port_num, gid_index, &info->gid);
936941
if (ret == 0) {
942+
if (!uct_ib_device_is_gid_valid(&info->gid)) {
943+
return UCS_ERR_INVALID_ADDR;
944+
}
945+
937946
ret = ucs_read_file(buf, sizeof(buf) - 1, 1,
938947
UCT_IB_DEVICE_SYSFS_GID_TYPE_FMT,
939948
dev_name, port_num, gid_index);
@@ -1178,6 +1187,10 @@ uct_ib_device_select_gid(uct_ib_device_t *dev, uint8_t port_num,
11781187
status = uct_ib_device_query_gid_info(dev->ibv_context,
11791188
uct_ib_device_name(dev),
11801189
port_num, i, &gid_info_tmp);
1190+
if (status == UCS_ERR_INVALID_ADDR) {
1191+
continue;
1192+
}
1193+
11811194
if (status != UCS_OK) {
11821195
goto out;
11831196
}
@@ -1430,18 +1443,14 @@ ucs_status_t uct_ib_device_query_gid(uct_ib_device_t *dev, uint8_t port_num,
14301443

14311444
status = uct_ib_device_query_gid_info(dev->ibv_context, uct_ib_device_name(dev),
14321445
port_num, gid_index, &gid_info);
1433-
if (status != UCS_OK) {
1434-
return status;
1435-
}
1436-
1437-
if (!uct_ib_device_is_gid_valid(&gid_info.gid)) {
1446+
if (status == UCS_OK) {
1447+
*gid = gid_info.gid;
1448+
} else if (status == UCS_ERR_INVALID_ADDR) {
14381449
ucs_log(error_level, "invalid gid[%d] on %s:%d", gid_index,
14391450
uct_ib_device_name(dev), port_num);
1440-
return UCS_ERR_INVALID_ADDR;
14411451
}
14421452

1443-
*gid = gid_info.gid;
1444-
return UCS_OK;
1453+
return status;
14451454
}
14461455

14471456
const char *uct_ib_wc_status_str(enum ibv_wc_status wc_status)

src/uct/ib/base/ib_device.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,6 @@ typedef struct {
278278
extern const double uct_ib_qp_rnr_time_ms[];
279279

280280

281-
/**
282-
* Check if a port on a device is active and supports the given flags.
283-
*/
284-
ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
285-
unsigned flags);
286-
287-
288281
/**
289282
* Helper function to set ECE to qp.
290283
*

src/uct/ib/ud/base/ud_iface.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,12 @@ static ucs_status_t uct_ud_iface_gid_hash_init(uct_ud_iface_t *iface,
378378
status = uct_ib_device_query_gid_info(dev->ibv_context,
379379
uct_ib_device_name(dev),
380380
port, gid_idx, &gid_info);
381-
if (status != UCS_OK) {
382-
goto err;
381+
if (status == UCS_ERR_INVALID_ADDR) {
382+
continue;
383383
}
384384

385-
if (!memcmp(&gid_info.gid, &zero_gid, sizeof(zero_gid))) {
386-
continue;
385+
if (status != UCS_OK) {
386+
goto err;
387387
}
388388

389389
ucs_debug("iface %p: adding gid %s to hash on device %s port %d index "

0 commit comments

Comments
 (0)