Skip to content

Commit

Permalink
librdmacm: Provide interface to use ECE for external QPs
Browse files Browse the repository at this point in the history
Add the following calls to allow use of ECE for external QPs.
Those QPs are not managed by librdmacm and can be any type
and not strictly ibv_qp.

 * rdma_set_local_ece() - provide to the librdmacm the desired
   ECE options to be used in REQ/REP handshake.
 * rdma_get_remote_ece() - get ECE options received from the peer,
   so users will be able to accept/reject/mask supported ECE options.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
  • Loading branch information
Leon Romanovsky committed Jun 15, 2020
1 parent b835943 commit 4358b12
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
3 changes: 3 additions & 0 deletions debian/librdmacm1.symbols
Expand Up @@ -3,6 +3,7 @@ librdmacm.so.1 librdmacm1 #MINVER#
RDMACM_1.0@RDMACM_1.0 1.0.15
RDMACM_1.1@RDMACM_1.1 16
RDMACM_1.2@RDMACM_1.2 23
RDMACM_1.3@RDMACM_1.3 31
raccept@RDMACM_1.0 1.0.16
rbind@RDMACM_1.0 1.0.16
rclose@RDMACM_1.0 1.0.16
Expand Down Expand Up @@ -31,6 +32,7 @@ librdmacm.so.1 librdmacm1 #MINVER#
rdma_get_cm_event@RDMACM_1.0 1.0.15
rdma_get_devices@RDMACM_1.0 1.0.15
rdma_get_dst_port@RDMACM_1.0 1.0.19
rdma_get_remote_ece@RDMACM_1.3 31
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
Expand All @@ -44,6 +46,7 @@ librdmacm.so.1 librdmacm1 #MINVER#
rdma_reject@RDMACM_1.0 1.0.15
rdma_resolve_addr@RDMACM_1.0 1.0.15
rdma_resolve_route@RDMACM_1.0 1.0.15
rdma_set_local_ece@RDMACM_1.3 31
rdma_set_option@RDMACM_1.0 1.0.15
rfcntl@RDMACM_1.0 1.0.16
rgetpeername@RDMACM_1.0 1.0.16
Expand Down
2 changes: 1 addition & 1 deletion librdmacm/CMakeLists.txt
Expand Up @@ -11,7 +11,7 @@ publish_headers(infiniband

rdma_library(rdmacm librdmacm.map
# See Documentation/versioning.md
1 1.2.${PACKAGE_VERSION}
1 1.3.${PACKAGE_VERSION}
acm.c
addrinfo.c
cma.c
Expand Down
30 changes: 30 additions & 0 deletions librdmacm/cma.c
Expand Up @@ -113,6 +113,8 @@ struct cma_id_private {
struct ibv_qp_init_attr *qp_init_attr;
uint8_t initiator_depth;
uint8_t responder_resources;
struct ibv_ece local_ece;
struct ibv_ece remote_ece;
};

struct cma_multicast {
Expand Down Expand Up @@ -2744,3 +2746,31 @@ __be16 rdma_get_dst_port(struct rdma_cm_id *id)
return ucma_get_port(&id->route.addr.dst_addr);
}

int rdma_set_local_ece(struct rdma_cm_id *id, struct ibv_ece *ece)
{
struct cma_id_private *id_priv;

if (!id || id->qp || !ece || !ece->vendor_id || ece->comp_mask)
return ERR(EINVAL);

id_priv = container_of(id, struct cma_id_private, id);
id_priv->local_ece.vendor_id = ece->vendor_id;
id_priv->local_ece.options = ece->options;

return 0;
}

int rdma_get_remote_ece(struct rdma_cm_id *id, struct ibv_ece *ece)
{
struct cma_id_private *id_priv;

if (!id || id->qp || !ece)
return ERR(EINVAL);

id_priv = container_of(id, struct cma_id_private, id);
ece->vendor_id = id_priv->remote_ece.vendor_id;
ece->options = id_priv->remote_ece.options;
ece->comp_mask = 0;

return 0;
}
6 changes: 6 additions & 0 deletions librdmacm/librdmacm.map
Expand Up @@ -82,3 +82,9 @@ RDMACM_1.2 {
rdma_establish;
rdma_init_qp_attr;
} RDMACM_1.1;

RDMACM_1.3 {
global:
rdma_get_remote_ece;
rdma_set_local_ece;
} RDMACM_1.2;
16 changes: 16 additions & 0 deletions librdmacm/rdma_cma.h
Expand Up @@ -753,6 +753,22 @@ void rdma_freeaddrinfo(struct rdma_addrinfo *res);
*/
int rdma_init_qp_attr(struct rdma_cm_id *id, struct ibv_qp_attr *qp_attr,
int *qp_attr_mask);

/**
* rdma_set_local_ece - Set local ECE options to be used for REQ/REP
* communication. In use to implement ECE handshake in external QP.
* @id: Communication identifier to establish connection
* @ece: ECE parameters
*/
int rdma_set_local_ece(struct rdma_cm_id *id, struct ibv_ece *ece);

/**
* rdma_get_remote_ece - Provide remote ECE parameters as received
* in REQ/REP events. In use to implement ECE handshake in external QP.
* @id: Communication identifier to establish connection
* @ece: ECE parameters
*/
int rdma_get_remote_ece(struct rdma_cm_id *id, struct ibv_ece *ece);
#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 4358b12

Please sign in to comment.