Skip to contentSkip to conversation

Dynamically Connected support

PATCH In review Eli Cohen 2 participants 8 messages Nov 6, 2014 – Nov 9, 2014 3 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

Eli Cohen

author
#0 lore raw

cover Dynamically Connected support

Hi Roland,

the following series of patches introduces a new transport service named DC. Support is added at IB/core layer, uverbs interface to userspace and mlx5 for Connect-IB devices. Details on the new transport can be found in the first patch in the series.

Eli

Eli Cohen (5):
IB/core: Add DC transport support IB/uverbs: Add userspace interface to DC verbs
mlx5_core: Add DC support at mlx5 core layer
mlx5_ib: Add support for DC
mlx5_core: Update mlx5_command_str with DC commands

 drivers/infiniband/core/uverbs.h                  |  11 +
 drivers/infiniband/core/uverbs_cmd.c              | 474 +++++++++++++++++++---
 drivers/infiniband/core/uverbs_main.c             |  35 +-
 drivers/infiniband/core/verbs.c                   |  87 ++++
 drivers/infiniband/hw/mlx5/main.c                 |  19 +
 drivers/infiniband/hw/mlx5/mlx5_ib.h              |  24 ++
 drivers/infiniband/hw/mlx5/qp.c                   | 289 ++++++++++++-
 drivers/infiniband/hw/mlx5/user.h                 |  41 ++
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c     |  21 +-
 drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 110 +++++
 drivers/net/ethernet/mellanox/mlx5/core/eq.c      |  15 +-
 drivers/net/ethernet/mellanox/mlx5/core/main.c    |   6 +
 drivers/net/ethernet/mellanox/mlx5/core/qp.c      | 185 +++++++++
 include/linux/mlx5/device.h                       |  12 +
 include/linux/mlx5/driver.h                       |  24 +-
 include/linux/mlx5/mlx5_ifc.h                     | 179 ++++++++
 include/linux/mlx5/qp.h                           |  39 +-
 include/rdma/ib_verbs.h                           |  88 +++-
 include/uapi/rdma/ib_user_verbs.h                 | 126 +++++-
 19 files changed, 1710 insertions(+), 75 deletions(-)
Signature · 6 lines
2.1.2

--
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
author
#2 lore raw

PATCH 1/5 IB/core: Add DC transport support

In reply to a message not in the archive

The Dynamically Connected (DC) Transport Service provides a reliable datagram-like model that allows a single sender to target multiple destinations from the same QP, keeping the communication resource footprint essentially independent of system size. DC supports RDMA read and write operations, as well as atomic variable updates. With this transport a DC initiator QP may be used to target multiple remote DC Targets, in one or more remote processes. As far as reachability is concerned, the DC model is somewhat similar to the Unreliable Datagram (UD) model in the sense that each WR submitted to the DC SQ carries the information that identifies the remote destination. DC contexts are then dynamically tied to each other across the network to create a temporary RC-equivalent connection that is used to reliably deliver one or more messages. This dynamic connection is created in-band and pipelined with the subsequent data communication thus eliminating most of the cost associated with the 3-way handshake off the Connection Manager protocol used for connecting RC QPs. When all WRs posted to that remote network address are acknowledged, the initiator sends a disconnect request to the responder, thereby releasing the responder resources.
A DC initiator is yet another type of QP identified by a new transport type, IB_QPT_DC_INI. The target is end is presented by a new object of type ib_dct.

This patch extend the verbs API with the following new APIs:
ib_create_dc - Create a DC target
ib_destroy_dct - Destroy a DC target
ib_query_dct - query DC target
ib_arm_dct - Arm a DC target to generate asynchronous event on DC key violation. Once a event is generated, the DC target moves to a fired state and will not generated further key violation events unless re-armed.

ib_modify_qp_ex - is an extension to ib_modify_qp which allows to pass the 64 bit DC key.

---
 drivers/infiniband/core/verbs.c | 87 +++++++++++++++++++++++++++++++++++++++++
 include/rdma/ib_verbs.h         | 87 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/infiniband/core/verbs.c +87 -0
