Skip to content

Commit

Permalink
Merge pull request #1177 from longlimsft/rebase-upstream-v1
Browse files Browse the repository at this point in the history
mana: Microsoft Azure Network Adapter (MANA) RDMA provider
  • Loading branch information
jgunthorpe committed Dec 5, 2022
2 parents c66be3d + 443f196 commit b094140
Show file tree
Hide file tree
Showing 28 changed files with 1,549 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -713,6 +713,8 @@ add_subdirectory(providers/efa/man)
add_subdirectory(providers/erdma)
add_subdirectory(providers/hns)
add_subdirectory(providers/irdma)
add_subdirectory(providers/mana)
add_subdirectory(providers/mana/man)
add_subdirectory(providers/mlx4)
add_subdirectory(providers/mlx4/man)
add_subdirectory(providers/mlx5)
Expand Down
5 changes: 5 additions & 0 deletions MAINTAINERS
Expand Up @@ -124,6 +124,11 @@ M: Sean Hefty <sean.hefty@intel.com>
S: Supported
F: librdmacm/

MANA USERSPACE PROVIDER (for mana_ib.ko)
M: Long Li <longli@microsoft.com>
S: Supported
F: providers/mana/

MLX4 USERSPACE PROVIDER (for mlx4_ib.ko)
M: Yishai Hadas <yishaih@mellanox.com>
H: Roland Dreier <rolandd@cisco.com>
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -21,6 +21,7 @@ is included:
- hns-roce.ko
- irdma.ko
- ib_qib.ko
- mana_ib.ko
- mlx4_ib.ko
- mlx5_ib.ko
- ib_mthca.ko
Expand Down
3 changes: 2 additions & 1 deletion debian/control
Expand Up @@ -68,7 +68,7 @@ Package: ibverbs-providers
Architecture: linux-any
Multi-Arch: same
Depends: ${misc:Depends}, ${shlibs:Depends}
Provides: libefa1, libipathverbs1, libmlx4-1, libmlx5-1, libmthca1
Provides: libefa1, libipathverbs1, libmana1, libmlx4-1, libmlx5-1, libmthca1
Replaces: libipathverbs1 (<< 15),
libmlx4-1 (<< 15),
libmlx5-1 (<< 15),
Expand Down Expand Up @@ -98,6 +98,7 @@ Description: User space provider drivers for libibverbs
- hns: HiSilicon Hip06 SoC
- ipathverbs: QLogic InfiniPath HCAs
- irdma: Intel Ethernet Connection RDMA
- mana: Microsoft Azure Network Adapter
- mlx4: Mellanox ConnectX-3 InfiniBand HCAs
- mlx5: Mellanox Connect-IB/X-4+ InfiniBand HCAs
- mthca: Mellanox InfiniBand HCAs
Expand Down
4 changes: 4 additions & 0 deletions debian/copyright
Expand Up @@ -180,6 +180,10 @@ Files: providers/irdma/*
Copyright: 2015-2021, Intel Corporation.
License: BSD-MIT or GPL-2

Files: providers/mana/*
Copyright: 2022, Microsoft Corporation.
License: BSD-MIT or GPL-2

Files: providers/mlx4/*
Copyright: 2004-2005, Topspin Communications.
2005-2007, Cisco, Inc.
Expand Down
1 change: 1 addition & 0 deletions debian/ibverbs-providers.install
@@ -1,5 +1,6 @@
etc/libibverbs.d/
usr/lib/*/libefa.so.*
usr/lib/*/libibverbs/lib*-rdmav*.so
usr/lib/*/libmana.so*
usr/lib/*/libmlx4.so.*
usr/lib/*/libmlx5.so.*
4 changes: 2 additions & 2 deletions debian/ibverbs-providers.lintian-overrides
@@ -1,2 +1,2 @@
# libefa, libmlx4 and libmlx5 are ibverbs provider that provides more functions.
ibverbs-providers: package-name-doesnt-match-sonames libefa1 libmlx4-1 libmlx5-1
# libefa, libmana, libmlx4 and libmlx5 are ibverbs provider that provides more functions.
ibverbs-providers: package-name-doesnt-match-sonames libefa1 libmana1 libmlx4-1 libmlx5-1
5 changes: 5 additions & 0 deletions debian/ibverbs-providers.symbols
Expand Up @@ -172,3 +172,8 @@ libefa.so.1 ibverbs-providers #MINVER#
efadv_query_ah@EFA_1.1 26
efadv_cq_from_ibv_cq_ex@EFA_1.2 43
efadv_create_cq@EFA_1.2 43
libmana.so.1 ibverbs-providers #MINVER#
* Build-Depends-Package: libibverbs-dev
MANA_1.0@MANA_1.0 41
manadv_init_obj@MANA_1.0 41
manadv_set_context_attr@MANA_1.0 41
6 changes: 6 additions & 0 deletions debian/libibverbs-dev.install
@@ -1,6 +1,7 @@
usr/include/infiniband/arch.h
usr/include/infiniband/efadv.h
usr/include/infiniband/ib_user_ioctl_verbs.h
usr/include/infiniband/manadv.h
usr/include/infiniband/mlx4dv.h
usr/include/infiniband/mlx5_api.h
usr/include/infiniband/mlx5_user_ioctl_verbs.h
Expand All @@ -16,20 +17,25 @@ usr/lib/*/libefa.a
usr/lib/*/libefa.so
usr/lib/*/libibverbs*.so
usr/lib/*/libibverbs.a
usr/lib/*/libmana.a
usr/lib/*/libmana.so
usr/lib/*/libmlx4.a
usr/lib/*/libmlx4.so
usr/lib/*/libmlx5.a
usr/lib/*/libmlx5.so
usr/lib/*/pkgconfig/libefa.pc
usr/lib/*/pkgconfig/libibverbs.pc
usr/lib/*/pkgconfig/libmana.pc
usr/lib/*/pkgconfig/libmlx4.pc
usr/lib/*/pkgconfig/libmlx5.pc
usr/share/man/man3/efadv_*.3
usr/share/man/man3/ibv_*
usr/share/man/man3/mbps_to_ibv_rate.3
usr/share/man/man3/manadv_*.3
usr/share/man/man3/mlx4dv_*.3
usr/share/man/man3/mlx5dv_*.3
usr/share/man/man3/mult_to_ibv_rate.3
usr/share/man/man7/efadv.7
usr/share/man/man7/manadv.7
usr/share/man/man7/mlx4dv.7
usr/share/man/man7/mlx5dv.7
2 changes: 1 addition & 1 deletion debian/rules
Expand Up @@ -62,7 +62,7 @@ ifneq (,$(filter-out $(COHERENT_DMA_ARCHS),$(DEB_HOST_ARCH)))
for package in ibverbs-providers libibverbs-dev rdma-core; do \
test -e debian/$$package.install.backup || cp debian/$$package.install debian/$$package.install.backup; \
done
sed -i '/efa\|mlx[45]/d' debian/ibverbs-providers.install debian/libibverbs-dev.install debian/rdma-core.install
sed -i '/efa\|mana\|mlx[45]/d' debian/ibverbs-providers.install debian/libibverbs-dev.install debian/rdma-core.install
endif
DESTDIR=$(CURDIR)/debian/tmp ninja -C build-deb install

Expand Down
2 changes: 2 additions & 0 deletions kernel-headers/CMakeLists.txt
Expand Up @@ -10,6 +10,7 @@ publish_internal_headers(rdma
rdma/ib_user_sa.h
rdma/ib_user_verbs.h
rdma/irdma-abi.h
rdma/mana-abi.h
rdma/mlx4-abi.h
rdma/mlx5-abi.h
rdma/mlx5_user_ioctl_cmds.h
Expand Down Expand Up @@ -70,6 +71,7 @@ rdma_kernel_provider_abi(
rdma/hns-abi.h
rdma/ib_user_verbs.h
rdma/irdma-abi.h
rdma/mana-abi.h
rdma/mlx4-abi.h
rdma/mlx5-abi.h
rdma/mthca-abi.h
Expand Down
1 change: 1 addition & 0 deletions kernel-headers/rdma/ib_user_ioctl_verbs.h
Expand Up @@ -251,6 +251,7 @@ enum rdma_driver_id {
RDMA_DRIVER_EFA,
RDMA_DRIVER_SIW,
RDMA_DRIVER_ERDMA,
RDMA_DRIVER_MANA,
};

enum ib_uverbs_gid_type {
Expand Down
66 changes: 66 additions & 0 deletions kernel-headers/rdma/mana-abi.h
@@ -0,0 +1,66 @@
/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) */
/*
* Copyright (c) 2022, Microsoft Corporation. All rights reserved.
*/

