Add Enhanced Connection Established (ECE) APIs
cover Add Enhanced Connection Established (ECE) APIs
From: Leon Romanovsky <[email protected]>
Hi,
This is user space part of previously sent kernel part. It is marked as RFC because libmlx5 patch is not final and will be rewritten, however the concept is pretty solid. I'm posting the series to the ML in attempt to gather feedback, and I already aware of need to extend man pages to include definitions of struct ibv_ece.
Thanks
-------------------------------------------------------------------------------------
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
Leon Romanovsky (11):
Update kernel headers
libibverbs: Add interfaces to configure and use ECE
mlx5: Implement ECE callbacks
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/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 ++- providers/mlx5/mlx5.c | 6 +- providers/mlx5/mlx5.h | 10 ++ providers/mlx5/qp.c | 33 +++++++ providers/mlx5/verbs.c | 9 ++ 27 files changed, 560 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.24.1
RFC PATCH 1/11 Update kernel headers
From: Leon Romanovsky <[email protected]>
To commit 1ab53e5ec89e ("RDMA/cma: Provide ECE reject reason")
--- kernel-headers/rdma/rdma_user_cm.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
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.24.1
RFC PATCH 2/11 libibverbs: Add interfaces to configure and use ECE
In reply to Leon RomanovskyFrom: 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 "29.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
@@ -439,6 +439,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
@@ -508,6 +518,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,
@@ -518,6 +529,7 @@ const struct verbs_context_ops verbs_dummy_ops = { req_notify_cq, rereg_mr, resize_cq, + set_ece, };/*
@@ -624,6 +636,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);
@@ -634,6 +647,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;
@@ -3325,6 +3340,9 @@ static inline int ibv_read_counters(struct ibv_counters *counters,return vctx->read_counters (counters, counters_value, ncounters, flags); } +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.24.1
RFC PATCH 3/11 mlx5: Implement ECE callbacks
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Add an implementation for get and set ECE options to mlx5 provider.
--- providers/mlx5/mlx5.c | 6 ++---- providers/mlx5/mlx5.h | 10 ++++++++++ providers/mlx5/qp.c | 33 +++++++++++++++++++++++++++++++++ providers/mlx5/verbs.c | 9 +++++++++ 4 files changed, 54 insertions(+), 4 deletions(-)
providers/mlx5/mlx5.c +2 -4
@@ -51,10 +51,6 @@static void mlx5_free_context (struct ibv_context *ibctx); -#ifndef PCI_VENDOR_ID_MELLANOX -#define PCI_VENDOR_ID_MELLANOX 0x15b3 -#endif -#ifndef CPU_OR #define CPU_OR (x, y, z) do {} while (0)#endif
@@ -155,11 +151,13 @@ static const struct verbs_context_ops mlx5_ctx_common_ops = { .open_xrcd = mlx5_open_xrcd, .post_srq_ops = mlx5_post_srq_ops, .query_device_ex = mlx5_query_device_ex, + .query_ece = mlx5_query_ece, .query_rt_values = mlx5_query_rt_values, .read_counters = mlx5_read_counters, .reg_dm_mr = mlx5_reg_dm_mr, .alloc_null_mr = mlx5_alloc_null_mr, .free_context = mlx5_free_context, + .set_ece = mlx5_set_ece, };static const struct verbs_context_ops mlx5_ctx_cqev1_ops = {
providers/mlx5/mlx5.h +10 -0
@@ -85,6 +85,10 @@ enum { MLX5_DBG_DR = 1 << 6, }; +#ifndef PCI_VENDOR_ID_MELLANOX +#define PCI_VENDOR_ID_MELLANOX 0x15b3 +#endif +extern uint32_t mlx5_debug_mask;extern int mlx5_freeze_on_error_cqe;
@@ -570,6 +574,9 @@ struct mlx5_qp {uint32_t rqn;uint32_t sqn;uint64_t tir_icm_addr; + +struct ibv_ece default_ece; +struct ibv_ece ece; };struct mlx5_ah {
@@ -1109,4 +1116,7 @@ static inline bool srq_has_waitq(struct mlx5_srq *srq)bool srq_cooldown_wqe (struct mlx5_srq *srq,int ind); +int mlx5_query_ece (struct ibv_qp *qp,struct ibv_ece *ece); +int mlx5_set_ece (struct ibv_qp *qp,struct ibv_ece *ece); +#endif /* MLX5_H */
providers/mlx5/qp.c +33 -0
@@ -2938,3 +2938,36 @@ void mlx5_clear_qp(struct mlx5_context *ctx, uint32_t qpn)else ctx->qp_table[tind].table[qpn &MLX5_QP_TABLE_MASK ] =NULL ; } + +int mlx5_query_ece (struct ibv_qp *qp,struct ibv_ece *ece) +{ +struct mlx5_qp *mqp =to_mqp (qp); + +if (!mqp->ece.vendor_id) { +/* ECE wasn't set yet */ + ece->vendor_id = mqp->default_ece.vendor_id; + ece->options = mqp->default_ece.options; + +return 0 ; + } + + ece->vendor_id = mqp->ece.vendor_id; + ece->options = mqp->ece.options; +return 0 ; +} + +int mlx5_set_ece (struct ibv_qp *qp,struct ibv_ece *ece) +{ +struct mlx5_qp *mqp =to_mqp (qp); + +/* This is a mark for modify_qp() that ECE is set */ + mqp->ece.vendor_id = mqp->default_ece.vendor_id; + +if (mqp->default_ece.vendor_id != ece->vendor_id) + mqp->ece.options =0 ; +else + mqp->ece.options = mqp->default_ece.options & ece->options; + + ece->options = mqp->ece.options; +return 0 ; +}
providers/mlx5/verbs.c +9 -0
@@ -1808,6 +1808,13 @@ static int create_dct(struct ibv_context *context,return 0 ; } +static void init_qp_ece (struct ibv_qp *qp) +{ +struct mlx5_qp *mqp =to_mqp (qp); + + mqp->default_ece.vendor_id =PCI_VENDOR_ID_MELLANOX ; +} +static struct ibv_qp *create_qp (struct ibv_context *context,struct ibv_qp_init_attr_ex *attr,struct mlx5dv_qp_init_attr *mlx5_qp_attr)
@@ -2139,6 +2146,8 @@ static struct ibv_qp *create_qp(struct ibv_context *context,if (attr->comp_mask &IBV_QP_INIT_ATTR_SEND_OPS_FLAGS ) qp->verbs_qp.comp_mask |=VERBS_QP_EX ; +init_qp_ece (ibqp); +return ibqp; err_destroy:
--
2.24.1
RFC PATCH 4/11 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.24.1
RFC PATCH 5/11 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.24.1
RFC PATCH 6/11 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.24.1
RFC PATCH 7/11 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.24.1
RFC PATCH 8/11 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 = (conn_param) ? conn_param->qp_num :0 ;
@@ -1713,6 +1721,7 @@ int rdma_accept(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_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.24.1
RFC PATCH 9/11 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
@@ -1735,8 +1735,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;
@@ -1750,6 +1751,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)
@@ -1758,6 +1760,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.24.1
RFC PATCH 10/11 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) {
@@ -2074,8 +2084,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;
@@ -2095,6 +2105,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 );
@@ -2143,6 +2155,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;
@@ -2279,7 +2311,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 ;
@@ -2288,8 +2320,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 {
@@ -2639,7 +2671,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.24.1
RFC PATCH 11/11 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.24.1