In addition to verbs implementation, efa provider implements direct verb for QP creation which allows users to create Scalable Reliable Datagram (SRD) QPs. Signed-off-by: Gal Pressman <galpress@xxxxxxxxxx> --- debian/ibverbs-providers.install | 1 + debian/ibverbs-providers.lintian-overrides | 4 +- debian/ibverbs-providers.symbols | 4 ++ debian/libibverbs-dev.install | 4 ++ providers/efa/CMakeLists.txt | 9 ++++- providers/efa/efadv.h | 59 ++++++++++++++++++++++++++++++ providers/efa/libefa.map | 7 ++++ providers/efa/verbs.c | 11 ++++++ redhat/rdma-core.spec | 1 + suse/rdma-core.spec | 18 +++++++++ 10 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 providers/efa/efadv.h create mode 100644 providers/efa/libefa.map diff --git a/debian/ibverbs-providers.install b/debian/ibverbs-providers.install index 43a8727f30e3..025a0e50f50c 100644 --- a/debian/ibverbs-providers.install +++ b/debian/ibverbs-providers.install @@ -2,3 +2,4 @@ etc/libibverbs.d/ usr/lib/*/libibverbs/lib*-rdmav*.so usr/lib/*/libmlx4.so.* usr/lib/*/libmlx5.so.* +usr/lib/*/libefa.so.* diff --git a/debian/ibverbs-providers.lintian-overrides b/debian/ibverbs-providers.lintian-overrides index a33f879e68ea..07b7acc8ae03 100644 --- a/debian/ibverbs-providers.lintian-overrides +++ b/debian/ibverbs-providers.lintian-overrides @@ -1,2 +1,2 @@ -# libmlx4 and libmlx5 are ibverbs provider that provides more functions. -ibverbs-providers: package-name-doesnt-match-sonames libmlx4-1 libmlx5-1 +# libmlx4, libmlx5 and libefa are ibverbs provider that provides more functions. +ibverbs-providers: package-name-doesnt-match-sonames libmlx4-1 libmlx5-1 libefa-1 diff --git a/debian/ibverbs-providers.symbols b/debian/ibverbs-providers.symbols index 9be0a9483dce..85bd5326f588 100644 --- a/debian/ibverbs-providers.symbols +++ b/debian/ibverbs-providers.symbols @@ -57,3 +57,7 @@ libmlx5.so.1 ibverbs-providers #MINVER# mlx5dv_devx_destroy_cmd_comp@MLX5_1.9 23 mlx5dv_devx_get_async_cmd_comp@MLX5_1.9 23 mlx5dv_devx_obj_query_async@MLX5_1.9 23 +libefa.so.1 ibverbs-providers #MINVER# +* Build-Depends-Package: libibverbs-dev + EFA_1.0@EFA_1.0 23 + efadv_create_driver_qp@EFA_1.0 23 diff --git a/debian/libibverbs-dev.install b/debian/libibverbs-dev.install index 19588068c43d..b0c77825fd6c 100644 --- a/debian/libibverbs-dev.install +++ b/debian/libibverbs-dev.install @@ -4,6 +4,7 @@ usr/include/infiniband/mlx4dv.h usr/include/infiniband/mlx5_api.h usr/include/infiniband/mlx5_user_ioctl_verbs.h usr/include/infiniband/mlx5dv.h +usr/include/infiniband/efadv.h usr/include/infiniband/opcode.h usr/include/infiniband/sa-kern-abi.h usr/include/infiniband/sa.h @@ -17,9 +18,12 @@ usr/lib/*/libmlx4.a usr/lib/*/libmlx4.so usr/lib/*/libmlx5.a usr/lib/*/libmlx5.so +usr/lib/*/libefa.a +usr/lib/*/libefa.so usr/lib/*/pkgconfig/libibverbs.pc usr/lib/*/pkgconfig/libmlx4.pc usr/lib/*/pkgconfig/libmlx5.pc +usr/lib/*/pkgconfig/libefa.pc usr/share/man/man3/ibv_* usr/share/man/man3/mbps_to_ibv_rate.3 usr/share/man/man3/mlx4dv_*.3 diff --git a/providers/efa/CMakeLists.txt b/providers/efa/CMakeLists.txt index 1fb6acaa4ecb..45385d032250 100644 --- a/providers/efa/CMakeLists.txt +++ b/providers/efa/CMakeLists.txt @@ -1,4 +1,11 @@ -rdma_provider(efa +rdma_shared_provider(efa libefa.map + 1 1.0.${PACKAGE_VERSION} efa.c verbs.c ) + +publish_headers(infiniband + efadv.h +) + +rdma_pkg_config("efa" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}") diff --git a/providers/efa/efadv.h b/providers/efa/efadv.h new file mode 100644 index 000000000000..a356305681ce --- /dev/null +++ b/providers/efa/efadv.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ +/* + * Copyright 2019 Amazon.com, Inc. or its affiliates. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __EFADV_H__ +#define __EFADV_H__ + +#include <stdio.h> +#include <sys/types.h> + +#include <infiniband/verbs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + /* Values must match the values in efa-abi.h */ + EFADV_QP_DRIVER_TYPE_SRD = 0, +}; + +struct ibv_qp *efadv_create_driver_qp(struct ibv_pd *ibvpd, + struct ibv_qp_init_attr *attr, + uint32_t driver_qp_type); + +#ifdef __cplusplus +} +#endif + +#endif /* __EFADV_H__ */ diff --git a/providers/efa/libefa.map b/providers/efa/libefa.map new file mode 100644 index 000000000000..110b5a438b80 --- /dev/null +++ b/providers/efa/libefa.map @@ -0,0 +1,7 @@ +/* Export symbols should be added below according to + Documentation/versioning.md document. */ +EFA_1.0 { + global: + efadv_create_driver_qp; + local: *; +}; diff --git a/providers/efa/verbs.c b/providers/efa/verbs.c index b821cf2f5d44..9ce0498dff6c 100644 --- a/providers/efa/verbs.c +++ b/providers/efa/verbs.c @@ -47,6 +47,7 @@ #include <util/mmio.h> #include "efa.h" +#include "efadv.h" #include "verbs.h" int efa_query_device(struct ibv_context *ibvctx, @@ -786,6 +787,16 @@ struct ibv_qp *efa_create_qp(struct ibv_pd *ibvpd, return create_qp(ibvpd, attr, 0); } +struct ibv_qp *efadv_create_driver_qp(struct ibv_pd *ibvpd, + struct ibv_qp_init_attr *attr, + uint32_t driver_qp_type) +{ + if (attr->qp_type != IBV_QPT_DRIVER) + return NULL; + + return create_qp(ibvpd, attr, driver_qp_type); +} + int efa_modify_qp(struct ibv_qp *ibvqp, struct ibv_qp_attr *attr, int attr_mask) { diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec index a3a2f6ded447..6c291aaff8a2 100644 --- a/redhat/rdma-core.spec +++ b/redhat/rdma-core.spec @@ -414,6 +414,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh %{_libdir}/libibverbs/*.so %{_libdir}/libmlx5.so.* %{_libdir}/libmlx4.so.* +%{_libdir}/libefa.so.* %config(noreplace) %{_sysconfdir}/libibverbs.d/*.driver %doc %{_docdir}/%{name}-%{version}/libibverbs.md diff --git a/suse/rdma-core.spec b/suse/rdma-core.spec index 8479b06b4262..6b235571ef28 100644 --- a/suse/rdma-core.spec +++ b/suse/rdma-core.spec @@ -34,12 +34,14 @@ Group: Productivity/Networking/Other %define umad_so_major 3 %define mlx4_so_major 1 %define mlx5_so_major 1 +%define efa_so_major 1 %define verbs_lname libibverbs%{verbs_so_major} %define rdmacm_lname librdmacm%{rdmacm_so_major} %define umad_lname libibumad%{umad_so_major} %define mlx4_lname libmlx4-%{mlx4_so_major} %define mlx5_lname libmlx5-%{mlx5_so_major} +%define efa_lname libefa-%{efa_so_major} %ifnarch s390 %arm %define dma_coherent 1 @@ -137,6 +139,7 @@ Requires: %{verbs_lname} = %{version}-%{release} %if 0%{?dma_coherent} Requires: %{mlx4_lname} = %{version}-%{release} Requires: %{mlx5_lname} = %{version}-%{release} +Requires: %{efa_lname} = %{version}-%{release} %endif Requires: rsocket = %{version}-%{release} @@ -181,6 +184,7 @@ Obsoletes: libefa-rdmav2 < %{version}-%{release} %if 0%{?dma_coherent} Requires: %{mlx4_lname} = %{version}-%{release} Requires: %{mlx5_lname} = %{version}-%{release} +Requires: %{efa_lname} = %{version}-%{release} %endif # Recommended packages for rxe_cfg Recommends: ethtool @@ -233,6 +237,13 @@ Group: System/Libraries %description -n %mlx5_lname This package contains the mlx5 runtime library. + +%package -n %efa_lname +Summary: EFA runtime library +Group: System/Libraries + +%description -n %efa_lname +This package contains the efa runtime library. %endif %package -n libibverbs-utils @@ -441,6 +452,9 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh %post -n %mlx5_lname -p /sbin/ldconfig %postun -n %mlx5_lname -p /sbin/ldconfig + +%post -n %efa_lname -p /sbin/ldconfig +%postun -n %efa_lname -p /sbin/ldconfig %endif %post -n %umad_lname -p /sbin/ldconfig @@ -608,6 +622,10 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh %files -n %mlx5_lname %defattr(-,root,root) %{_libdir}/libmlx5*.so.* + +%files -n %efa_lname +%defattr(-,root,root) +%{_libdir}/libefa*.so.* %endif %files -n libibverbs-utils -- 2.7.4