Skip to content

Commit

Permalink
Merge pull request #10042 from michal-shalev/fix-invalid-gids-filter
Browse files Browse the repository at this point in the history
UCT/IB: fix invalid GIDs filter
  • Loading branch information
michal-shalev authored Aug 8, 2024
2 parents 0e38d4d + bb1401e commit bb5d8bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/uct/ib/base/ib_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,9 +1283,9 @@ ucs_status_t uct_ib_device_mtu(const char *dev_name, uct_md_h md, int *p_mtu)
return UCS_OK;
}

int uct_ib_device_is_gid_raw_empty(uint8_t *gid_raw)
int uct_ib_device_is_gid_valid(const union ibv_gid *gid)
{
return (*(uint64_t *)gid_raw == 0) && (*(uint64_t *)(gid_raw + 8) == 0);
return gid->global.interface_id != 0;
}

ucs_status_t uct_ib_device_query_gid(uct_ib_device_t *dev, uint8_t port_num,
Expand All @@ -1301,7 +1301,7 @@ ucs_status_t uct_ib_device_query_gid(uct_ib_device_t *dev, uint8_t port_num,
return status;
}

if (uct_ib_device_is_gid_raw_empty(gid_info.gid.raw)) {
if (!uct_ib_device_is_gid_valid(&gid_info.gid)) {
ucs_log(error_level, "invalid gid[%d] on %s:%d", gid_index,
uct_ib_device_name(dev), port_num);
return UCS_ERR_INVALID_ADDR;
Expand Down
4 changes: 2 additions & 2 deletions src/uct/ib/base/ib_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ int uct_ib_device_is_port_roce(uct_ib_device_t *dev, uint8_t port_num);


/**
* @return 1 if the gid_raw is 0, 0 otherwise.
* @return whether the gid is valid
*/
int uct_ib_device_is_gid_raw_empty(uint8_t *gid_raw);
int uct_ib_device_is_gid_valid(const union ibv_gid *gid);


/**
Expand Down
2 changes: 1 addition & 1 deletion test/gtest/uct/ib/test_ib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class test_uct_ib_gid_idx : public test_uct_ib_with_specific_port {
}

/* check if the gid is valid to use */
if (uct_ib_device_is_gid_raw_empty(gid.raw)) {
if (!uct_ib_device_is_gid_valid(&gid)) {
UCS_TEST_SKIP_R(device_str.str() + " is empty");
}

Expand Down

0 comments on commit bb5d8bf

Please sign in to comment.