#ifndef MANA_ABI_USER_H
#define MANA_ABI_USER_H

#include <linux/types.h>
#include <rdma/ib_user_ioctl_verbs.h>

/*
* Increment this value if any changes that break userspace ABI
* compatibility are made.
*/

#define MANA_IB_UVERBS_ABI_VERSION 1

struct mana_ib_create_cq {
__aligned_u64 buf_addr;
};

struct mana_ib_create_qp {
__aligned_u64 sq_buf_addr;
__u32 sq_buf_size;
__u32 port;
};

struct mana_ib_create_qp_resp {
__u32 sqid;
__u32 cqid;
__u32 tx_vp_offset;
__u32 reserved;
};

struct mana_ib_create_wq {
__aligned_u64 wq_buf_addr;
__u32 wq_buf_size;
__u32 reserved;
};

/* RX Hash function flags */
enum mana_ib_rx_hash_function_flags {
MANA_IB_RX_HASH_FUNC_TOEPLITZ = 1 << 0,
};

struct mana_ib_create_qp_rss {
__aligned_u64 rx_hash_fields_mask;
__u8 rx_hash_function;
__u8 reserved[7];
__u32 rx_hash_key_len;
__u8 rx_hash_key[40];
__u32 port;
};

struct rss_resp_entry {
__u32 cqid;
__u32 wqid;
};