index c2b89cc5dbca..c2b2d00c9794 100644
@@ -521,6 +521,9 @@ static const struct {
 				[IB_QPT_RC]  = (IB_QP_PKEY_INDEX		|
 						IB_QP_PORT			|
 						IB_QP_ACCESS_FLAGS),
+				[IB_QPT_DC_INI]  = (IB_QP_PKEY_INDEX		|
+						    IB_QP_PORT			|
+						    IB_QP_DC_KEY),
 				[IB_QPT_XRC_INI] = (IB_QP_PKEY_INDEX		|
 						IB_QP_PORT			|
 						IB_QP_ACCESS_FLAGS),
@@ -549,6 +552,9 @@ static const struct {
 				[IB_QPT_RC]  = (IB_QP_PKEY_INDEX		|
 						IB_QP_PORT			|
 						IB_QP_ACCESS_FLAGS),
+				[IB_QPT_DC_INI]  = (IB_QP_PKEY_INDEX		|
+						    IB_QP_PORT			|
+						    IB_QP_DC_KEY),
 				[IB_QPT_XRC_INI] = (IB_QP_PKEY_INDEX		|
 						IB_QP_PORT			|
 						IB_QP_ACCESS_FLAGS),
@@ -574,6 +580,8 @@ static const struct {
 						IB_QP_RQ_PSN			|
 						IB_QP_MAX_DEST_RD_ATOMIC	|
 						IB_QP_MIN_RNR_TIMER),
+				[IB_QPT_DC_INI]  = (IB_QP_AV			|
+						    IB_QP_PATH_MTU),
 				[IB_QPT_XRC_INI] = (IB_QP_AV			|
 						IB_QP_PATH_MTU			|
 						IB_QP_DEST_QPN			|
@@ -600,6 +608,8 @@ static const struct {
 				 [IB_QPT_RC]  = (IB_QP_ALT_PATH			|
 						 IB_QP_ACCESS_FLAGS		|
 						 IB_QP_PKEY_INDEX),
+				 [IB_QPT_DC_INI]  = (IB_QP_PKEY_INDEX		|
+						     IB_QP_DC_KEY),
 				 [IB_QPT_XRC_INI] = (IB_QP_ALT_PATH		|
 						 IB_QP_ACCESS_FLAGS		|
 						 IB_QP_PKEY_INDEX),
@@ -640,6 +650,10 @@ static const struct {
 						IB_QP_RNR_RETRY			|
 						IB_QP_SQ_PSN			|
 						IB_QP_MAX_QP_RD_ATOMIC),
+				[IB_QPT_DC_INI]  = (IB_QP_TIMEOUT		|
+						    IB_QP_RETRY_CNT		|
+						    IB_QP_RNR_RETRY		|
+						    IB_QP_MAX_QP_RD_ATOMIC),
 				[IB_QPT_XRC_INI] = (IB_QP_TIMEOUT		|
 						IB_QP_RETRY_CNT			|
 						IB_QP_RNR_RETRY			|
@@ -662,6 +676,10 @@ static const struct {
 						 IB_QP_ACCESS_FLAGS		|
 						 IB_QP_MIN_RNR_TIMER		|
 						 IB_QP_PATH_MIG_STATE),
+				[IB_QPT_DC_INI] = (IB_QP_CUR_STATE		|
+						   IB_QP_ALT_PATH		|
+						   IB_QP_MIN_RNR_TIMER		|
+						   IB_QP_PATH_MIG_STATE),
 				 [IB_QPT_XRC_INI] = (IB_QP_CUR_STATE		|
 						 IB_QP_ALT_PATH			|
 						 IB_QP_ACCESS_FLAGS		|
@@ -695,6 +713,10 @@ static const struct {
 						IB_QP_ALT_PATH			|
 						IB_QP_PATH_MIG_STATE		|
 						IB_QP_MIN_RNR_TIMER),
+				[IB_QPT_DC_INI]  = (IB_QP_CUR_STATE		|
+						    IB_QP_ALT_PATH		|
+						    IB_QP_PATH_MIG_STATE	|
+						    IB_QP_MIN_RNR_TIMER),
 				[IB_QPT_XRC_INI] = (IB_QP_CUR_STATE		|
 						IB_QP_ACCESS_FLAGS		|
 						IB_QP_ALT_PATH			|
@@ -1438,6 +1460,71 @@ int ib_destroy_flow(struct ib_flow *flow_id)
 }
 EXPORT_SYMBOL(ib_destroy_flow);
 
+struct ib_dct *ib_create_dct(struct ib_pd *pd, struct ib_dct_init_attr *attr,
+			     struct ib_udata *uhw)
+{
+	struct ib_dct *dct;
+
+	if (!pd->device->create_dct)
+		return ERR_PTR(-ENOSYS);
+
+	dct = pd->device->create_dct(pd, attr, uhw);
+	if (!IS_ERR(dct)) {
+		dct->pd = pd;
+		dct->srq = attr->srq;
+		dct->cq = attr->cq;
+		atomic_inc(&dct->srq->usecnt);
+		atomic_inc(&dct->cq->usecnt);
+		atomic_inc(&dct->pd->usecnt);
+	}
+
+	return dct;
+}
+EXPORT_SYMBOL(ib_create_dct);
+
+int ib_destroy_dct(struct ib_dct *dct, struct ib_udata *uhw)
+{
+	struct ib_srq *srq;
+	struct ib_cq *cq;
+	struct ib_pd *pd;
+	int err;
+
+	if (!dct->device->destroy_dct)
+		return -ENOSYS;
+
+	srq = dct->srq;
+	cq = dct->cq;
+	pd = dct->pd;
+	err = dct->device->destroy_dct(dct, uhw);
+	if (!err) {
+		atomic_dec(&srq->usecnt);
+		atomic_dec(&cq->usecnt);
+		atomic_dec(&pd->usecnt);
+	}
+
+	return err;
+}
+EXPORT_SYMBOL(ib_destroy_dct);
+
+int ib_query_dct(struct ib_dct *dct, struct ib_dct_attr *attr,
+		 struct ib_udata *uhw)
+{
+	if (!dct->device->query_dct)
+		return -ENOSYS;
+
+	return dct->device->query_dct(dct, attr, uhw);
+}
+EXPORT_SYMBOL(ib_query_dct);
+
+int ib_arm_dct(struct ib_dct *dct, struct ib_udata *uhw)
+{
+	if (!dct->device->arm_dct)
+		return -ENOSYS;
+
+	return dct->device->arm_dct(dct, uhw);
+}
+EXPORT_SYMBOL(ib_arm_dct);
+
 int ib_check_mr_status(struct ib_mr *mr, u32 check_mask,
 		       struct ib_mr_status *mr_status)
 {
include/rdma/ib_verbs.h +85 -2

153 lines not on this page · raw message

Signature · 6 lines
2.1.2

--
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
author
#7 lore raw

PATCH 2/5 IB/uverbs: Add userspace interface to DC verbs

In reply to a message not in the archive
---
 drivers/infiniband/core/uverbs.h      |  11 +
 drivers/infiniband/core/uverbs_cmd.c  | 474 +++++++++++++++++++++++++++++-----
 drivers/infiniband/core/uverbs_main.c |  35 ++-
 include/rdma/ib_verbs.h               |   1 +
 include/uapi/rdma/ib_user_verbs.h     | 126 ++++++++-
 5 files changed, 584 insertions(+), 63 deletions(-)
drivers/infiniband/core/uverbs.h +11 -0
index b716b0815644..3343696df6b1 100644
@@ -163,6 +163,10 @@ struct ib_ucq_object {
 	u32			async_events_reported;
 };
 
+struct ib_udct_object {
+	struct ib_uevent_object	uevent;
+};
+
 extern spinlock_t ib_uverbs_idr_lock;
 extern struct idr ib_uverbs_pd_idr;
 extern struct idr ib_uverbs_mr_idr;
@@ -173,6 +177,7 @@ extern struct idr ib_uverbs_qp_idr;
 extern struct idr ib_uverbs_srq_idr;
 extern struct idr ib_uverbs_xrcd_idr;
 extern struct idr ib_uverbs_rule_idr;
+extern struct idr ib_uverbs_dct_idr;
 
 void idr_remove_uobj(struct idr *idp, struct ib_uobject *uobj);
 
@@ -189,6 +194,7 @@ void ib_uverbs_release_uevent(struct ib_uverbs_file *file,
 void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context);
 void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr);
 void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr);
+void ib_uverbs_dct_event_handler(struct ib_event *event, void *context_ptr);
 void ib_uverbs_srq_event_handler(struct ib_event *event, void *context_ptr);
 void ib_uverbs_event_handler(struct ib_event_handler *handler,
 			     struct ib_event *event);
@@ -259,5 +265,10 @@ IB_UVERBS_DECLARE_CMD(close_xrcd);
 IB_UVERBS_DECLARE_EX_CMD(create_flow);
 IB_UVERBS_DECLARE_EX_CMD(destroy_flow);
 IB_UVERBS_DECLARE_EX_CMD(query_device);
+IB_UVERBS_DECLARE_EX_CMD(create_dct);
+IB_UVERBS_DECLARE_EX_CMD(destroy_dct);
+IB_UVERBS_DECLARE_EX_CMD(query_dct);
+IB_UVERBS_DECLARE_EX_CMD(arm_dct);
+IB_UVERBS_DECLARE_EX_CMD(modify_qp);
 
 #endif /* UVERBS_H */
drivers/infiniband/core/uverbs_cmd.c +413 -61

539 lines not on this page · raw message

drivers/infiniband/core/uverbs_main.c +34 -1
index 974025028790..64ba9afd97f4 100644
@@ -74,6 +74,7 @@ DEFINE_IDR(ib_uverbs_qp_idr);
 DEFINE_IDR(ib_uverbs_srq_idr);
 DEFINE_IDR(ib_uverbs_xrcd_idr);
 DEFINE_IDR(ib_uverbs_rule_idr);
+DEFINE_IDR(ib_uverbs_dct_idr);
 
 static DEFINE_SPINLOCK(map_lock);
 static DECLARE_BITMAP(dev_map, IB_UVERBS_MAX_DEVICES);
@@ -123,7 +124,12 @@ static int (*uverbs_ex_cmd_table[])(struct ib_uverbs_file *file,
 				    struct ib_udata *uhw) = {
 	[IB_USER_VERBS_EX_CMD_CREATE_FLOW]	= ib_uverbs_ex_create_flow,
 	[IB_USER_VERBS_EX_CMD_DESTROY_FLOW]	= ib_uverbs_ex_destroy_flow,
-	[IB_USER_VERBS_EX_CMD_QUERY_DEVICE]	= ib_uverbs_ex_query_device
+	[IB_USER_VERBS_EX_CMD_QUERY_DEVICE]	= ib_uverbs_ex_query_device,
+	[IB_USER_VERBS_EX_CMD_CREATE_DCT]	= ib_uverbs_ex_create_dct,
+	[IB_USER_VERBS_EX_CMD_DESTROY_DCT]	= ib_uverbs_ex_destroy_dct,
+	[IB_USER_VERBS_EX_CMD_QUERY_DCT]	= ib_uverbs_ex_query_dct,
+	[IB_USER_VERBS_EX_CMD_ARM_DCT]		= ib_uverbs_ex_arm_dct,
+	[IB_USER_VERBS_EX_CMD_MODIFY_QP]	= ib_uverbs_ex_modify_qp,
 };
 
 static void ib_uverbs_add_one(struct ib_device *device);
@@ -199,6 +205,7 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
 				      struct ib_ucontext *context)
 {
 	struct ib_uobject *uobj, *tmp;
+	int err;
 
 	if (!context)
 		return 0;
@@ -246,6 +253,20 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
 		kfree(uqp);
 	}
 
+	list_for_each_entry_safe(uobj, tmp, &context->dct_list, list) {
+		struct ib_dct *dct = uobj->object;
+		struct ib_udct_object *udct =
+			container_of(uobj, struct ib_udct_object, uevent.uobject);
+
+		idr_remove_uobj(&ib_uverbs_dct_idr, uobj);
+
+		err = ib_destroy_dct(dct, NULL);
+		if (err)
+			pr_warn("destroying uverbs dct failed: err %d\n", err);
+
+		kfree(udct);
+	}
+
 	list_for_each_entry_safe(uobj, tmp, &context->cq_list, list) {
 		struct ib_cq *cq = uobj->object;
 		struct ib_uverbs_event_file *ev_file = cq->cq_context;
@@ -516,6 +537,18 @@ void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr)
 				&uobj->events_reported);
 }
 
+void ib_uverbs_dct_event_handler(struct ib_event *event, void *context_ptr)
+{
+	struct ib_uevent_object *uobj;
+
+	uobj = container_of(event->element.dct->uobject,
+			    struct ib_uevent_object, uobject);
+
+	ib_uverbs_async_handler(context_ptr, uobj->uobject.user_handle,
+				event->event, &uobj->event_list,
+				&uobj->events_reported);
+}
+
 void ib_uverbs_srq_event_handler(struct ib_event *event, void *context_ptr)
 {
 	struct ib_uevent_object *uobj;
include/rdma/ib_verbs.h +1 -0
index 9c67cffe1ecc..97eb232ce05b 100644
@@ -1147,6 +1147,7 @@ struct ib_ucontext {
 	struct list_head	ah_list;
 	struct list_head	xrcd_list;
 	struct list_head	rule_list;
+	struct list_head	dct_list;
 	int			closing;
 };
 
include/uapi/rdma/ib_user_verbs.h +125 -1

156 lines not on this page · raw message

Signature · 6 lines
2.1.2

--
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
author
#8 lore raw

PATCH 3/5 mlx5_core: Add DC support at mlx5 core layer

In reply to a message not in the archive

Update debugfs, implement DC commands and handle events.

---
 drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 110 +++++++++++++
 drivers/net/ethernet/mellanox/mlx5/core/eq.c      |  15 +-
 drivers/net/ethernet/mellanox/mlx5/core/main.c    |   6 +
 drivers/net/ethernet/mellanox/mlx5/core/qp.c      | 185 ++++++++++++++++++++++
 include/linux/mlx5/device.h                       |  12 ++
 include/linux/mlx5/driver.h                       |  24 ++-
 include/linux/mlx5/mlx5_ifc.h                     | 179 +++++++++++++++++++++
 include/linux/mlx5/qp.h                           |  39 ++++-
 8 files changed, 566 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +110 -0
index 10e1f1a18255..3e115dee235a 100644
@@ -35,6 +35,7 @@
 #include <linux/mlx5/qp.h>
 #include <linux/mlx5/cq.h>
 #include <linux/mlx5/driver.h>
+#include <linux/mlx5/mlx5_ifc.h>
 #include "mlx5_core.h"
 
 enum {
@@ -62,6 +63,22 @@ static char *qp_fields[] = {
 };
 
 enum {
+	DCT_PID,
+	DCT_STATE,
+	DCT_MTU,
+	DCT_KEY_VIOL,
+	DCT_CQN,
+};
+
+static char *dct_fields[] = {
+	[DCT_PID]	= "pid",
+	[DCT_STATE]	= "state",
+	[DCT_MTU]	= "mtu",
+	[DCT_KEY_VIOL]	= "key_violations",
+	[DCT_CQN]	= "cqn",
+};
+
+enum {
 	EQ_NUM_EQES,
 	EQ_INTR,
 	EQ_LOG_PG_SZ,
@@ -122,6 +139,26 @@ void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev)
 	debugfs_remove_recursive(dev->priv.qp_debugfs);
 }
 
+int mlx5_dct_debugfs_init(struct mlx5_core_dev *dev)
+{
+	if (!mlx5_debugfs_root)
+		return 0;
+
+	dev->priv.dct_debugfs = debugfs_create_dir("DCTs",  dev->priv.dbg_root);
+	if (!dev->priv.dct_debugfs)
+		return -ENOMEM;
+
+	return 0;
+}
+
+void mlx5_dct_debugfs_cleanup(struct mlx5_core_dev *dev)
+{
+	if (!mlx5_debugfs_root)
+		return;
+
+	debugfs_remove_recursive(dev->priv.dct_debugfs);
+}
+
 int mlx5_eq_debugfs_init(struct mlx5_core_dev *dev)
 {
 	if (!mlx5_debugfs_root)
@@ -355,6 +392,51 @@ out:
 	return param;
 }
 
+static u64 dct_read_field(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct,
+			  int index, int *is_str)
+{
+	void *out;
+	void *dctc;
+	int out_sz = MLX5_ST_SZ_BYTES(query_dct_out);
+	u64 param = 0;
+	int err;
+
+	out = kzalloc(out_sz, GFP_KERNEL);
+	if (!out)
+		return param;
+
+	err = mlx5_core_dct_query(dev, dct, out);
+	if (err) {
+		mlx5_core_warn(dev, "failed to query dct\n");
+		goto out;
+	}
+
+	dctc = MLX5_ADDR_OF(query_dct_out, out, dct_context_entry);
+	*is_str = 0;
+	switch (index) {
+	case DCT_PID:
+		param = dct->pid;
+		break;
+	case DCT_STATE:
+		param = (u64)mlx5_dct_state_str(MLX5_GET(dctc, dctc, state));
+		*is_str = 1;
+		break;
+	case DCT_MTU:
+		param = ib_mtu_enum_to_int(MLX5_GET(dctc, dctc, mtu));
+		break;
+	case DCT_KEY_VIOL:
+		param = MLX5_GET(dctc, dctc, dc_access_key_violation_count);
+		break;
+	case DCT_CQN:
+		param = MLX5_GET(dctc, dctc, cqn);
+		break;
+	}
+
+out:
+	kfree(out);
+	return param;
+}
+
 static u64 eq_read_field(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
 			 int index)
 {
@@ -457,6 +539,10 @@ static ssize_t dbg_read(struct file *filp, char __user *buf, size_t count,
 		field = cq_read_field(d->dev, d->object, desc->i);
 		break;
 
+	case MLX5_DBG_RSC_DCT:
+		field = dct_read_field(d->dev, d->object, desc->i, &is_str);
+		break;
+
 	default:
 		mlx5_core_warn(d->dev, "invalid resource type %d\n", d->type);
 		return -EINVAL;
@@ -558,6 +644,30 @@ void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp)
 		rem_res_tree(qp->dbg);
 }
 
+int mlx5_debug_dct_add(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct)
+{
+	int err;
+
+	if (!mlx5_debugfs_root)
+		return 0;
+
+	err = add_res_tree(dev, MLX5_DBG_RSC_DCT, dev->priv.dct_debugfs,
+			   &dct->dbg, dct->dctn, dct_fields,
+			   ARRAY_SIZE(dct_fields), dct);
+	if (err)
+		dct->dbg = NULL;
+
+	return err;
+}
+
+void mlx5_debug_dct_remove(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct)
+{
+	if (!mlx5_debugfs_root)
+		return;
+
+	if (dct->dbg)
+		rem_res_tree(dct->dbg);
+}
 
 int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
 {
drivers/net/ethernet/mellanox/mlx5/core/eq.c +14 -1
index ad2c96a02a53..941077ea7a7a 100644
@@ -68,7 +68,9 @@ enum {
 			       (1ull << MLX5_EVENT_TYPE_PORT_CHANGE)	    | \
 			       (1ull << MLX5_EVENT_TYPE_SRQ_CATAS_ERROR)    | \
 			       (1ull << MLX5_EVENT_TYPE_SRQ_LAST_WQE)	    | \
-			       (1ull << MLX5_EVENT_TYPE_SRQ_RQ_LIMIT))
+			       (1ull << MLX5_EVENT_TYPE_SRQ_RQ_LIMIT)	    | \
+			       (1ull << MLX5_EVENT_TYPE_DCT_DRAINED)	    | \
+			       (1ull << MLX5_EVENT_TYPE_DCT_KEY_VIOLATION))
 
 struct map_eq_in {
 	u64	mask;
@@ -157,6 +159,11 @@ static const char *eqe_type_str(u8 type)
 		return "MLX5_EVENT_TYPE_CMD";
 	case MLX5_EVENT_TYPE_PAGE_REQUEST:
 		return "MLX5_EVENT_TYPE_PAGE_REQUEST";
+	case MLX5_EVENT_TYPE_DCT_DRAINED:
+		return "MLX5_EVENT_TYPE_DCT_DRAINED";
+	case MLX5_EVENT_TYPE_DCT_KEY_VIOLATION:
+		return "MLX5_EVENT_TYPE_DCT_KEY_VIOLATION";
+
 	default:
 		return "Unrecognized event";
 	}
@@ -216,6 +223,12 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
 			mlx5_cq_completion(dev, cqn);
 			break;
 
+		case MLX5_EVENT_TYPE_DCT_DRAINED:
+		case MLX5_EVENT_TYPE_DCT_KEY_VIOLATION:
+			rsn = be32_to_cpu(eqe->data.dct.dctn) & 0xffffff;
+			mlx5_rsc_event(dev, rsn, eqe->type);
+			break;
+
 		case MLX5_EVENT_TYPE_PATH_MIG:
 		case MLX5_EVENT_TYPE_COMM_EST:
 		case MLX5_EVENT_TYPE_SQ_DRAINED:
drivers/net/ethernet/mellanox/mlx5/core/main.c +6 -0
index ecc6341e728a..44864d584660 100644
@@ -434,6 +434,9 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
 	/* disable checksum */
 	cur_caps->gen.flags &= ~MLX5_DEV_CAP_FLAG_CMDIF_CSUM;
 
+	if (max_caps->gen.flags & MLX5_DEV_CAP_FLAG_DCT)
+		cur_caps->gen.flags |= MLX5_DEV_CAP_FLAG_DCT;
+
 	copy_rw_fields(MLX5_ADDR_OF(set_hca_cap_in, set_ctx, hca_capability_struct),
 		       cur_caps);
 	err = set_caps(dev, set_ctx, set_sz);
@@ -640,6 +643,7 @@ static int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev)
 	mlx5_init_qp_table(dev);
 	mlx5_init_srq_table(dev);
 	mlx5_init_mr_table(dev);
+	mlx5_init_dct_table(dev);
 
 	return 0;
 
@@ -692,6 +696,8 @@ static void mlx5_dev_cleanup(struct mlx5_core_dev *dev)
 {
 	struct mlx5_priv *priv = &dev->priv;
 
+	mlx5_cleanup_dct_table(dev);
+	mlx5_cleanup_mr_table(dev);
 	mlx5_cleanup_srq_table(dev);
 	mlx5_cleanup_qp_table(dev);
 	mlx5_cleanup_cq_table(dev);
drivers/net/ethernet/mellanox/mlx5/core/qp.c +185 -0

212 lines not on this page · raw message

include/linux/mlx5/device.h +12 -0
index 6e9661105dfa..40db09d6c828 100644
@@ -206,6 +206,8 @@ enum mlx5_event {
 
 	MLX5_EVENT_TYPE_CMD		   = 0x0a,
 	MLX5_EVENT_TYPE_PAGE_REQUEST	   = 0xb,
+	MLX5_EVENT_TYPE_DCT_DRAINED	   = 0x1c,
+	MLX5_EVENT_TYPE_DCT_KEY_VIOLATION  = 0x1d,
 };
 
 enum {
@@ -241,6 +243,10 @@ enum {
 };
 
 enum {
+	MLX5_DCT_CS_RES_64	= 2,
+};
+
+enum {
 	MLX5_OPCODE_NOP			= 0x00,
 	MLX5_OPCODE_SEND_INVAL		= 0x01,
 	MLX5_OPCODE_RDMA_WRITE		= 0x08,
@@ -449,6 +455,11 @@ struct mlx5_eqe_page_req {
 	__be32		rsvd1[5];
 };
 
+struct mlx5_eqe_dct {
+	__be32	reserved[6];
+	__be32	dctn;
+};
+
 union ev_data {
 	__be32				raw[7];
 	struct mlx5_eqe_cmd		cmd;
@@ -460,6 +471,7 @@ union ev_data {
 	struct mlx5_eqe_congestion	cong;
 	struct mlx5_eqe_stall_vl	stall_vl;
 	struct mlx5_eqe_page_req	req_pages;
+	struct mlx5_eqe_dct		dct;
 } __packed;
 
 struct mlx5_eqe {
include/linux/mlx5/driver.h +23 -1
index bdca5d94e6fc..47177f6c6f95 100644
@@ -116,7 +116,6 @@ enum {
 	MLX5_REG_PUDE		 = 0x5009,
 	MLX5_REG_PMPE		 = 0x5010,
 	MLX5_REG_PELC		 = 0x500e,
-	MLX5_REG_PMLP		 = 0, /* TBD */
 	MLX5_REG_NODE_DESC	 = 0x6001,
 	MLX5_REG_HOST_ENDIANNESS = 0x7004,
 };
@@ -125,6 +124,7 @@ enum dbg_rsc_type {
 	MLX5_DBG_RSC_QP,
 	MLX5_DBG_RSC_EQ,
 	MLX5_DBG_RSC_CQ,
+	MLX5_DBG_RSC_DCT,
 };
 
 struct mlx5_field_desc {
@@ -393,6 +393,7 @@ struct mlx5_core_mr {
 
 enum mlx5_res_type {
 	MLX5_RES_QP,
+	MLX5_RES_DCT,
 };
 
 struct mlx5_core_rsc_common {
@@ -401,6 +402,16 @@ struct mlx5_core_rsc_common {
 	struct completion	free;
 };
 
+struct mlx5_core_dct {
+	struct mlx5_core_rsc_common	common; /* must be first */
+	int			dctn;
+	struct completion	drained;
+	struct mlx5_rsc_debug	*dbg;
+	int			pid;
+
+	void (*event)(struct mlx5_core_dct *, enum mlx5_event);
+};
+
 struct mlx5_core_srq {
 	u32		srqn;
 	int		max;
@@ -498,6 +509,10 @@ struct mlx5_priv {
 	struct dentry	       *cmdif_debugfs;
 	/* end: qp staff */
 
+	/* start: dct stuff */
+	struct dentry	       *dct_debugfs;
+	/* end: dct stuff */
+
 	/* start: cq staff */
 	struct mlx5_cq_table	cq_table;
 	/* end: cq staff */
@@ -764,6 +779,8 @@ int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,
 			 int npsvs, u32 *sig_index);
 int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
 void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common);
+int mlx5_dct_debugfs_init(struct mlx5_core_dev *dev);
+void mlx5_dct_debugfs_cleanup(struct mlx5_core_dev *dev);
 
 static inline u32 mlx5_mkey_to_idx(u32 mkey)
 {
@@ -832,4 +849,9 @@ static inline const char *caps_opmod_str(u16 opmod)
 	}
 }
 
+static inline int mlx5_get_out_cmd_status(void *ptr)
+{
+	return *(u8 *)ptr;
+}
+
 #endif /* MLX5_DRIVER_H */
include/linux/mlx5/mlx5_ifc.h +179 -0

183 lines not on this page · raw message

include/linux/mlx5/qp.h +37 -2
index 3fa075daeb1d..094160d59d99 100644
@@ -91,8 +91,7 @@ enum {
 	MLX5_QP_ST_UD				= 0x2,
 	MLX5_QP_ST_XRC				= 0x3,
 	MLX5_QP_ST_MLX				= 0x4,
-	MLX5_QP_ST_DCI				= 0x5,
-	MLX5_QP_ST_DCT				= 0x6,
+	MLX5_QP_ST_DC				= 0x5,
 	MLX5_QP_ST_QP0				= 0x7,
 	MLX5_QP_ST_QP1				= 0x8,
 	MLX5_QP_ST_RAW_ETHERTYPE		= 0x9,
@@ -130,6 +129,12 @@ enum {
 };
 
 enum {
+	MLX5_DCT_BIT_RRE	= 1 << 19,
+	MLX5_DCT_BIT_RWE	= 1 << 18,
+	MLX5_DCT_BIT_RAE	= 1 << 17,
+};
+
+enum {
 	MLX5_WQE_CTRL_CQ_UPDATE		= 2 << 2,
 	MLX5_WQE_CTRL_SOLICITED		= 1 << 1,
 };
@@ -160,6 +165,12 @@ enum {
 };
 
 enum {
+	MLX5_DCT_STATE_ACTIVE	= 0,
+	MLX5_DCT_STATE_DRAINING	= 1,
+	MLX5_DCT_STATE_DRAINED	= 2
+};
+
+enum {
 	MLX5_RCV_DBR	= 0,
 	MLX5_SND_DBR	= 1,
 };
@@ -547,8 +558,20 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn);
 int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
 void mlx5_init_qp_table(struct mlx5_core_dev *dev);
 void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev);
+void mlx5_init_dct_table(struct mlx5_core_dev *dev);
+void mlx5_cleanup_dct_table(struct mlx5_core_dev *dev);
 int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
 void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
+int mlx5_core_create_dct(struct mlx5_core_dev *dev,
+			 struct mlx5_core_dct *dct,
+			 void *in);
+int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
+			  struct mlx5_core_dct *dct);
+int mlx5_core_dct_query(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct,
+			void *out);
+int mlx5_core_arm_dct(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct);
+int mlx5_debug_dct_add(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct);
+void mlx5_debug_dct_remove(struct mlx5_core_dev *dev, struct mlx5_core_dct *dct);
 
 static inline const char *mlx5_qp_type_str(int type)
 {
@@ -595,4 +618,16 @@ static inline const char *mlx5_qp_state_str(int state)
 	}
 }
 
+static inline const char *mlx5_dct_state_str(int state)
+{
+	switch (state) {
+	case MLX5_DCT_STATE_ACTIVE:
+		return "ACTIVE";
+	case MLX5_DCT_STATE_DRAINING:
+		return "DRAINING";
+	case MLX5_DCT_STATE_DRAINED:
+		return "DRAINED";
+	default: return "Invalid DCT state";
+	}
+}
 #endif /* MLX5_QP_H */
Signature · 6 lines
2.1.2

--
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
author
#9 lore raw

PATCH 4/5 mlx5_ib: Add support for DC

In reply to a message not in the archive
---
 drivers/infiniband/hw/mlx5/main.c    |  19 +++
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  24 +++
 drivers/infiniband/hw/mlx5/qp.c      | 289 ++++++++++++++++++++++++++++++++++-
 drivers/infiniband/hw/mlx5/user.h    |  41 +++++
 4 files changed, 370 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx5/main.c +19 -0
index 3c6fa99c4256..c805385d878d 100644
@@ -283,6 +283,11 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
 	props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
 					   props->max_mcast_grp;
 	props->max_map_per_fmr = INT_MAX; /* no limit in ConnectIB */
+	if (gen->flags & MLX5_DEV_CAP_FLAG_DCT) {
+		props->device_cap_flags |= IB_DEVICE_DC_TRANSPORT;
+		props->dc_rd_req = 1 << gen->log_max_ra_req_dc;
+		props->dc_rd_res = 1 << gen->log_max_ra_res_dc;
+	}
 
 out:
 	kfree(in_mad);
@@ -1405,6 +1410,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 	dev->ib_dev.alloc_fast_reg_page_list = mlx5_ib_alloc_fast_reg_page_list;
 	dev->ib_dev.free_fast_reg_page_list  = mlx5_ib_free_fast_reg_page_list;
 	dev->ib_dev.check_mr_status	= mlx5_ib_check_mr_status;
+	dev->ib_dev.uverbs_ex_cmd_mask	|=
+		(1ull << IB_USER_VERBS_EX_CMD_MODIFY_QP);
 
 	if (mdev->caps.gen.flags & MLX5_DEV_CAP_FLAG_XRC) {
 		dev->ib_dev.alloc_xrcd = mlx5_ib_alloc_xrcd;
@@ -1417,6 +1424,18 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 	dev->ib_dev.uverbs_ex_cmd_mask  |=
 		(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
 
+	if (mdev->caps.gen.flags & MLX5_DEV_CAP_FLAG_DCT) {
+		dev->ib_dev.create_dct = mlx5_ib_create_dct;
+		dev->ib_dev.destroy_dct = mlx5_ib_destroy_dct;
+		dev->ib_dev.query_dct = mlx5_ib_query_dct;
+		dev->ib_dev.arm_dct = mlx5_ib_arm_dct;
+		dev->ib_dev.uverbs_ex_cmd_mask |=
+			(1ull << IB_USER_VERBS_EX_CMD_CREATE_DCT)	|
+			(1ull << IB_USER_VERBS_EX_CMD_DESTROY_DCT)	|
+			(1ull << IB_USER_VERBS_EX_CMD_QUERY_DCT)	|
+			(1ull << IB_USER_VERBS_EX_CMD_ARM_DCT);
+	}
+
 	err = init_node_data(dev);
 	if (err)
 		goto err_eqs;
drivers/infiniband/hw/mlx5/mlx5_ib.h +24 -0
index 386780f0d1e1..5a78f2c60867 100644
@@ -194,6 +194,11 @@ struct mlx5_ib_qp {
 	bool			signature_en;
 };
 
+struct mlx5_ib_dct {
+	struct ib_dct		ibdct;
+	struct mlx5_core_dct	mdct;
+};
+
 struct mlx5_ib_cq_buf {
 	struct mlx5_buf		buf;
 	struct ib_umem		*umem;
@@ -444,6 +449,16 @@ static inline struct mlx5_ib_fast_reg_page_list *to_mfrpl(struct ib_fast_reg_pag
 	return container_of(ibfrpl, struct mlx5_ib_fast_reg_page_list, ibfrpl);
 }
 
+static inline struct mlx5_ib_dct *to_mibdct(struct mlx5_core_dct *mdct)
+{
+	return container_of(mdct, struct mlx5_ib_dct, mdct);
+}
+
+static inline struct mlx5_ib_dct *to_mdct(struct ib_dct *ibdct)
+{
+	return container_of(ibdct, struct mlx5_ib_dct, ibdct);
+}
+
 struct mlx5_ib_ah {
 	struct ib_ah		ibah;
 	struct mlx5_av		av;
@@ -482,6 +497,8 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd,
 				struct ib_udata *udata);
 int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 		      int attr_mask, struct ib_udata *udata);
+int mlx5_ib_modify_qp_ex(struct ib_qp *ibqp, struct ib_qp_attr *attr,
+			 int attr_mask, struct ib_udata *udata);
 int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask,
 		     struct ib_qp_init_attr *qp_init_attr);
 int mlx5_ib_destroy_qp(struct ib_qp *qp);
@@ -524,6 +541,13 @@ struct ib_xrcd *mlx5_ib_alloc_xrcd(struct ib_device *ibdev,
 					  struct ib_ucontext *context,
 					  struct ib_udata *udata);
 int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd);
+struct ib_dct *mlx5_ib_create_dct(struct ib_pd *pd,
+				  struct ib_dct_init_attr *attr,
+				  struct ib_udata *uhw);
+int mlx5_ib_destroy_dct(struct ib_dct *dct, struct ib_udata *uhw);
+int mlx5_ib_query_dct(struct ib_dct *dct, struct ib_dct_attr *attr,
+		      struct ib_udata *uhw);
+int mlx5_ib_arm_dct(struct ib_dct *dct, struct ib_udata *uhw);
 int mlx5_vector2eqn(struct mlx5_ib_dev *dev, int vector, int *eqn, int *irqn);
 int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32 *offset);
 int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port);
drivers/infiniband/hw/mlx5/qp.c +286 -3

346 lines not on this page · raw message

drivers/infiniband/hw/mlx5/user.h +41 -0

45 lines not on this page · raw message

Signature · 6 lines
2.1.2

--
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
author
#10 lore raw

PATCH 5/5 mlx5_core: Update mlx5_command_str with DC commands

In reply to a message not in the archive

Add support for DC commands and make a few other minor fixes.

---
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +18 -3
index 368c6c5ea014..37786ea6ad6c 100644
@@ -289,10 +289,10 @@ const char *mlx5_command_str(int command)
 		return "TEARDOWN_HCA";
 
 	case MLX5_CMD_OP_ENABLE_HCA:
-		return "MLX5_CMD_OP_ENABLE_HCA";
+		return "ENABLE_HCA";
 
 	case MLX5_CMD_OP_DISABLE_HCA:
-		return "MLX5_CMD_OP_DISABLE_HCA";
+		return "DISABLE_HCA";
 
 	case MLX5_CMD_OP_QUERY_PAGES:
 		return "QUERY_PAGES";
@@ -390,6 +390,21 @@ const char *mlx5_command_str(int command)
 	case MLX5_CMD_OP_RESIZE_SRQ:
 		return "RESIZE_SRQ";
 
+	case MLX5_CMD_OP_CREATE_DCT:
+		return "CREATE_DCT";
+
+	case MLX5_CMD_OP_DESTROY_DCT:
+		return "DESTROY_DCT";
+
+	case MLX5_CMD_OP_DRAIN_DCT:
+		return "DRAIN_DCT";
+
+	case MLX5_CMD_OP_QUERY_DCT:
+		return "QUERY_DCT";
+
+	case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION:
+		return "ARM_DCT";
+
 	case MLX5_CMD_OP_ALLOC_PD:
 		return "ALLOC_PD";
 
@@ -415,7 +430,7 @@ const char *mlx5_command_str(int command)
 		return "DEALLOC_XRCD";
 
 	case MLX5_CMD_OP_ACCESS_REG:
-		return "MLX5_CMD_OP_ACCESS_REG";
+		return "ACCESS_REG";
 
 	default: return "unknown command opcode";
 	}
Signature · 6 lines
2.1.2

--
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
#4 lore raw

Re: [PATCH for-next 1/5] IB/core: Add DC transport support

In reply to a message not in the archive
Quoted 2 lines · Eli Cohen

ib_modify_qp_ex - is an extension to ib_modify_qp which allows to pass the 64 bit DC key.

we don't add new such kernel verb, probably just left over in the change-log from earlier internal version, right? --
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

author
#6 lore raw

Re: [PATCH for-next 1/5] IB/core: Add DC transport support

In reply to a message not in the archive
Quoted 6 lines · Or Gerlitz
Quoted 2 lines · Eli Cohen

ib_modify_qp_ex - is an extension to ib_modify_qp which allows to pass the 64 bit DC key.

we don't add new such kernel verb, probably just left over in the change-log from earlier internal version, right?

Right, but it is available for userspace through ib_uverbs_ex_modify_qp.
--
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