Skip to content

Commit

Permalink
IB/BASE: Fixes #8595
Browse files Browse the repository at this point in the history
The code move RDMA transport check to MD level and prevents
MD creation if the underlying NIC is not supported.
  • Loading branch information
shamisp committed Oct 18, 2022
1 parent a133f2d commit b3252f0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
11 changes: 0 additions & 11 deletions src/uct/ib/base/ib_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,6 @@ static unsigned long uct_ib_device_get_ib_gid_index(uct_ib_md_t *md)
}
}

static int uct_ib_device_is_iwarp(uct_ib_device_t *dev)
{
return dev->ibv_context->device->transport_type == IBV_TRANSPORT_IWARP;
}

ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
unsigned flags)
{
Expand All @@ -774,12 +769,6 @@ ucs_status_t uct_ib_device_port_check(uct_ib_device_t *dev, uint8_t port_num,
return UCS_ERR_UNREACHABLE;
}

if (uct_ib_device_is_iwarp(dev)) {
/* TODO: enable it when support is ready */
ucs_debug("iWarp device %s is not supported", uct_ib_device_name(dev));
return UCS_ERR_UNSUPPORTED;
}

if (!uct_ib_device_is_port_ib(dev, port_num) && (flags & UCT_IB_DEVICE_FLAG_LINK_IB)) {
ucs_debug("%s:%d is not IB link layer", uct_ib_device_name(dev),
port_num);
Expand Down
38 changes: 37 additions & 1 deletion src/uct/ib/base/ib_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,42 @@ static uct_md_ops_t UCS_V_UNUSED uct_ib_md_global_odp_ops = {
.detect_memory_type = ucs_empty_function_return_unsupported,
};

static const char *uct_ib_device_transport_type_name(struct ibv_device *device)
{
switch (device->transport_type) {
case IBV_TRANSPORT_IB:
return "InfiniBand";
case IBV_TRANSPORT_IWARP:
return "iWARP";
#if HAVE_DECL_IBV_TRANSPORT_USNIC
case IBV_TRANSPORT_USNIC:
return "usNIC";
#endif
#if HAVE_DECL_IBV_TRANSPORT_USNIC_UDP
case IBV_TRANSPORT_USNIC_UDP:
return "usNIC UDP";
#endif
#if HAVE_DECL_IBV_TRANSPORT_UNSPECIFIED
case IBV_TRANSPORT_UNSPECIFIED:
return "Unspecified";
#endif
default:
return "Unknown";
}
}

static int uct_ib_device_is_supported(struct ibv_device *device)
{
/* TODO: enable additional transport types when ready */
int ret = device->transport_type == IBV_TRANSPORT_IB;
if (!ret) {
ucs_debug("device %s of type %s is not supported",
device->dev_name, uct_ib_device_transport_type_name(device));
}

return ret;
}

int uct_ib_device_is_accessible(struct ibv_device *device)
{
/* Enough place to hold the full path */
Expand All @@ -1248,7 +1284,7 @@ int uct_ib_device_is_accessible(struct ibv_device *device)
return 0;
}

return 1;
return uct_ib_device_is_supported(device);
}

static ucs_status_t uct_ib_query_md_resources(uct_component_t *component,
Expand Down
3 changes: 3 additions & 0 deletions src/uct/ib/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ AS_IF([test "x$with_ib" = "xyes"],
AC_CHECK_DECLS([IBV_LINK_LAYER_INFINIBAND,
IBV_LINK_LAYER_ETHERNET,
IBV_EVENT_GID_CHANGE,
IBV_TRANSPORT_USNIC,
IBV_TRANSPORT_USNIC_UDP,
IBV_TRANSPORT_UNSPECIFIED,
ibv_create_qp_ex,
ibv_create_cq_ex,
ibv_create_srq_ex],
Expand Down

0 comments on commit b3252f0

Please sign in to comment.