Skip to content

Commit

Permalink
mana: Microsoft Azure Network Adapter (MANA) RDMA provider
Browse files Browse the repository at this point in the history
Introduce a provider that exposes MANA devices to user applications.

Signed-off-by: Long Li <[email protected]>
  • Loading branch information
longlimsft committed Dec 2, 2022
1 parent 69056ae commit 443f196
Show file tree
Hide file tree
Showing 25 changed files with 1,480 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ M: Sean Hefty <[email protected]>
S: Supported
F: librdmacm/

MANA USERSPACE PROVIDER (for mana_ib.ko)
M: Long Li <[email protected]>
S: Supported
F: providers/mana/

MLX4 USERSPACE PROVIDER (for mlx4_ib.ko)
M: Yishai Hadas <[email protected]>
H: Roland Dreier <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
7 changes: 4 additions & 3 deletions libibverbs/verbs.h
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
83 changes: 83 additions & 0 deletions providers/mana/man/manadv_init_obj.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
layout: page
title: manadv_init_obj
section: 3
tagline: Verbs
---

# NAME
manadv_init_obj \- Initialize mana direct verbs object from ibv_xxx structures

# SYNOPSIS"
```c
#include <infiniband/manadv.h>

int manadv_init_obj(struct manadv_obj *obj, uint64_t obj_type);
```
# DESCRIPTION
manadv_init_obj()
This function will initialize manadv_xxx structs based on supplied type. The information
for initialization is taken from ibv_xx structs supplied as part of input.
# ARGUMENTS
*obj*
: The manadv_xxx structs be to returned.
```c
struct manadv_qp {
void *sq_buf;
uint32_t sq_count;
uint32_t sq_size;
uint32_t sq_id;
uint32_t tx_vp_offset;
void *db_page;
};
struct manadv_cq {
void *buf;
uint32_t count;
uint32_t cq_id;
};
struct manadv_rwq {
void *buf;
uint32_t count;
uint32_t size;
uint32_t wq_id;
void *db_page;
};
struct manadv_obj {
struct {
struct ibv_qp *in;
struct manadv_qp *out;
} qp;
struct {
struct ibv_cq *in;
struct manadv_cq *out;
} cq;
struct {
struct ibv_wq *in;
struct manadv_rwq *out;
} rwq;
};
```

*obj_type*
: The types of the manadv_xxx structs to be returned.

```c
enum manadv_obj_type {
MANADV_OBJ_QP = 1 << 0,
MANADV_OBJ_CQ = 1 << 1,
MANADV_OBJ_RWQ = 1 << 2,
};
```
# RETURN VALUE
0 on success or the value of errno on failure (which indicates the failure reason).

# AUTHORS
Long Li <[email protected]>
65 changes: 65 additions & 0 deletions providers/mana/man/manadv_set_context_attr.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
layout: page
title: manadv_set_context_attr
section: 3
tagline: Verbs
---

# NAME
manadv_set_context_attr - Set context attributes

# SYNOPSIS
```c
#include <infiniband/manadv.h>

int manadv_set_context_attr(struct ibv_context *context,
enum manadv_set_ctx_attr_type attr_type,
void *attr);
```
# DESCRIPTION
manadv_set_context_attr gives the ability to set vendor specific attributes on
the RDMA context.
# ARGUMENTS
*context*
: RDMA device context to work on.
*attr_type*
: The type of the provided attribute.
*attr*
: Pointer to the attribute to be set.
## attr_type
```c
enum manadv_set_ctx_attr_type {
/* Attribute type uint8_t */
MANADV_SET_CTX_ATTR_BUF_ALLOCATORS = 0,
};
```
*MANADV_SET_CTX_ATTR_BUF_ALLOCATORS*
: Provide an external buffer allocator

```c
struct manadv_ctx_allocators {
void *(*alloc)(size_t size, void *priv_data);
void (*free)(void *ptr, void *priv_data);
void *data;
};
```
*alloc*
: Function used for buffer allocation instead of libmana internal method

*free*
: Function used to free buffers allocated by alloc function

*data*
: Metadata that can be used by alloc and free functions

# RETURN VALUE
Returns 0 on success, or the value of errno on failure
(which indicates the failure reason).

# AUTHOR
Long Li <[email protected]>

0 comments on commit 443f196

Please sign in to comment.