From: Danit Goldberg <danitg@xxxxxxxxxxxx> Expose the internal function 'rdma_init_qp_attr' in librdmacm API. Applications can get the parameters for creating AH (needed for DC QP), or control QP attributes after its creation. Signed-off-by: Danit Goldberg <danitg@xxxxxxxxxxxx> Signed-off-by: Yossi Itigin <yosefe@xxxxxxxxxxxx> Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx> --- debian/librdmacm-dev.install | 1 + debian/librdmacm1.symbols | 2 ++ librdmacm/CMakeLists.txt | 2 +- librdmacm/cma.c | 4 +-- librdmacm/librdmacm.map | 5 ++++ librdmacm/man/CMakeLists.txt | 1 + librdmacm/man/rdma_init_qp_attr.3.md | 54 ++++++++++++++++++++++++++++++++++++ librdmacm/rdma_cma.h | 10 +++++++ 8 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 librdmacm/man/rdma_init_qp_attr.3.md diff --git a/debian/librdmacm-dev.install b/debian/librdmacm-dev.install index b8f643c..fe1b755 100644 --- a/debian/librdmacm-dev.install +++ b/debian/librdmacm-dev.install @@ -34,6 +34,7 @@ usr/share/man/man3/rdma_get_request.3 usr/share/man/man3/rdma_get_send_comp.3 usr/share/man/man3/rdma_get_src_port.3 usr/share/man/man3/rdma_getaddrinfo.3 +usr/share/man/man3/rdma_init_qp_attr.3 usr/share/man/man3/rdma_join_multicast.3 usr/share/man/man3/rdma_join_multicast_ex.3 usr/share/man/man3/rdma_leave_multicast.3 diff --git a/debian/librdmacm1.symbols b/debian/librdmacm1.symbols index 0fea265..0d1a54f 100644 --- a/debian/librdmacm1.symbols +++ b/debian/librdmacm1.symbols @@ -2,6 +2,7 @@ librdmacm.so.1 librdmacm1 #MINVER# * Build-Depends-Package: librdmacm-dev RDMACM_1.0@RDMACM_1.0 1.0.15 RDMACM_1.1@RDMACM_1.1 16 + RDMACM_1.2@RDMACM_1.2 23 raccept@RDMACM_1.0 1.0.16 rbind@RDMACM_1.0 1.0.16 rclose@RDMACM_1.0 1.0.16 @@ -32,6 +33,7 @@ librdmacm.so.1 librdmacm1 #MINVER# rdma_get_request@RDMACM_1.0 1.0.15 rdma_get_src_port@RDMACM_1.0 1.0.19 rdma_getaddrinfo@RDMACM_1.0 1.0.15 + rdma_init_qp_attr@RDMACM_1.2 23 rdma_join_multicast@RDMACM_1.0 1.0.15 rdma_join_multicast_ex@RDMACM_1.1 16 rdma_leave_multicast@RDMACM_1.0 1.0.15 diff --git a/librdmacm/CMakeLists.txt b/librdmacm/CMakeLists.txt index f71e407..b0329ad 100644 --- a/librdmacm/CMakeLists.txt +++ b/librdmacm/CMakeLists.txt @@ -10,7 +10,7 @@ publish_headers(infiniband rdma_library(rdmacm librdmacm.map # See Documentation/versioning.md - 1 1.1.${PACKAGE_VERSION} + 1 1.2.${PACKAGE_VERSION} acm.c addrinfo.c cma.c diff --git a/librdmacm/cma.c b/librdmacm/cma.c index 628d883..687ffd7 100644 --- a/librdmacm/cma.c +++ b/librdmacm/cma.c @@ -991,8 +991,8 @@ static int ucma_is_ud_qp(enum ibv_qp_type qp_type) return (qp_type == IBV_QPT_UD); } -static int rdma_init_qp_attr(struct rdma_cm_id *id, struct ibv_qp_attr *qp_attr, - int *qp_attr_mask) +int rdma_init_qp_attr(struct rdma_cm_id *id, struct ibv_qp_attr *qp_attr, + int *qp_attr_mask) { struct ucma_abi_init_qp_attr cmd; struct ib_uverbs_qp_attr resp; diff --git a/librdmacm/librdmacm.map b/librdmacm/librdmacm.map index 5813d74..bde1bc4 100644 --- a/librdmacm/librdmacm.map +++ b/librdmacm/librdmacm.map @@ -76,3 +76,8 @@ RDMACM_1.1 { global: rdma_join_multicast_ex; } RDMACM_1.0; + +RDMACM_1.2 { + global: + rdma_init_qp_attr; +} RDMACM_1.1; diff --git a/librdmacm/man/CMakeLists.txt b/librdmacm/man/CMakeLists.txt index d016c92..aec3b6b 100644 --- a/librdmacm/man/CMakeLists.txt +++ b/librdmacm/man/CMakeLists.txt @@ -32,6 +32,7 @@ rdma_man_pages( rdma_get_send_comp.3 rdma_get_src_port.3 rdma_getaddrinfo.3 + rdma_init_qp_attr.3.md rdma_join_multicast.3 rdma_join_multicast_ex.3 rdma_leave_multicast.3 diff --git a/librdmacm/man/rdma_init_qp_attr.3.md b/librdmacm/man/rdma_init_qp_attr.3.md new file mode 100644 index 0000000..99e812a --- /dev/null +++ b/librdmacm/man/rdma_init_qp_attr.3.md @@ -0,0 +1,54 @@ +--- +date: 2018-12-31 +footer: librdmacm +header: "Librdmacm Programmer's Manual" +layout: page +license: 'Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md' +section: 3 +title: RDMA_INIT_QP_ATTR +--- + +# NAME + +rdma_init_qp_attr - Returns qp attributes of a rdma_cm_id. + +# SYNOPSIS + +```c +#include <rdma/rdma_cma.h> + +int rdma_init_qp_attr(struct rdma_cm_id *id, + struct ibv_qp_attr *qp_attr, + int *qp_attr_mask); +``` +# DESCRIPTION + +**rdma_init_qp_attr()** returns qp attributes of a rdma_cm_id. + +Information about qp attributes and qp attributes mask is returned through the *qp_attr* and *qp_attr_mask* parameters. + +For details on the qp_attr structure, see ibv_modify_qp. + +# ARGUMENTS + +*id* +: RDMA identifier. + +*qp_attr* +: A reference to a qp attributes struct containing response information. + +*qp_attr_mask* +: A reference to a qp attributes mask containing response information. + +# RETURN VALUE + +**rdma_init_qp_attr()** returns 0 on success, or -1 on error. If an error occurs, errno will be set to indicate the failure reason. + +# SEE ALSO + +**rdma_cm**(7), +**ibv_modify_qp**(3) + +# AUTHOR + +Danit Goldberg <danitg@xxxxxxxxxxxx> diff --git a/librdmacm/rdma_cma.h b/librdmacm/rdma_cma.h index 2096a81..cf4a683 100644 --- a/librdmacm/rdma_cma.h +++ b/librdmacm/rdma_cma.h @@ -721,6 +721,16 @@ int rdma_getaddrinfo(const char *node, const char *service, void rdma_freeaddrinfo(struct rdma_addrinfo *res); +/** + * rdma_init_qp_attr - Returns QP attributes. + * @id: Communication identifier. + * @qp_attr: A reference to a QP attributes struct containing + * response information. + * @qp_attr_mask: A reference to a QP attributes mask containing + * response information. + */ +int rdma_init_qp_attr(struct rdma_cm_id *id, struct ibv_qp_attr *qp_attr, + int *qp_attr_mask); #ifdef __cplusplus } #endif -- 1.8.3.1