Add cross-channel support
Subsystems (3)
v2 cover Add cross-channel support
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The following set of patches implements cross-channel (CC) support in the RDMA core and in the mlx5 infiniband driver.
The cross-channel feature allows to execute WQEs that involve cross-channel synchronization of IO operations’ on different QPs.
Complex applications usually requires synchronizations for IO operations from multiple sources before continuing their execution. In order to implement this the host software needs to handle completions from each one of the receive queues (arriving in arbitrary order), process the data after last message arrival and only then post work request on the send queue to send the combined data to its destination.
Execution of such an operation generates multiple interrupts at an unpredictable time with huge overhead for interrupt handling and context switch.
Current submission adds synchronization primitives which gives ability to perform conditional flows and a following submission will introduce arithmetic calculation offload.
Synchronization abilities combined with arithmetic calculations will allow to program complex flows with a single function call, hereby significantly reducing overhead associated with IO processing.
Patch #1 adds CQ and QP initialization flags to RDMA core structures in order to support cross-channel feature.
Patch #2 implements mlx5 infiniband driver configuration logic.
Changes from v1:
* Enrich cover message and commit messages.
* Drop patch with checkpatch warning fix.
Changes from v0:
* Set UAR to be the same for QP and CQ.
Leon Romanovsky (2):
IB/core: Add cross-channel support
IB/mlx5: Add driver cross-channel support
drivers/infiniband/core/uverbs_cmd.c | 5 +++- drivers/infiniband/hw/mlx5/cq.c | 7 ++++- drivers/infiniband/hw/mlx5/main.c | 3 ++ drivers/infiniband/hw/mlx5/mlx5_ib.h | 16 +++++++++++ drivers/infiniband/hw/mlx5/qp.c | 54 +++++++++++++++++++++++++++++------- include/linux/mlx5/qp.h | 3 ++ include/rdma/ib_verbs.h | 11 ++++++++ 7 files changed, 87 insertions(+), 12 deletions(-)
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1450947072-9295-1-git-send-email-leon-2ukJVAZIZ/[email protected]
PATCH v2 1/2 IB/core: Add cross-channel support
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The cross-channel feature allows to execute WQEs that involve synchronization of IO operations’ on different QPs.
This capability enables to program complex flows with a single function call, hereby significantly reducing overhead associated with IO processing.
The queue pairs can be configured to work as a “sync master queue” or “sync slave queues”.
The added flags are:
1. Device capability flag IB_DEVICE_CROSS_CHANNEL for the devices that can perform cross-channel operations.
2. CQ property flag IB_CQ_FLAGS_IGNORE_OVERRUN to disable CQ overrun check. In cross-channel mode, the send/receive queues will forward their completions to managing QP.
3. QP property flags to indicate if queues are slave or master:
* IB_QP_CREATE_MANAGED_SEND indicates that posted send work requests will not be executed immediately and requires enabling.
* IB_QP_CREATE_MANAGED_RECV indicates that posted receive work requests will not be executed immediately and requires enabling.
* IB_QP_CREATE_CROSS_CHANNEL declares the QP to work in cross-channel mode. If IB_QP_CREATE_MANAGED_SEND and IB_QP_CREATE_MANAGED_RECV are not provided, this QP will be sync master queue, else it will be sync slave.
--- drivers/infiniband/core/uverbs_cmd.c | 5 ++++- include/rdma/ib_verbs.h | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +4 -1
@@ -1829,7 +1829,10 @@ static int create_qp(struct ib_uverbs_file *file, sizeof(cmd->create_flags)) attr.create_flags = cmd->create_flags; -if (attr.create_flags & ~IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK ) { +if (attr.create_flags & ~(IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK | +IB_QP_CREATE_CROSS_CHANNEL | +IB_QP_CREATE_MANAGED_SEND | +IB_QP_CREATE_MANAGED_RECV )) { ret = -EINVAL ; goto err_put; }
include/rdma/ib_verbs.h +11 -0
@@ -141,6 +141,13 @@ enum ib_device_cap_flags {IB_DEVICE_MEM_WINDOW_TYPE_2B = (1 <<24 ),IB_DEVICE_RC_IP_CSUM = (1 <<25 ),IB_DEVICE_RAW_IP_CSUM = (1 <<26 ), +/* +* Devices should set IB_DEVICE_CROSS_CHANNEL if they +* support execution of WQEs that involve synchronization +* of I/O operations with single completion queue managed +* by hardware. +*/ +IB_DEVICE_CROSS_CHANNEL = (1 <<27 ),IB_DEVICE_MANAGED_FLOW_STEERING = (1 <<29 ),IB_DEVICE_SIGNATURE_HANDOVER = (1 <<30 ), IB_DEVICE_ON_DEMAND_PAGING = (1<<31),
@@ -186,6 +193,7 @@ struct ib_odp_caps {enum ib_cq_creation_flags {IB_CQ_FLAGS_TIMESTAMP_COMPLETION =1 <<0 , +IB_CQ_FLAGS_IGNORE_OVERRUN =1 <<1 , };struct ib_cq_init_attr {
@@ -823,6 +831,9 @@ enum ib_qp_type {enum ib_qp_create_flags {IB_QP_CREATE_IPOIB_UD_LSO =1 <<0 ,IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK =1 <<1 , +IB_QP_CREATE_CROSS_CHANNEL =1 <<2 , +IB_QP_CREATE_MANAGED_SEND =1 <<3 , +IB_QP_CREATE_MANAGED_RECV =1 <<4 ,IB_QP_CREATE_NETIF_QP =1 <<5 ,IB_QP_CREATE_SIGNATURE_EN =1 <<6 ,IB_QP_CREATE_USE_GFP_NOIO =1 <<7 ,
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/2 IB/mlx5: Add driver cross-channel support
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add support of cross-channel functionality to mlx5 driver. This includes ability to ignore overrun for CQ which intended for cross-channel, export device capability and configure the QP to be sync master/slave queues.
The cross-channel enabled QP supports combination of three possible properties:
* WQE processing on the receive queue of this QP
* WQE processing on the send queue of this QP
* WQE are supported on the send queue
--- drivers/infiniband/hw/mlx5/cq.c | 7 ++++- drivers/infiniband/hw/mlx5/main.c | 3 ++ drivers/infiniband/hw/mlx5/mlx5_ib.h | 16 +++++++++++ drivers/infiniband/hw/mlx5/qp.c | 54 +++++++++++++++++++++++++++++------- include/linux/mlx5/qp.h | 3 ++ 5 files changed, 72 insertions(+), 11 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +6 -1
@@ -760,7 +760,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,int eqn;int err; -if (attr->flags) +if (check_cq_create_flags (attr->flags))return ERR_PTR (-EINVAL );if (entries <0 )
@@ -779,6 +779,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,spin_lock_init (&cq->lock); cq->resize_buf =NULL ; cq->resize_umem =NULL ; + cq->create_flags = attr->flags;if (context) { err = create_cq_user(dev, udata, context, cq, entries,
@@ -796,6 +797,10 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, cq->cqe_size = cqe_size; cqb->ctx.cqe_sz_flags =cqe_sz_to_mlx_sz (cqe_size) <<5 ; + +if (cq->create_flags &IB_CQ_FLAGS_IGNORE_OVERRUN ) + cqb->ctx.cqe_sz_flags |= (1 <<1 ); + cqb->ctx.log_sz_usr_page =cpu_to_be32 ((ilog2 (entries) <<24 ) | index); err =mlx5_vector2eqn (dev->mdev, vector, &eqn, &irqn);if (err)
drivers/infiniband/hw/mlx5/main.c +3 -0
@@ -294,6 +294,9 @@ static int mlx5_ib_init_device_flags(struct ib_device *ibdev) ibdev->odp_caps = dev->odp_caps;#endif +if (MLX5_CAP_GEN (mdev, cd)) + props->device_cap_flags |=IB_DEVICE_CROSS_CHANNEL ; +return 0 ; }
drivers/infiniband/hw/mlx5/mlx5_ib.h +16 -0
@@ -85,6 +85,10 @@ enum mlx5_ib_mad_ifc_flags { MLX5_MAD_IFC_NET_VIEW = 4, }; +enum { +MLX5_CROSS_CHANNEL_UUAR =0 , +}; +struct mlx5_ib_ucontext {struct ib_ucontext ibucontext;struct list_head db_page_list;
@@ -242,6 +246,9 @@ struct mlx5_ib_cq_buf {enum mlx5_ib_qp_flags {MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK =1 <<0 ,MLX5_IB_QP_SIGNATURE_HANDLING =1 <<1 , +MLX5_IB_QP_CROSS_CHANNEL =1 <<2 , +MLX5_IB_QP_MANAGED_SEND =1 <<3 , +MLX5_IB_QP_MANAGED_RECV =1 <<4 , };struct mlx5_umr_wr {
@@ -284,6 +291,7 @@ struct mlx5_ib_cq {struct mlx5_ib_cq_buf *resize_buf;struct ib_umem *resize_umem;int cqe_size; +u32 create_flags; };struct mlx5_ib_srq {
@@ -662,4 +670,12 @@ static inline int is_qp1(enum ib_qp_type qp_type)#define MLX5_MAX_UMR_SHIFT 16#define MLX5_MAX_UMR_PAGES (1 << MLX5_MAX_UMR_SHIFT) +static inline u32 check_cq_create_flags (u32 flags) +{ +/* +* It returns non-zero value for unsupported CQ +* create flags, otherwise it returns zero. +*/ +return (flags & ~IB_CQ_FLAGS_IGNORE_OVERRUN ); +}#endif /* MLX5_IB_H */
drivers/infiniband/hw/mlx5/qp.c +44 -10
80 lines not on this page · raw message
include/linux/mlx5/qp.h +3 -0
@@ -130,6 +130,9 @@ enum {MLX5_QP_BIT_RWE =1 <<14 ,MLX5_QP_BIT_RAE =1 <<13 ,MLX5_QP_BIT_RIC =1 <<4 , +MLX5_QP_BIT_CC_SLAVE_RECV =1 <<2 , +MLX5_QP_BIT_CC_SLAVE_SEND =1 <<1 , +MLX5_QP_BIT_CC_MASTER =1 <<0 }; enum {
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html