Add Enhanced Connection Established (ECE) APIs
cover Add Enhanced Connection Established (ECE) APIs
From: Leon Romanovsky <[email protected]>
Hi,
Enhanced Connection Established or ECE is new negotiation scheme introduced in IBTA v1.4 to exchange extra information about nodes capabilities and later negotiate them at the connection establishment phase.
The RDMA-CM messages (REQ, REP, SIDR_REQ and SIDR_REP) were extended to carry two fields, one new and another gained new functionality:
* VendorID is a new field that indicates that common subset of vendor option bits are supported as indicated by that VendorID.
* AttributeModifier already exists, but overloaded to indicate which vendor options are supported by this VendorID.
The general (success) communication flow can be described by the following table:
------------------------------------------------------------------------------
Requester (client) | Responder (server)
-----------------------------------------------------------------------------
1. Create data QP. |
2. Get ECE information about this QP. |
3. Update REQ message with local ECE data.|
4. Send REQ message with rdma_connect(). |
| 5. Get REQ message with rdma_get_events.
| 6. Read remote ECE data from the REQ message.
| 7. Create data QP.
| 8. Set in QP the desired ECE options by giving remote ECE data.
| 9. Read accepted local ECE options.
|10. Modify QP based on those options.
|11. Fill local ECE options in REP message.
|12. Send REP message with rdma_accept().
13. Receive REP message. |
14. Read remote ECE data from REP message.|
15. Set in QP remote ECE data |
16. Modify QP based on remote ECE data |------------------------------------------------------------------------------
In case the server decides to reject connection, the items #9-10 will be replaced with rdma_reject_ece() call that will send REJ message together with "ECE options not supported" reason as described in the IBTA.
Thanks
Ido Kalir (2):
pyverbs: Add support for ECE
tests: Add test for rdmacm ECE mechanism
Leon Romanovsky (10):
Update kernel headers
libibverbs: Add interfaces to configure and use ECE
libibverbs: Document ECE API
debian: Install all available librdmacm man pages
librdmacm: Provide interface to use ECE for external QPs
librdmacm: Connect rdma_connect to the ECE
librdmacm: Return ECE results through rdma_accept
librdmacm: Add an option to reject ECE request
librdmacm: Implement ECE handshake logic
librdmacm: Document ECE API
CMakeLists.txt | 2 +- debian/libibverbs1.symbols | 5 +- debian/librdmacm-dev.install | 53 +-------- debian/librdmacm1.symbols | 4 + kernel-headers/rdma/mlx5_user_ioctl_cmds.h | 6 + kernel-headers/rdma/rdma_user_cm.h | 15 ++- libibverbs/CMakeLists.txt | 2 +- libibverbs/driver.h | 2 + libibverbs/dummy_ops.c | 14 +++ libibverbs/libibverbs.map.in | 6 + libibverbs/man/CMakeLists.txt | 2 + libibverbs/man/ibv_query_ece.3.md | 56 +++++++++ libibverbs/man/ibv_set_ece.3.md | 61 ++++++++++ libibverbs/verbs.c | 15 +++ libibverbs/verbs.h | 18 +++ librdmacm/CMakeLists.txt | 2 +- librdmacm/cma.c | 130 +++++++++++++++++++-- librdmacm/librdmacm.map | 7 ++ librdmacm/man/CMakeLists.txt | 2 + librdmacm/man/rdma_cm.7 | 14 ++- librdmacm/man/rdma_get_remote_ece.3.md | 61 ++++++++++ librdmacm/man/rdma_set_local_ece.3.md | 62 ++++++++++ librdmacm/rdma_cma.h | 24 ++++ librdmacm/rdma_cma_abi.h | 15 ++- pyverbs/cmid.pyx | 23 +++- pyverbs/libibverbs.pxd | 7 ++ pyverbs/librdmacm.pxd | 2 + pyverbs/qp.pxd | 3 + pyverbs/qp.pyx | 45 ++++++- tests/rdmacm_utils.py | 18 ++- 30 files changed, 606 insertions(+), 70 deletions(-) create mode 100644 libibverbs/man/ibv_query_ece.3.md create mode 100644 libibverbs/man/ibv_set_ece.3.md create mode 100644 librdmacm/man/rdma_get_remote_ece.3.md create mode 100644 librdmacm/man/rdma_set_local_ece.3.md
--
2.25.2
PATCH 2/12 libibverbs: Add interfaces to configure and use ECE
From: Leon Romanovsky <[email protected]>
ECE parameters are vendor specific information per-QP, provide a way to set, query and commit ECE data.
* ibv_set_ece() - overwrite default ECE options and instruct libibverbs to use ECE data while enabling QP.
* ibv_query_ece() - get ECE options.
--- CMakeLists.txt | 2 +- debian/libibverbs1.symbols | 5 ++++- libibverbs/CMakeLists.txt | 2 +- libibverbs/driver.h | 2 ++ libibverbs/dummy_ops.c | 14 ++++++++++++++ libibverbs/libibverbs.map.in | 6 ++++++ libibverbs/verbs.c | 15 +++++++++++++++ libibverbs/verbs.h | 18 ++++++++++++++++++ 8 files changed, 61 insertions(+), 3 deletions(-)
CMakeLists.txt +1 -1
@@ -72,7 +72,7 @@ set(PACKAGE_VERSION "30.0") # When this is changed the values in these files need changing too: # debian/control # debian/libibverbs1.symbols -set(IBVERBS_PABI_VERSION "25") +set(IBVERBS_PABI_VERSION "26") set(IBVERBS_PROVIDER_SUFFIX "-rdmav${IBVERBS_PABI_VERSION}.so") #-------------------------
debian/libibverbs1.symbols +4 -1
@@ -6,7 +6,8 @@ libibverbs.so.1 libibverbs1 #MINVER# IBVERBS_1.6@IBVERBS_1.6 24 IBVERBS_1.7@IBVERBS_1.7 25 IBVERBS_1.8@IBVERBS_1.8 28 - (symver)IBVERBS_PRIVATE_25 25 + IBVERBS_1.9@IBVERBS_1.9 28 + (symver)IBVERBS_PRIVATE_26 26 ibv_ack_async_event@IBVERBS_1.0 1.1.6 ibv_ack_async_event@IBVERBS_1.1 1.1.6 ibv_ack_cq_events@IBVERBS_1.0 1.1.6
@@ -76,6 +77,7 @@ libibverbs.so.1 libibverbs1 #MINVER# ibv_qp_to_qp_ex@IBVERBS_1.6 24 ibv_query_device@IBVERBS_1.0 1.1.6 ibv_query_device@IBVERBS_1.1 1.1.6 + ibv_query_ece@IBVERBS_1.9 28 ibv_query_gid@IBVERBS_1.0 1.1.6 ibv_query_gid@IBVERBS_1.1 1.1.6 ibv_query_pkey@IBVERBS_1.0 1.1.6
@@ -98,6 +100,7 @@ libibverbs.so.1 libibverbs1 #MINVER# ibv_resize_cq@IBVERBS_1.0 1.1.6 ibv_resize_cq@IBVERBS_1.1 1.1.6 ibv_resolve_eth_l2_from_gid@IBVERBS_1.1 1.2.0 + ibv_set_ece@IBVERBS_1.9 28 ibv_wc_status_str@IBVERBS_1.1 1.1.6 mbps_to_ibv_rate@IBVERBS_1.1 1.1.8 mult_to_ibv_rate@IBVERBS_1.0 1.1.6
libibverbs/CMakeLists.txt +1 -1
@@ -21,7 +21,7 @@ configure_file("libibverbs.map.in" rdma_library(ibverbs "${CMAKE_CURRENT_BINARY_DIR}/libibverbs.map" # See Documentation/versioning.md - 1 1.8.${PACKAGE_VERSION} + 1 1.9.${PACKAGE_VERSION} all_providers.c cmd.c cmd_ah.c
libibverbs/driver.h +2 -0
@@ -348,6 +348,7 @@ struct verbs_context_ops {const struct ibv_query_device_ex_input *input, struct ibv_device_attr_ex *attr, size_t attr_size); +int (*query_ece)(struct ibv_qp *qp,struct ibv_ece *ece);int (*query_port)(struct ibv_context *context,uint8_t port_num,struct ibv_port_attr *port_attr); int (*query_qp)(struct ibv_qp *qp, struct ibv_qp_attr *attr,
@@ -368,6 +369,7 @@ struct verbs_context_ops {int (*rereg_mr)(struct verbs_mr *vmr,int flags,struct ibv_pd *pd,void *addr,size_t length,int access);int (*resize_cq)(struct ibv_cq *cq,int cqe); +int (*set_ece)(struct ibv_qp *qp,struct ibv_ece *ece); }; static inline struct verbs_device *
libibverbs/dummy_ops.c +14 -0
@@ -450,6 +450,16 @@ static int resize_cq(struct ibv_cq *cq, int cqe)return EOPNOTSUPP ; } +static int set_ece (struct ibv_qp *qp,struct ibv_ece *ece) +{ +return EOPNOTSUPP ; +} + +static int query_ece (struct ibv_qp *qp,struct ibv_ece *ece) +{ +return EOPNOTSUPP ; +} +/* * Ops in verbs_dummy_ops simply return an EOPNOTSUPP error code when called, or * do nothing. They are placed in the ops structures if the provider does not
@@ -519,6 +529,7 @@ const struct verbs_context_ops verbs_dummy_ops = { post_srq_recv, query_device, query_device_ex, + query_ece, query_port, query_qp, query_rt_values,
@@ -529,6 +540,7 @@ const struct verbs_context_ops verbs_dummy_ops = { req_notify_cq, rereg_mr, resize_cq, + set_ece, };/*
@@ -635,6 +647,7 @@ void verbs_set_ops(struct verbs_context *vctx,SET_OP (ctx, post_srq_recv);SET_PRIV_OP (ctx, query_device);SET_OP (vctx, query_device_ex); +SET_PRIV_OP_IC (vctx, query_ece);SET_PRIV_OP_IC (ctx, query_port);SET_PRIV_OP (ctx, query_qp);SET_OP (vctx, query_rt_values);
@@ -645,6 +658,7 @@ void verbs_set_ops(struct verbs_context *vctx,SET_OP (ctx, req_notify_cq);SET_PRIV_OP (ctx, rereg_mr);SET_PRIV_OP (ctx, resize_cq); +SET_PRIV_OP_IC (vctx, set_ece);#undef SET_OP#undef SET_OP2
libibverbs/libibverbs.map.in +6 -0
@@ -126,6 +126,12 @@ IBVERBS_1.8 { ibv_reg_mr_iova2; } IBVERBS_1.7; +IBVERBS_1.9 { + global: + ibv_query_ece; + ibv_set_ece; +} IBVERBS_1.8; + /* If any symbols in this stanza change ABI then the entire staza gets a new symbol version. See the top level CMakeLists.txt for this setting. */
libibverbs/verbs.c +15 -0
@@ -1080,3 +1080,18 @@ free_resources:return ret; } + +int ibv_set_ece (struct ibv_qp *qp,struct ibv_ece *ece) +{ +if (!ece->vendor_id || ece->comp_mask) { + errno =EINVAL ; +return -1 ; + } + +return get_ops (qp->context)->set_ece (qp, ece); +} + +int ibv_query_ece (struct ibv_qp *qp,struct ibv_ece *ece) +{ +return get_ops (qp->context)->query_ece (qp, ece); +}
libibverbs/verbs.h +18 -0
@@ -1401,6 +1401,21 @@ static inline void ibv_wr_abort(struct ibv_qp_ex *qp) qp->wr_abort (qp); } +struct ibv_ece { +/* +* Unique identifier of the provider vendor on the network. +* The providers will set IEEE OUI here to distinguish +* itself in non-homogenius network. +*/ +uint32_t vendor_id; +/* +* Provider specific attributes which are supported or +* needed to be enabled by ECE users. +*/ +uint32_t options; +uint32_t comp_mask; +}; +struct ibv_comp_channel {struct ibv_context *context;int fd;
@@ -3342,6 +3357,9 @@ static inline uint16_t ibv_flow_label_to_udp_sport(uint32_t fl)return (uint16_t )(fl_low |IB_ROCE_UDP_ENCAP_VALID_PORT_MIN ); } +int ibv_set_ece (struct ibv_qp *qp,struct ibv_ece *ece); +int ibv_query_ece (struct ibv_qp *qp,struct ibv_ece *ece); + #ifdef __cplusplus }#endif
--
2.25.2
PATCH 3/12 libibverbs: Document ECE API
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Add manual pages for libibverbs part of ECE.
--- libibverbs/man/CMakeLists.txt | 2 + libibverbs/man/ibv_query_ece.3.md | 56 ++++++++++++++++++++++++++++ libibverbs/man/ibv_set_ece.3.md | 61 +++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 libibverbs/man/ibv_query_ece.3.md create mode 100644 libibverbs/man/ibv_set_ece.3.md
libibverbs/man/CMakeLists.txt +2 -0
@@ -51,6 +51,7 @@ rdma_man_pages( ibv_post_srq_recv.3 ibv_query_device.3 ibv_query_device_ex.3 + ibv_query_ece.3.md ibv_query_gid.3.md ibv_query_pkey.3.md ibv_query_port.3
@@ -65,6 +66,7 @@ rdma_man_pages( ibv_req_notify_cq.3.md ibv_rereg_mr.3.md ibv_resize_cq.3.md + ibv_set_ece.3.md ibv_srq_pingpong.1 ibv_uc_pingpong.1 ibv_ud_pingpong.1
libibverbs/man/ibv_query_ece.3.md new file +56 -0
56 lines not on this page · raw message
libibverbs/man/ibv_set_ece.3.md new file +61 -0
61 lines not on this page · raw message
--
2.25.2
PATCH 4/12 debian: Install all available librdmacm man pages
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
There is no need to be explicit for every man page in librdmacm, use simple '*' to install all rdma_*.3 man pages in one shot.
--- debian/librdmacm-dev.install | 53 +----------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-)
debian/librdmacm-dev.install +1 -52
@@ -6,57 +6,6 @@ usr/include/rdma/rsocket.h usr/lib/*/librdmacm*.so usr/lib/*/librdmacm.a usr/lib/*/pkgconfig/librdmacm.pc -usr/share/man/man3/rdma_accept.3 -usr/share/man/man3/rdma_ack_cm_event.3 -usr/share/man/man3/rdma_bind_addr.3 -usr/share/man/man3/rdma_connect.3 -usr/share/man/man3/rdma_create_ep.3 -usr/share/man/man3/rdma_create_event_channel.3 -usr/share/man/man3/rdma_create_id.3 -usr/share/man/man3/rdma_create_qp.3 -usr/share/man/man3/rdma_create_srq.3 -usr/share/man/man3/rdma_dereg_mr.3 -usr/share/man/man3/rdma_destroy_ep.3 -usr/share/man/man3/rdma_destroy_event_channel.3 -usr/share/man/man3/rdma_destroy_id.3 -usr/share/man/man3/rdma_destroy_qp.3 -usr/share/man/man3/rdma_destroy_srq.3 -usr/share/man/man3/rdma_disconnect.3 -usr/share/man/man3/rdma_establish.3 -usr/share/man/man3/rdma_event_str.3 -usr/share/man/man3/rdma_free_devices.3 -usr/share/man/man3/rdma_get_cm_event.3 -usr/share/man/man3/rdma_get_devices.3 -usr/share/man/man3/rdma_get_dst_port.3 -usr/share/man/man3/rdma_get_local_addr.3 -usr/share/man/man3/rdma_get_peer_addr.3 -usr/share/man/man3/rdma_get_recv_comp.3 -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 -usr/share/man/man3/rdma_listen.3 -usr/share/man/man3/rdma_migrate_id.3 -usr/share/man/man3/rdma_notify.3 -usr/share/man/man3/rdma_post_read.3 -usr/share/man/man3/rdma_post_readv.3 -usr/share/man/man3/rdma_post_recv.3 -usr/share/man/man3/rdma_post_recvv.3 -usr/share/man/man3/rdma_post_send.3 -usr/share/man/man3/rdma_post_sendv.3 -usr/share/man/man3/rdma_post_ud_send.3 -usr/share/man/man3/rdma_post_write.3 -usr/share/man/man3/rdma_post_writev.3 -usr/share/man/man3/rdma_reg_msgs.3 -usr/share/man/man3/rdma_reg_read.3 -usr/share/man/man3/rdma_reg_write.3 -usr/share/man/man3/rdma_reject.3 -usr/share/man/man3/rdma_resolve_addr.3 -usr/share/man/man3/rdma_resolve_route.3 -usr/share/man/man3/rdma_set_option.3 +usr/share/man/man3/rdma_*.3 usr/share/man/man7/rdma_cm.7 usr/share/man/man7/rsocket.7
--
2.25.2
PATCH 5/12 librdmacm: Provide interface to use ECE for external QPs
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
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.
--- debian/librdmacm1.symbols | 3 +++ librdmacm/CMakeLists.txt | 2 +- librdmacm/cma.c | 51 +++++++++++++++++++++++++++++++++++++++ librdmacm/librdmacm.map | 6 +++++ librdmacm/rdma_cma.h | 16 ++++++++++++ 5 files changed, 77 insertions(+), 1 deletion(-)
debian/librdmacm1.symbols +3 -0
@@ -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 28 raccept@RDMACM_1.0 1.0.16 rbind@RDMACM_1.0 1.0.16 rclose@RDMACM_1.0 1.0.16
@@ -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 28 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
@@ -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 28 rdma_set_option@RDMACM_1.0 1.0.15 rfcntl@RDMACM_1.0 1.0.16 rgetpeername@RDMACM_1.0 1.0.16
librdmacm/CMakeLists.txt +1 -1
@@ -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
librdmacm/cma.c +51 -0
72 lines not on this page · raw message
librdmacm/librdmacm.map +6 -0
@@ -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;
librdmacm/rdma_cma.h +16 -0
@@ -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
--
2.25.2
PATCH 1/12 Update kernel headers
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
To commit ?? ("RDMA/mlx5: Verify that QP is created with RQ or SQ")
--- kernel-headers/rdma/mlx5_user_ioctl_cmds.h | 6 ++++++ kernel-headers/rdma/rdma_user_cm.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
kernel-headers/rdma/mlx5_user_ioctl_cmds.h +6 -0
@@ -241,6 +241,11 @@ enum mlx5_ib_flow_type { MLX5_IB_FLOW_TYPE_MC_DEFAULT, }; +enum mlx5_ib_create_flow_flags { +MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DEFAULT_MISS =1 <<0 , +MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP =1 <<1 , +}; +enum mlx5_ib_create_flow_attrs {MLX5_IB_ATTR_CREATE_FLOW_HANDLE = (1U <<UVERBS_ID_NS_SHIFT ),MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE ,
@@ -251,6 +256,7 @@ enum mlx5_ib_create_flow_attrs {MLX5_IB_ATTR_CREATE_FLOW_TAG ,MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX ,MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET , + MLX5_IB_ATTR_CREATE_FLOW_FLAGS, }; enum mlx5_ib_destoy_flow_attrs {
kernel-headers/rdma/rdma_user_cm.h +14 -1
@@ -78,6 +78,10 @@ enum rdma_ucm_port_space { RDMA_PS_UDP = 0x0111, }; +enum rdma_ucm_reject_reason { +RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED =35 +}; +/* * command ABI structures. */
@@ -206,10 +210,16 @@ struct rdma_ucm_ud_param {__u8 reserved[7 ]; }; +struct rdma_ucm_ece { +__u32 vendor_id; +__u32 attr_mod; +}; +struct rdma_ucm_connect {struct rdma_ucm_conn_param conn_param;__u32 id;__u32 reserved; +struct rdma_ucm_ece ece; };struct rdma_ucm_listen {
@@ -222,12 +232,14 @@ struct rdma_ucm_accept {struct rdma_ucm_conn_param conn_param;__u32 id;__u32 reserved; +struct rdma_ucm_ece ece; };struct rdma_ucm_reject {__u32 id;__u8 private_data_len; -__u8 reserved[3 ]; +__u8 reason;/* enum rdma_ucm_reject_reason */ +__u8 reserved[2 ];__u8 private_data[RDMA_MAX_PRIVATE_DATA ]; };
@@ -287,6 +299,7 @@ struct rdma_ucm_event_resp {struct rdma_ucm_ud_param ud; } param;__u32 reserved; +struct rdma_ucm_ece ece; };/* Option levels */
--
2.25.2
PATCH 7/12 librdmacm: Return ECE results through rdma_accept
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Passive side (server) returns its answer through REP message, which is constructed as a result of rdma_accept().
--- librdmacm/cma.c | 9 +++++++++ librdmacm/rdma_cma_abi.h | 1 + 2 files changed, 10 insertions(+)
librdmacm/cma.c +9 -0
@@ -1668,6 +1668,14 @@ err:return ret; } +static void ucma_copy_ece_param_to_kern_rep (struct cma_id_private *id_priv, +struct ucma_abi_ece *dst) +{ +/* Return result with same ID as received. */ + dst->vendor_id = id_priv->remote_ece.vendor_id; + dst->attr_mod = id_priv->local_ece.options; +} +int rdma_accept (struct rdma_cm_id *id,struct rdma_conn_param *conn_param) {uint32_t qp_num = id->qp ? id->qp->qp_num : conn_param->qp_num;
@@ -1709,6 +1717,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) cmd.uid = (uintptr_t ) id_priv;ucma_copy_conn_param_to_kern (id_priv, &cmd.conn_param, conn_param, qp_num, srq); +ucma_copy_ece_param_to_kern_rep (id_priv, &cmd.ece); ret =write (id->channel->fd, &cmd,sizeof cmd);if (ret !=sizeof cmd) {
librdmacm/rdma_cma_abi.h +1 -0
@@ -254,6 +254,7 @@ struct ucma_abi_accept {struct ucma_abi_conn_param conn_param;__u32 id;__u32 reserved; +struct ucma_abi_ece ece; };struct ucma_abi_reject {
--
2.25.2
PATCH 8/12 librdmacm: Add an option to reject ECE request
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
IBTA has specific rejected reason for users who doesn't want proposed ECE options in request messages. Provide special version (rdma_reject_ece) to mark such rejects.
--- debian/librdmacm1.symbols | 1 + librdmacm/cma.c | 19 +++++++++++++++++-- librdmacm/librdmacm.map | 1 + librdmacm/rdma_cma.h | 8 ++++++++ librdmacm/rdma_cma_abi.h | 7 ++++++- 5 files changed, 33 insertions(+), 3 deletions(-)
debian/librdmacm1.symbols +1 -0
@@ -44,6 +44,7 @@ librdmacm.so.1 librdmacm1 #MINVER# rdma_migrate_id@RDMACM_1.0 1.0.15 rdma_notify@RDMACM_1.0 1.0.15 rdma_reject@RDMACM_1.0 1.0.15 + rdma_reject_ece@RDMACM_1.3 28 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 28
librdmacm/cma.c +17 -2
@@ -1731,8 +1731,9 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)return ucma_complete (id); } -int rdma_reject (struct rdma_cm_id *id,const void *private_data, -uint8_t private_data_len) +static int reject_with_reason (struct rdma_cm_id *id,const void *private_data, +uint8_t private_data_len, +enum ucm_abi_reject_reason reason) {struct ucma_abi_reject cmd;struct cma_id_private *id_priv;
@@ -1746,6 +1747,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,memcpy (cmd.private_data, private_data, private_data_len); cmd.private_data_len = private_data_len; } + cmd.reason = reason; ret =write (id->channel->fd, &cmd,sizeof cmd);if (ret !=sizeof cmd)
@@ -1754,6 +1756,19 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,return 0 ; } +int rdma_reject (struct rdma_cm_id *id,const void *private_data, +uint8_t private_data_len) +{ +return reject_with_reason (id, private_data, private_data_len,0 ); +} + +int rdma_reject_ece (struct rdma_cm_id *id,const void *private_data, +uint8_t private_data_len) +{ +return reject_with_reason (id, private_data, private_data_len, +RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED ); +} +int rdma_notify (struct rdma_cm_id *id,enum ibv_event_type event) {struct ucma_abi_notify cmd;
librdmacm/librdmacm.map +1 -0
@@ -86,5 +86,6 @@ RDMACM_1.2 { RDMACM_1.3 { global: rdma_get_remote_ece; + rdma_reject_ece; rdma_set_local_ece; } RDMACM_1.2;
librdmacm/rdma_cma.h +8 -0
@@ -524,6 +524,14 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);int rdma_reject (struct rdma_cm_id *id,const void *private_data,uint8_t private_data_len); +/** +* rdma_reject_ece - Called to reject a connection request with ECE +* rejected reason. +* The same as rdma_reject() +*/ +int rdma_reject_ece (struct rdma_cm_id *id,const void *private_data, +uint8_t private_data_len); +/** * rdma_notify - Notifies the librdmacm of an asynchronous event. * @id: RDMA identifier.
librdmacm/rdma_cma_abi.h +6 -1
@@ -73,6 +73,10 @@ enum {UCMA_CMD_JOIN_MCAST }; +enum ucm_abi_reject_reason { +RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED =35 +}; +struct ucma_abi_cmd_hdr {__u32 cmd;__u16 in;
@@ -263,7 +267,8 @@ struct ucma_abi_reject {__u16 out;__u32 id;__u8 private_data_len; -__u8 reserved[3 ]; +__u8 reason;/* enum ucm_abi_reject_reason */ +__u8 reserved[2 ];__u8 private_data[RDMA_MAX_PRIVATE_DATA ]; };
--
2.25.2
PATCH 9/12 librdmacm: Implement ECE handshake logic
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Perform ECE handshake through REQ/REP messages. The REQ message initiated by active side towards passive side and carries the ECE data. The passive side returns its decision in REP message.
--- librdmacm/cma.c | 46 ++++++++++++++++++++++++++++++++++------ librdmacm/rdma_cma_abi.h | 1 + 2 files changed, 40 insertions(+), 7 deletions(-)
librdmacm/cma.c +39 -7
@@ -1398,10 +1398,20 @@ static int init_ece(struct rdma_cm_id *id, struct ibv_qp *qp) id_priv->local_ece.vendor_id = ece.vendor_id; id_priv->local_ece.options = ece.options; +if (!id_priv->remote_ece.vendor_id) +return 0 ; + +/* This QP was created due to REQ event */ + ece.vendor_id = id_priv->remote_ece.vendor_id; + ece.options = id_priv->remote_ece.options; + ret =ibv_set_ece (qp, &ece); +if (ret) +return (errno ==ECONNREFUSED ) ? errno :0 ; + + id_priv->local_ece.options = ece.options;return 0 ; } -int rdma_create_qp_ex (struct rdma_cm_id *id,struct ibv_qp_init_attr_ex *attr) {
@@ -2070,8 +2080,8 @@ static int ucma_query_req_info(struct rdma_cm_id *id)return 0 ; } -static int ucma_process_conn_req (struct cma_event *evt, -uint32_t handle) +static int ucma_process_conn_req (struct cma_event *evt,uint32_t handle, +struct ucma_abi_ece *ece) {struct cma_id_private *id_priv;int ret;
@@ -2091,6 +2101,8 @@ static int ucma_process_conn_req(struct cma_event *evt,ucma_insert_id (id_priv); id_priv->initiator_depth = evt->event.param.conn.initiator_depth; id_priv->responder_resources = evt->event.param.conn.responder_resources; + id_priv->remote_ece.vendor_id = ece->vendor_id; + id_priv->remote_ece.options = ece->attr_mod;if (evt->id_priv->sync) { ret =rdma_migrate_id (&id_priv->id,NULL );
@@ -2139,6 +2151,26 @@ err:return ret; } +static int ucma_process_conn_resp_ece (struct cma_id_private *id_priv, +struct ucma_abi_ece *ece) +{ +struct ibv_ece ibv_ece = { .vendor_id = ece->vendor_id, + .options = ece->attr_mod }; +int ret; + + ret =ibv_set_ece (id_priv->id.qp, &ibv_ece); +if (ret && errno ==EOPNOTSUPP ) + goto out; + +if (ret && errno ==ECONNREFUSED ) +/* libibverbs provider asked to reject connection */ +return -1 ; + + id_priv->local_ece.options = ibv_ece.options; +out: +return ucma_process_conn_resp (id_priv); +} +static int ucma_process_join (struct cma_event *evt) { evt->mc->mgid = evt->event.param.ud.ah_attr.grh.dgid;
@@ -2275,7 +2307,7 @@ retry:else ucma_copy_conn_event (evt, &resp.param.conn); - ret =ucma_process_conn_req (evt, resp.id); + ret =ucma_process_conn_req (evt, resp.id, &resp.ece);if (ret) goto retry;break ;
@@ -2284,8 +2316,8 @@ retry:if (!evt->id_priv->id.qp) { evt->event.event =RDMA_CM_EVENT_CONNECT_RESPONSE ; }else { - evt->event.status = -ucma_process_conn_resp (evt->id_priv); + evt->event.status =ucma_process_conn_resp_ece ( + evt->id_priv, &resp.ece);if (!evt->event.status) evt->event.event =RDMA_CM_EVENT_ESTABLISHED ;else {
@@ -2635,7 +2667,7 @@ int rdma_get_remote_ece(struct rdma_cm_id *id, struct ibv_ece *ece) {struct cma_id_private *id_priv; -if (id->qp || !ece) +if (!id || id->qp || !ece)return ERR (EINVAL ); id_priv = container_of(id, struct cma_id_private, id);
librdmacm/rdma_cma_abi.h +1 -0
@@ -334,6 +334,7 @@ struct ucma_abi_event_resp {struct ucma_abi_conn_param conn;struct ucma_abi_ud_param ud; } param; +struct ucma_abi_ece ece; };struct ucma_abi_set_option {
--
2.25.2
PATCH 10/12 librdmacm: Document ECE API
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Add manual pages for librdmacm part of ECE.
--- librdmacm/man/CMakeLists.txt | 2 + librdmacm/man/rdma_cm.7 | 14 +++++- librdmacm/man/rdma_get_remote_ece.3.md | 61 +++++++++++++++++++++++++ librdmacm/man/rdma_set_local_ece.3.md | 62 ++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 librdmacm/man/rdma_get_remote_ece.3.md create mode 100644 librdmacm/man/rdma_set_local_ece.3.md
librdmacm/man/CMakeLists.txt +2 -0
@@ -29,6 +29,7 @@ rdma_man_pages( rdma_get_local_addr.3 rdma_get_peer_addr.3 rdma_get_recv_comp.3 + rdma_get_remote_ece.3.md rdma_get_request.3 rdma_get_send_comp.3 rdma_get_src_port.3
@@ -56,6 +57,7 @@ rdma_man_pages( rdma_resolve_addr.3 rdma_resolve_route.3 rdma_server.1 + rdma_set_local_ece.3.md rdma_set_option.3 rdma_xclient.1 rdma_xserver.1
librdmacm/man/rdma_cm.7 +13 -1
@@ -26,6 +26,10 @@ parameter in specific calls. If an event channel is provided, an rdma_cm identi will report its event data (results of connecting, for example), on that channel. If a channel is not provided, then all rdma_cm operations for the selected rdma_cm identifier will block until they complete. +.P +The RDMA CM gives an option to different libibverbs providers to advertise and +use various specific to that provider QP configuration options. This functionality +is called ECE (enhanced connection establishment). .SH "RDMA VERBS" The rdma_cm supports the full range of verbs available through the libibverbs library and interfaces. However, it also provides wrapper functions for some
@@ -111,6 +115,8 @@ destroy the QP release the rdma_cm_id .IP rdma_destroy_event_channel release the event channel +.IP rdma_set_local_ece +set desired ECE options .P An almost identical process is used to setup unreliable datagram (UD) communication between nodes. No actual connection is formed between QPs
@@ -157,6 +163,10 @@ release the connected rdma_cm_id release the listening rdma_cm_id .IP rdma_destroy_event_channel release the event channel +.IP rdma_get_remote_ece +get ECe options sent by the client +.IP rdma_set_local_ece +set desired ECE options .SH "RETURN CODES" .IP "= 0" success
@@ -198,6 +208,7 @@ rdma_get_dst_port(3), rdma_get_local_addr(3), rdma_get_peer_addr(3), rdma_get_recv_comp(3), +rdma_get_remote_ece(3), rdma_get_request(3), rdma_get_send_comp(3), rdma_get_src_port(3),
@@ -221,7 +232,8 @@ rdma_reg_write(3), rdma_reject(3), rdma_resolve_addr(3), rdma_resolve_route(3), -rdma_set_option(3) +rdma_get_remote_ece(3), +rdma_set_option(3), mckey(1), rdma_client(1), rdma_server(1),
librdmacm/man/rdma_get_remote_ece.3.md new file +61 -0
61 lines not on this page · raw message
librdmacm/man/rdma_set_local_ece.3.md new file +62 -0
62 lines not on this page · raw message
--
2.25.2
PATCH 6/12 librdmacm: Connect rdma_connect to the ECE
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The ECE options are handled to the kernel at the time of connection request, e.g. rdma_connect().
--- librdmacm/cma.c | 9 +++++++++ librdmacm/rdma_cma_abi.h | 6 ++++++ 2 files changed, 15 insertions(+)
librdmacm/cma.c +9 -0
@@ -1547,6 +1547,13 @@ static void ucma_copy_conn_param_to_kern(struct cma_id_private *id_priv, } } +static void ucma_copy_ece_param_to_kern_req (struct cma_id_private *id_priv, +struct ucma_abi_ece *dst) +{ + dst->vendor_id = id_priv->local_ece.vendor_id; + dst->attr_mod = id_priv->local_ece.options; +} +int rdma_connect (struct rdma_cm_id *id,struct rdma_conn_param *conn_param) {uint32_t qp_num = conn_param ? conn_param->qp_num :0 ;
@@ -1579,6 +1586,8 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)ucma_copy_conn_param_to_kern (id_priv, &cmd.conn_param, conn_param, qp_num, srq); +ucma_copy_ece_param_to_kern_req (id_priv, &cmd.ece); + ret =write (id->channel->fd, &cmd,sizeof cmd);if (ret !=sizeof cmd)return (ret >=0 ) ?ERR (ENODATA ) :-1 ;
librdmacm/rdma_cma_abi.h +6 -0
@@ -223,6 +223,11 @@ struct ucma_abi_ud_param {__u8 reserved2[4 ];/* Round to 8-byte boundary to support 32/64 */ }; +struct ucma_abi_ece { +__u32 vendor_id; +__u32 attr_mod; +}; +struct ucma_abi_connect {__u32 cmd;__u16 in;
@@ -230,6 +235,7 @@ struct ucma_abi_connect {struct ucma_abi_conn_param conn_param;__u32 id;__u32 reserved; +struct ucma_abi_ece ece; };struct ucma_abi_listen {
--
2.25.2
PATCH 12/12 tests: Add test for rdmacm ECE mechanism
In reply to Leon RomanovskyFrom: Ido Kalir <[email protected]>
Add test case that use the ECE mechanism in RDMA CM connection establishment.
--- tests/rdmacm_utils.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
tests/rdmacm_utils.py +17 -1
@@ -4,10 +4,12 @@ Provide some useful helper function for pyverbs rdmacm' tests. """ from tests.utils import validate, poll_cq, get_send_element, get_recv_wr -from pyverbs.pyverbs_error import PyverbsError +from pyverbs.pyverbs_error import PyverbsError, PyverbsRDMAError from tests.base import CMResources from pyverbs.cmid import CMEvent import pyverbs.cm_enums as ce +import unittest +import errno import os events_dict = {ce.RDMA_CM_EVENT_ADDR_ERROR: 'Resolve Address Error',
@@ -117,6 +119,13 @@ def event_handler(agr_obj): agr_obj.create_qp() param = agr_obj.create_conn_param() if agr_obj.with_ext_qp: + try: + ece = agr_obj.qp.query_ece() + agr_obj.cmid.set_local_ece(ece) + except PyverbsRDMAError as ex: + if ex.error_code == errno.EOPNOTSUPP: + pass + raise ex param.qpn = agr_obj.qp.qp_num agr_obj.cmid.connect(param) elif cm_event.event_type == ce.RDMA_CM_EVENT_CONNECT_REQUEST:
@@ -124,6 +133,13 @@ def event_handler(agr_obj): param = agr_obj.create_conn_param() agr_obj.create_qp() if agr_obj.with_ext_qp: + try: + ece = agr_obj.child_id.get_remote_ece() + agr_obj.qp.set_ece(ece) + except PyverbsRDMAError as ex: + if ex.error_code == errno.EOPNOTSUPP: + pass + raise ex agr_obj.modify_ext_qp_to_rts() param.qpn = agr_obj.qp.qp_num agr_obj.child_id.accept(param)
--
2.25.2
PATCH 11/12 pyverbs: Add support for ECE
In reply to Leon RomanovskyFrom: Ido Kalir <[email protected]>
ECE (enhanced connection establishment) is a mechanism that gives an option to different libibverbs providers to advertise and use various provider-specific QP configuration options.
Add those verbs:ibv_query_ece - get QPs ece.ibv_set_ece - set the QPs ece.rdma_set_local_ece - set the local CMs ece. rdma_get_remote_ece - get the remote CM ece from the connection request.
--- pyverbs/cmid.pyx | 23 ++++++++++++++++++++- pyverbs/libibverbs.pxd | 7 +++++++ pyverbs/librdmacm.pxd | 2 ++ pyverbs/qp.pxd | 3 +++ pyverbs/qp.pyx | 45 ++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 77 insertions(+), 3 deletions(-)
pyverbs/cmid.pyx +22 -1
@@ -1,7 +1,7 @@ from libc.string cimport memset from pyverbs.pyverbs_error import PyverbsUserError -from pyverbs.qp cimport QPInitAttr, QPAttr +from pyverbs.qp cimport QPInitAttr, QPAttr, ECE from pyverbs.base import PyverbsRDMAErrno cimport pyverbs.libibverbs_enums as e cimport pyverbs.librdmacm_enums as ce
@@ -424,6 +424,27 @@ cdef class CMID(PyverbsCM): if ret != 0: raise PyverbsRDMAErrno('Failed to Complete an active connection request') + def set_local_ece(self, ECE ece): + """ + Set local ECE paraemters to be used for REQ/REP communication. + :param ece: ECE object with the requested configuration + :return: None + """ + rc = cm.rdma_set_local_ece(self.id, &ece.ece) + if rc != 0: + raise PyverbsRDMAErrno('Failed to set local ECE') + + def get_remote_ece(self): + """ + Get ECE parameters as were received from the communication peer. + :return: ECE object with the ece configuration + """ + ece = ECE() + rc = cm.rdma_get_remote_ece(self.id, &ece.ece) + if rc != 0: + raise PyverbsRDMAErrno('Failed to get remote ECE') + return ece + def create_qp(self, QPInitAttr qp_init not None): """ Create a QP, which is associated with CMID.
pyverbs/libibverbs.pxd +7 -0
@@ -475,6 +475,11 @@ cdef extern from 'infiniband/verbs.h': uint64_t wr_id unsigned int wr_flags + cdef struct ibv_ece: + uint32_t vendor_id + uint32_t options + uint32_t comp_mask + ibv_device **ibv_get_device_list(int *n) void ibv_free_device_list(ibv_device **list) ibv_context *ibv_open_device(ibv_device *device)
@@ -599,3 +604,5 @@ cdef extern from 'infiniband/verbs.h': cdef extern from 'infiniband/driver.h': int ibv_query_gid_type(ibv_context *context, uint8_t port_num, unsigned int index, ibv_gid_type *type) + int ibv_set_ece(ibv_qp *qp, ibv_ece *ece) + int ibv_query_ece(ibv_qp *qp, ibv_ece *ece)
pyverbs/librdmacm.pxd +2 -0
@@ -97,6 +97,8 @@ cdef extern from '<rdma/rdma_cma.h>': int rdma_create_id(rdma_event_channel *channel, rdma_cm_id **id, void *context, rdma_port_space ps) int rdma_destroy_id(rdma_cm_id *id) + int rdma_get_remote_ece(rdma_cm_id *id, ibv_ece *ece) + int rdma_set_local_ece(rdma_cm_id *id, ibv_ece *ece) int rdma_get_request(rdma_cm_id *listen, rdma_cm_id **id) int rdma_bind_addr(rdma_cm_id *id, sockaddr *addr) int rdma_resolve_addr(rdma_cm_id *id, sockaddr *src_addr,
pyverbs/qp.pxd +3 -0
@@ -43,3 +43,6 @@ cdef class DataBuffer(PyverbsCM): cdef class QPEx(QP): cdef v.ibv_qp_ex *qp_ex + +cdef class ECE(PyverbsCM): + cdef v.ibv_ece ece
pyverbs/qp.pyx +43 -2
64 lines not on this page · raw message
--
2.25.2