Add cross-channel support
Subsystems (3)
cover Add cross-channel support
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
This patchset adds cross-channel support.
The cross-channel feature allows to execute WQEs that involve synchronization of I/O operations’ on different QPs.
This capability enables to program complex flows with a single function call, hereby significantly reducing overhead associated with I/O processing.
Leon Romanovsky (3):
IB/core: Align coding style of ib_device_cap_flags structure 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 | 12 ++++++ drivers/infiniband/hw/mlx5/qp.c | 29 +++++++++++++++ include/linux/mlx5/qp.h | 3 ++ include/rdma/ib_verbs.h | 71 +++++++++++++++++++++--------------- 7 files changed, 98 insertions(+), 32 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): 1449987516-31608-1-git-send-email-leon-2ukJVAZIZ/[email protected]
PATCH 1/3 IB/core: Align coding style of ib_device_cap_flags structure
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Modify enum ib_device_cap_flags such that other patches which add new enum values pass strict checkpatch.pl checks.
--- include/rdma/ib_verbs.h | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
include/rdma/ib_verbs.h +30 -30
@@ -105,24 +105,24 @@ enum rdma_link_layer { };enum ib_device_cap_flags { -IB_DEVICE_RESIZE_MAX_WR =1 , -IB_DEVICE_BAD_PKEY_CNTR = (1 <<1 ), -IB_DEVICE_BAD_QKEY_CNTR = (1 <<2 ), -IB_DEVICE_RAW_MULTI = (1 <<3 ), -IB_DEVICE_AUTO_PATH_MIG = (1 <<4 ), -IB_DEVICE_CHANGE_PHY_PORT = (1 <<5 ), -IB_DEVICE_UD_AV_PORT_ENFORCE = (1 <<6 ), -IB_DEVICE_CURR_QP_STATE_MOD = (1 <<7 ), -IB_DEVICE_SHUTDOWN_PORT = (1 <<8 ), -IB_DEVICE_INIT_TYPE = (1 <<9 ), -IB_DEVICE_PORT_ACTIVE_EVENT = (1 <<10 ), -IB_DEVICE_SYS_IMAGE_GUID = (1 <<11 ), -IB_DEVICE_RC_RNR_NAK_GEN = (1 <<12 ), -IB_DEVICE_SRQ_RESIZE = (1 <<13 ), -IB_DEVICE_N_NOTIFY_CQ = (1 <<14 ), -IB_DEVICE_LOCAL_DMA_LKEY = (1 <<15 ), -IB_DEVICE_RESERVED = (1 <<16 ),/* old SEND_W_INV */ -IB_DEVICE_MEM_WINDOW = (1 <<17 ), +IB_DEVICE_RESIZE_MAX_WR = (1 <<0 ), +IB_DEVICE_BAD_PKEY_CNTR = (1 <<1 ), +IB_DEVICE_BAD_QKEY_CNTR = (1 <<2 ), +IB_DEVICE_RAW_MULTI = (1 <<3 ), +IB_DEVICE_AUTO_PATH_MIG = (1 <<4 ), +IB_DEVICE_CHANGE_PHY_PORT = (1 <<5 ), +IB_DEVICE_UD_AV_PORT_ENFORCE = (1 <<6 ), +IB_DEVICE_CURR_QP_STATE_MOD = (1 <<7 ), +IB_DEVICE_SHUTDOWN_PORT = (1 <<8 ), +IB_DEVICE_INIT_TYPE = (1 <<9 ), +IB_DEVICE_PORT_ACTIVE_EVENT = (1 <<10 ), +IB_DEVICE_SYS_IMAGE_GUID = (1 <<11 ), +IB_DEVICE_RC_RNR_NAK_GEN = (1 <<12 ), +IB_DEVICE_SRQ_RESIZE = (1 <<13 ), +IB_DEVICE_N_NOTIFY_CQ = (1 <<14 ), +IB_DEVICE_LOCAL_DMA_LKEY = (1 <<15 ), +IB_DEVICE_RESERVED = (1 <<16 ),/* old SEND_W_INV */ +IB_DEVICE_MEM_WINDOW = (1 <<17 ),/* * Devices should set IB_DEVICE_UD_IP_SUM if they support * insertion of UDP and TCP checksum on outgoing UD IPoIB
@@ -130,18 +130,18 @@ enum ib_device_cap_flags {* incoming messages. Setting this flag implies that the * IPoIB driver may set NETIF_F_IP_CSUM for datagram mode. */ -IB_DEVICE_UD_IP_CSUM = (1 <<18 ), -IB_DEVICE_UD_TSO = (1 <<19 ), -IB_DEVICE_XRC = (1 <<20 ), -IB_DEVICE_MEM_MGT_EXTENSIONS = (1 <<21 ), -IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1 <<22 ), -IB_DEVICE_MEM_WINDOW_TYPE_2A = (1 <<23 ), -IB_DEVICE_MEM_WINDOW_TYPE_2B = (1 <<24 ), -IB_DEVICE_RC_IP_CSUM = (1 <<25 ), -IB_DEVICE_RAW_IP_CSUM = (1 <<26 ), -IB_DEVICE_MANAGED_FLOW_STEERING = (1 <<29 ), -IB_DEVICE_SIGNATURE_HANDOVER = (1 <<30 ), - IB_DEVICE_ON_DEMAND_PAGING = (1<<31), +IB_DEVICE_UD_IP_CSUM = (1 <<18 ), +IB_DEVICE_UD_TSO = (1 <<19 ), +IB_DEVICE_XRC = (1 <<20 ), +IB_DEVICE_MEM_MGT_EXTENSIONS = (1 <<21 ), +IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1 <<22 ), +IB_DEVICE_MEM_WINDOW_TYPE_2A = (1 <<23 ), +IB_DEVICE_MEM_WINDOW_TYPE_2B = (1 <<24 ), +IB_DEVICE_RC_IP_CSUM = (1 <<25 ), +IB_DEVICE_RAW_IP_CSUM = (1 <<26 ), +IB_DEVICE_MANAGED_FLOW_STEERING = (1 <<29 ), +IB_DEVICE_SIGNATURE_HANDOVER = (1 <<30 ), + IB_DEVICE_ON_DEMAND_PAGING = (1 << 31), }; enum ib_signature_prot_cap {
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 2/3 IB/core: Add cross-channel support
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The cross-channel feature allows to execute WQEs that involve synchronization of I/O operations’ on different QPs.
This capability enables to program complex flows with a single function call, hereby significantly reducing overhead associated with I/O processing.
Cross-channel operations support is indicated by HCA capability information.
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. This check is useless in cross-channel scenario.
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
@@ -1843,7 +1843,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
@@ -139,6 +139,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),
@@ -184,6 +191,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 {
@@ -866,6 +874,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 3/3 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 | 12 ++++++++++++ drivers/infiniband/hw/mlx5/qp.c | 29 +++++++++++++++++++++++++++++ include/linux/mlx5/qp.h | 3 +++ 5 files changed, 53 insertions(+), 1 deletion(-)
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
@@ -300,6 +300,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, props->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 +12 -0
@@ -242,6 +242,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 +287,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 +666,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 +29 -0
@@ -880,6 +880,21 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, } } +if (init_attr->create_flags & + (IB_QP_CREATE_CROSS_CHANNEL | +IB_QP_CREATE_MANAGED_SEND | +IB_QP_CREATE_MANAGED_RECV )) { +if (!MLX5_CAP_GEN (mdev, cd)) { +mlx5_ib_dbg (dev,"cross-channel isn't supported\n" ); +return -EINVAL ; + } +if (init_attr->create_flags &IB_QP_CREATE_CROSS_CHANNEL ) + qp->flags |=MLX5_IB_QP_CROSS_CHANNEL ; +if (init_attr->create_flags &IB_QP_CREATE_MANAGED_SEND ) + qp->flags |=MLX5_IB_QP_MANAGED_SEND ; +if (init_attr->create_flags &IB_QP_CREATE_MANAGED_RECV ) + qp->flags |=MLX5_IB_QP_MANAGED_RECV ; + }if (init_attr->sq_sig_type ==IB_SIGNAL_ALL_WR ) qp->sq_signal_bits =MLX5_WQE_CTRL_CQ_UPDATE ;
@@ -954,6 +969,13 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd,if (qp->flags &MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK ) in->ctx.flags_pd |=cpu_to_be32 (MLX5_QP_BLOCK_MCAST ); +if (qp->flags &MLX5_IB_QP_CROSS_CHANNEL ) + in->ctx.params2 |=cpu_to_be32 (MLX5_QP_BIT_CC_MASTER ); +if (qp->flags &MLX5_IB_QP_MANAGED_SEND ) + in->ctx.params2 |=cpu_to_be32 (MLX5_QP_BIT_CC_SLAVE_SEND ); +if (qp->flags &MLX5_IB_QP_MANAGED_RECV ) + in->ctx.params2 |=cpu_to_be32 (MLX5_QP_BIT_CC_SLAVE_RECV ); +if (qp->scat_cqe &&is_connected (init_attr->qp_type)) {int rcqe_sz;int scqe_sz;
@@ -3110,6 +3132,13 @@ int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attrif (qp->flags &MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK ) qp_init_attr->create_flags |=IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK ; +if (qp->flags &MLX5_IB_QP_CROSS_CHANNEL ) + qp_init_attr->create_flags |=IB_QP_CREATE_CROSS_CHANNEL ; +if (qp->flags &MLX5_IB_QP_MANAGED_SEND ) + qp_init_attr->create_flags |=IB_QP_CREATE_MANAGED_SEND ; +if (qp->flags &MLX5_IB_QP_MANAGED_RECV ) + qp_init_attr->create_flags |=IB_QP_CREATE_MANAGED_RECV ; + qp_init_attr->sq_sig_type = qp->sq_signal_bits &MLX5_WQE_CTRL_CQ_UPDATE ?IB_SIGNAL_ALL_WR :IB_SIGNAL_REQ_WR ;
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