struct mana_ib_create_qp_rss_resp {
__aligned_u64 num_entries;
struct rss_resp_entry entries[64];
};

#endif
7 changes: 4 additions & 3 deletions libibverbs/verbs.h
Expand Up @@ -2193,7 +2193,7 @@ struct ibv_device **ibv_get_device_list(int *num_devices);
*/
#ifdef RDMA_STATIC_PROVIDERS
#define _RDMA_STATIC_PREFIX_(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, \
_12, _13, _14, _15, _16, _17, _18, ...) \
_12, _13, _14, _15, _16, _17, _18, _19, ...) \
&verbs_provider_##_1, &verbs_provider_##_2, &verbs_provider_##_3, \
&verbs_provider_##_4, &verbs_provider_##_5, \
&verbs_provider_##_6, &verbs_provider_##_7, \
Expand All @@ -2202,11 +2202,11 @@ struct ibv_device **ibv_get_device_list(int *num_devices);
&verbs_provider_##_12, &verbs_provider_##_13, \
&verbs_provider_##_14, &verbs_provider_##_15, \
&verbs_provider_##_16, &verbs_provider_##_17, \
&verbs_provider_##_18
&verbs_provider_##_18, &verbs_provider_##_19
#define _RDMA_STATIC_PREFIX(arg) \
_RDMA_STATIC_PREFIX_(arg, none, none, none, none, none, none, none, \
none, none, none, none, none, none, none, none, \
none, none)
none, none, none)

struct verbs_devices_ops;
extern const struct verbs_device_ops verbs_provider_bnxt_re;
Expand All @@ -2217,6 +2217,7 @@ extern const struct verbs_device_ops verbs_provider_hfi1verbs;
extern const struct verbs_device_ops verbs_provider_hns;
extern const struct verbs_device_ops verbs_provider_ipathverbs;
extern const struct verbs_device_ops verbs_provider_irdma;
extern const struct verbs_device_ops verbs_provider_mana;
extern const struct verbs_device_ops verbs_provider_mlx4;
extern const struct verbs_device_ops verbs_provider_mlx5;
extern const struct verbs_device_ops verbs_provider_mthca;
Expand Down
13 changes: 13 additions & 0 deletions providers/mana/CMakeLists.txt
@@ -0,0 +1,13 @@
rdma_shared_provider(mana libmana.map
1 1.0.${PACKAGE_VERSION}
mana.c
manadv.c
qp.c
wq.c
)

publish_headers(infiniband
manadv.h
)

rdma_pkg_config("mana" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")
8 changes: 8 additions & 0 deletions providers/mana/libmana.map
@@ -0,0 +1,8 @@
/* Export symbols should be added below according to
Documentation/versioning.md document. */
MANA_1.0 {
global:
manadv_set_context_attr;
manadv_init_obj;
local: *;
};
5 changes: 5 additions & 0 deletions providers/mana/man/CMakeLists.txt
@@ -0,0 +1,5 @@
rdma_man_pages(
manadv.7.md
manadv_init_obj.3.md
manadv_set_context_attr.3.md
)
47 changes: 47 additions & 0 deletions providers/mana/man/manadv.7.md
@@ -0,0 +1,47 @@
---
layout: page
title: MANADV
section: 7
tagline: Verbs
date: 2022-05-16
header: "MANA Direct Verbs Manual"
footer: mana
---

# NAME
manadv - Direct verbs for mana devices

This provides low level access to mana devices to perform direct operations,
without general branching performed by libibverbs.

# DESCRIPTION
The libibverbs API is an abstract one. It is agnostic to any underlying
provider specific implementation. While this abstraction has the advantage
of user applications portability, it has a performance penalty. For some
applications optimizing performance is more important than portability.

The mana direct verbs API is intended for such applications.
It exposes mana specific low level operations, allowing the application
to bypass the libibverbs API.

This version of the driver supports one QP type: IBV_QPT_RAW_PACKET. To use
this QP type, the application is required to use manadv_set_context_attr()
to set external buffer allocators for allocating queues, and use
manadv_init_obj() to obtain all the queue information. The application
implements its own queue operations, bypassing libibverbs API for
sending/receiving traffic over the queues. At hardware layer, IBV_QPT_RAW_PACKET
QP shares the same hardware resource as the Ethernet port used in the kernel.
The software checks for exclusive use of the hardware Ethernet port, and will
fail the QP creation if the port is already in use. To create a
IBV_QPT_RAW_PACKET on a specified port, the user needs to configure the system
in such a way that this port is not used by any other software (including the
Kernel). If the port is used, ibv_create_qp() will fail with errno set to EBUSY.

The direct include of manadv.h together with linkage to mana library will
allow usage of this new interface.

# SEE ALSO
**verbs**(7)

# AUTHORS
Long Li <longli@microsoft.com>

0 comments on commit b094140

Please sign in to comment.