From b3252f0fe27841cf3f6d224565d13ad256beecc3 Mon Sep 17 00:00:00 2001 From: "Pavel (Pasha) Shamis" Date: Thu, 6 Oct 2022 17:02:44 -0500 Subject: [PATCH] IB/BASE: Fixes #8595 The code move RDMA transport check to MD level and prevents MD creation if the underlying NIC is not supported. --- src/uct/ib/base/ib_device.c | 11 ----------- src/uct/ib/base/ib_md.c | 38 ++++++++++++++++++++++++++++++++++++- src/uct/ib/configure.m4 | 3 +++ 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/uct/ib/base/ib_device.c b/src/uct/ib/base/ib_device.c index a7d2da11b34..6db5e3eda18 100644 --- a/src/uct/ib/base/ib_device.c +++ b/src/uct/ib/base/ib_device.c @@ -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) { @@ -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); diff --git a/src/uct/ib/base/ib_md.c b/src/uct/ib/base/ib_md.c index cc2ec461fa1..9d748737ad2 100644 --- a/src/uct/ib/base/ib_md.c +++ b/src/uct/ib/base/ib_md.c @@ -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 */ @@ -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, diff --git a/src/uct/ib/configure.m4 b/src/uct/ib/configure.m4 index a5c44cc87cf..74e5cd1716a 100644 --- a/src/uct/ib/configure.m4 +++ b/src/uct/ib/configure.m4 @@ -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],