Skip to contentSkip to conversation

RDMA/mana_ib

PATCH Superseded [email protected] 4 participants 13 messages Sep 7, 2023 – Oct 18, 2023

Subsystems (5)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v5 cover RDMA/mana_ib

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that
created the qp. Add lookup table for qp.

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to mib_dev RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-----
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)
Signature · 1 line
2.25.1
#3 lore raw

PATCH v5 3/5 RDMA/mana_ib : Create adapter and Add error eq

From: Ajay Sharma <[email protected]>

Create adapter object as nice container for VF resources. Add error eq needed for adapter creation and later used for notification from Management SW. The management software uses this channel to send messages or error notifications back to the Client.

---
 drivers/infiniband/hw/mana/device.c           |  22 ++-
 drivers/infiniband/hw/mana/main.c             |  97 ++++++++++++
 drivers/infiniband/hw/mana/mana_ib.h          |  33 ++++
 .../net/ethernet/microsoft/mana/gdma_main.c   | 147 ++++++++++--------
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  13 +-
 6 files changed, 245 insertions(+), 70 deletions(-)
drivers/infiniband/hw/mana/device.c +20 -2
index ea4c8c8fc10d..4077e440657a 100644
@@ -68,7 +68,7 @@ static int mana_ib_probe(struct auxiliary_device *adev,
 	ibdev_dbg(&mib_dev->ib_dev, "mdev=%p id=%d num_ports=%d\n", mdev,
 		  mdev->dev_id.as_uint32, mib_dev->ib_dev.phys_port_cnt);
 
-	mib_dev->gdma_dev = mdev;
+	mib_dev->gc = mdev->gdma_context;
 	mib_dev->ib_dev.node_type = RDMA_NODE_IB_CA;
 
 	/*
@@ -85,15 +85,31 @@ static int mana_ib_probe(struct auxiliary_device *adev,
 		goto free_ib_device;
 	}
 
+	ret = mana_ib_create_error_eq(mib_dev);
+	if (ret) {
+		ibdev_err(&mib_dev->ib_dev, "Failed to allocate err eq");
+		goto deregister_device;
+	}
+
+	ret = mana_ib_create_adapter(mib_dev);
+	if (ret) {
+		ibdev_err(&mib_dev->ib_dev, "Failed to create adapter");
+		goto free_error_eq;
+	}
+
 	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
 				 mdev->gdma_context->dev);
 	if (ret)
-		goto deregister_device;
+		goto destroy_adapter;
 
 	dev_set_drvdata(&adev->dev, mib_dev);
 
 	return 0;
 
+destroy_adapter:
+	mana_ib_destroy_adapter(mib_dev);
+free_error_eq:
+	mana_gd_destroy_queue(mib_dev->gc, mib_dev->fatal_err_eq);
 deregister_device:
 	mana_gd_deregister_device(&mib_dev->gc->mana_ib);
 free_ib_device:
@@ -105,6 +121,8 @@ static void mana_ib_remove(struct auxiliary_device *adev)
 {
 	struct mana_ib_dev *mib_dev = dev_get_drvdata(&adev->dev);
 
+	mana_gd_destroy_queue(mib_dev->gc, mib_dev->fatal_err_eq);
+	mana_ib_destroy_adapter(mib_dev);
 	mana_gd_deregister_device(&mib_dev->gc->mana_ib);
 	ib_unregister_device(&mib_dev->ib_dev);
 	ib_dealloc_device(&mib_dev->ib_dev);
drivers/infiniband/hw/mana/main.c +97 -0

100 lines not on this page · raw message

drivers/infiniband/hw/mana/mana_ib.h +33 -0
index 3a2ba6b96f15..8a652bccd978 100644
@@ -31,6 +31,8 @@ struct mana_ib_dev {
 	struct ib_device ib_dev;
 	struct gdma_dev *gdma_dev;
 	struct gdma_context *gc;
+	struct gdma_queue *fatal_err_eq;
+	mana_handle_t adapter_handle;
 };
 
 struct mana_ib_wq {
@@ -93,6 +95,31 @@ struct mana_ib_rwq_ind_table {
 	struct ib_rwq_ind_table ib_ind_table;
 };
 
+enum mana_ib_command_code {
+	MANA_IB_CREATE_ADAPTER  = 0x30002,
+	MANA_IB_DESTROY_ADAPTER = 0x30003,
+};
+
+struct mana_ib_create_adapter_req {
+	struct gdma_req_hdr hdr;
+	u32 notify_eq_id;
+	u32 reserved;
+}; /*HW Data */
+
+struct mana_ib_create_adapter_resp {
+	struct gdma_resp_hdr hdr;
+	mana_handle_t adapter;
+}; /* HW Data */
+
+struct mana_ib_destroy_adapter_req {
+	struct gdma_req_hdr hdr;
+	mana_handle_t adapter;
+}; /*HW Data */
+
+struct mana_ib_destroy_adapter_resp {
+	struct gdma_resp_hdr hdr;
+}; /* HW Data */
+
 int mana_ib_gd_create_dma_region(struct mana_ib_dev *mib_dev,
 				 struct ib_umem *umem,
 				 mana_handle_t *gdma_region);
@@ -161,4 +188,10 @@ int mana_ib_query_gid(struct ib_device *ibdev, u32 port, int index,
 
 void mana_ib_disassociate_ucontext(struct ib_ucontext *ibcontext);
 
+int mana_ib_create_error_eq(struct mana_ib_dev *mib_dev);
+
+int mana_ib_create_adapter(struct mana_ib_dev *mib_dev);
+
+int mana_ib_destroy_adapter(struct mana_ib_dev *mib_dev);
+
 #endif
drivers/net/ethernet/microsoft/mana/gdma_main.c +81 -66

255 lines not on this page · raw message

drivers/net/ethernet/microsoft/mana/mana_en.c +3 -0
index a499e460594b..d2ba7de8b512 100644
@@ -1167,6 +1167,9 @@ static int mana_create_eq(struct mana_context *ac)
 	spec.eq.callback = NULL;
 	spec.eq.context = ac->eqs;
 	spec.eq.log2_throttle_limit = LOG2_EQ_THROTTLE;
+	spec.eq.msix_allocated = false;
+	spec.doorbell = gd->doorbell;
+	spec.pdid = gd->pdid;
 
 	for (i = 0; i < gc->max_num_queues; i++) {
 		err = mana_gd_create_mana_eq(gd, &spec, &ac->eqs[i].eq);
include/net/mana/gdma.h +11 -2
index e2b212dd722b..aee8e8fa1ea6 100644
@@ -57,6 +57,10 @@ enum gdma_eqe_type {
 	GDMA_EQE_HWC_INIT_EQ_ID_DB	= 129,
 	GDMA_EQE_HWC_INIT_DATA		= 130,
 	GDMA_EQE_HWC_INIT_DONE		= 131,
+
+	/* IB NiC  Events start at 176*/
+	GDMA_EQE_SOC_EVENT_NOTIFICATION = 176,
+	GDMA_EQE_SOC_EVENT_TEST,
 };
 
 enum {
@@ -291,6 +295,7 @@ struct gdma_queue {
 
 	u32 head;
 	u32 tail;
+	struct list_head entry;
 
 	/* Extra fields specific to EQ/CQ. */
 	union {
@@ -318,6 +323,8 @@ struct gdma_queue_spec {
 	enum gdma_queue_type type;
 	bool monitor_avl_buf;
 	unsigned int queue_size;
+	u32 doorbell;
+	u32 pdid;
 
 	/* Extra fields specific to EQ/CQ. */
 	union {
@@ -326,6 +333,8 @@ struct gdma_queue_spec {
 			void *context;
 
 			unsigned long log2_throttle_limit;
+			bool msix_allocated;
+			unsigned int msix_index;
 		} eq;
 
 		struct {
@@ -341,8 +350,8 @@ struct gdma_queue_spec {
 #define MANA_IRQ_NAME_SZ 32
 
 struct gdma_irq_context {
-	void (*handler)(void *arg);
-	void *arg;
+	void (*handler)(struct list_head *arg);
+	struct list_head eq_list;
 	char name[MANA_IRQ_NAME_SZ];
 };
 
Signature · 1 line
2.25.1
#4 lore raw

PATCH v5 4/5 RDMA/mana_ib : Query adapter capabilities

In reply to [email protected]

From: Ajay Sharma <[email protected]>

Query the adapter capabilities to expose to
other clients and VF. This checks against
the user supplied values and protects against
overflows.

---
 drivers/infiniband/hw/mana/device.c  |  4 ++
 drivers/infiniband/hw/mana/main.c    | 67 ++++++++++++++++++++++------
 drivers/infiniband/hw/mana/mana_ib.h | 53 +++++++++++++++++++++-
 3 files changed, 110 insertions(+), 14 deletions(-)
drivers/infiniband/hw/mana/device.c +4 -0
index 4077e440657a..e15da43c73a0 100644
@@ -97,6 +97,10 @@ static int mana_ib_probe(struct auxiliary_device *adev,
 		goto free_error_eq;
 	}
 
+	ret = mana_ib_query_adapter_caps(mib_dev);
+	if (ret)
+		ibdev_dbg(&mib_dev->ib_dev, "Failed to get caps, use defaults");
+
 	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
 				 mdev->gdma_context->dev);
 	if (ret)
drivers/infiniband/hw/mana/main.c +54 -13

77 lines not on this page · raw message

drivers/infiniband/hw/mana/mana_ib.h +52 -1

87 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

PATCH v5 5/5 RDMA/mana_ib : Send event to qp

In reply to [email protected]

From: Ajay Sharma <[email protected]>

Send the QP fatal error event to only the
context that created the qp.

---
 drivers/infiniband/hw/mana/device.c  |  9 +++++++++
 drivers/infiniband/hw/mana/main.c    |  9 ++++++---
 drivers/infiniband/hw/mana/mana_ib.h | 18 +++++++++---------
 drivers/infiniband/hw/mana/qp.c      |  2 ++
 4 files changed, 26 insertions(+), 12 deletions(-)
drivers/infiniband/hw/mana/device.c +9 -0
index e15da43c73a0..563b5a1e79d2 100644
@@ -101,6 +101,14 @@ static int mana_ib_probe(struct auxiliary_device *adev,
 	if (ret)
 		ibdev_dbg(&mib_dev->ib_dev, "Failed to get caps, use defaults");
 
+	mib_dev->rq_to_qp_lookup_table = kzalloc(sizeof(struct mana_ib_qp*) *
+					  mib_dev->adapter_caps.max_qp_count,
+					  GFP_KERNEL);
+	if (!mib_dev->rq_to_qp_lookup_table) {
+		ibdev_err(&mib_dev->ib_dev, "Failed to allocate rq lookup table");
+		goto free_error_eq;
+	}
+
 	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
 				 mdev->gdma_context->dev);
 	if (ret)
@@ -112,6 +120,7 @@ static int mana_ib_probe(struct auxiliary_device *adev,
 
 destroy_adapter:
 	mana_ib_destroy_adapter(mib_dev);
+	kfree(mib_dev->rq_to_qp_lookup_table);
 free_error_eq:
 	mana_gd_destroy_queue(mib_dev->gc, mib_dev->fatal_err_eq);
 deregister_device:
drivers/infiniband/hw/mana/main.c +6 -3
index 82923475267d..517a2a4f0d76 100644
@@ -556,13 +556,16 @@ static void mana_ib_critical_event_handler(void *ctx, struct gdma_queue *queue,
 {
 	struct mana_ib_dev *mib_dev = (struct mana_ib_dev *)ctx;
 	struct ib_event mib_event;
+	struct mana_ib_qp *qp;
+	u64 rq_id;
 	switch (event->type) {
 	case GDMA_EQE_SOC_EVENT_NOTIFICATION:
+		rq_id = event->details[0] & 0xFFFFFF;
+		qp = mib_dev->rq_to_qp_lookup_table[rq_id];
 		mib_event.event = IB_EVENT_QP_FATAL;
 		mib_event.device = &mib_dev->ib_dev;
-		mib_event.element.qp =
-				(struct ib_qp*)(event->details[0] & 0xFFFFFF);
-		ib_dispatch_event(&mib_event);
+		if (qp && qp->ibqp.event_handler)
+			qp->ibqp.event_handler(&mib_event, qp->ibqp.qp_context);
 		ibdev_dbg(&mib_dev->ib_dev, "Received critical notification");
 		break;
 	default:
drivers/infiniband/hw/mana/mana_ib.h +9 -9
index 6b9406738cb2..d796b0ed0288 100644
@@ -48,15 +48,6 @@ struct mana_ib_adapter_caps {
 	u32 max_inline_data_size;
 };
 
-struct mana_ib_dev {
-	struct ib_device ib_dev;
-	struct gdma_dev *gdma_dev;
-	struct gdma_context *gc;
-	struct gdma_queue *fatal_err_eq;
-	mana_handle_t adapter_handle;
-	struct mana_ib_adapter_caps adapter_caps;
-};
-
 struct mana_ib_wq {
 	struct ib_wq ibwq;
 	struct ib_umem *umem;
@@ -113,6 +104,15 @@ struct mana_ib_ucontext {
 	u32 doorbell;
 };
 
+struct mana_ib_dev {
+	struct ib_device ib_dev;
+	struct gdma_dev *gdma_dev;
+	struct gdma_context *gc;
+	struct gdma_queue *fatal_err_eq;
+	mana_handle_t adapter_handle;
+	struct mana_ib_adapter_caps adapter_caps;
+	struct mana_ib_qp **rq_to_qp_lookup_table;
+};
 struct mana_ib_rwq_ind_table {
 	struct ib_rwq_ind_table ib_ind_table;
 };
drivers/infiniband/hw/mana/qp.c +2 -0
index ef3275ac92a0..bad72c0e8265 100644
@@ -210,6 +210,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
 		wq->id = wq_spec.queue_index;
 		cq->id = cq_spec.queue_index;
 
+		mib_dev->rq_to_qp_lookup_table[wq->id] = qp;
+
 		ibdev_dbg(&mib_dev->ib_dev,
 			  "ret %d rx_object 0x%llx wq id %llu cq id %llu\n",
 			  ret, wq->rx_object, wq->id, cq->id);
Signature · 1 line
2.25.1
#2 lore raw

PATCH v5 2/5 RDMA/mana_ib : Register Mana IB device with Management SW

In reply to [email protected]

From: Ajay Sharma <[email protected]>

Each of the MANA infiniband devices must be registered with the management software to request services/resources. Register the Mana IB device with Management
which would later help get an adapter handle.

---
 drivers/infiniband/hw/mana/device.c           | 20 +++++--
 drivers/infiniband/hw/mana/main.c             | 58 ++++++-------------
 drivers/infiniband/hw/mana/mana_ib.h          |  1 +
 drivers/infiniband/hw/mana/mr.c               | 17 ++----
 drivers/infiniband/hw/mana/qp.c               |  8 +--
 .../net/ethernet/microsoft/mana/gdma_main.c   |  5 ++
 include/net/mana/gdma.h                       |  3 +
 7 files changed, 54 insertions(+), 58 deletions(-)
drivers/infiniband/hw/mana/device.c +16 -4
index 083f27246ba8..ea4c8c8fc10d 100644
@@ -78,22 +78,34 @@ static int mana_ib_probe(struct auxiliary_device *adev,
 	mib_dev->ib_dev.num_comp_vectors = 1;
 	mib_dev->ib_dev.dev.parent = mdev->gdma_context->dev;
 
-	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
-				 mdev->gdma_context->dev);
+	ret = mana_gd_register_device(&mib_dev->gc->mana_ib);
 	if (ret) {
-		ib_dealloc_device(&mib_dev->ib_dev);
-		return ret;
+		ibdev_err(&mib_dev->ib_dev, "Failed to register device, ret %d",
+			  ret);
+		goto free_ib_device;
 	}
 
+	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
+				 mdev->gdma_context->dev);
+	if (ret)
+		goto deregister_device;
+
 	dev_set_drvdata(&adev->dev, mib_dev);
 
 	return 0;
+
+deregister_device:
+	mana_gd_deregister_device(&mib_dev->gc->mana_ib);
+free_ib_device:
+	ib_dealloc_device(&mib_dev->ib_dev);
+	return ret;
 }
 
 static void mana_ib_remove(struct auxiliary_device *adev)
 {
 	struct mana_ib_dev *mib_dev = dev_get_drvdata(&adev->dev);
 
+	mana_gd_deregister_device(&mib_dev->gc->mana_ib);
 	ib_unregister_device(&mib_dev->ib_dev);
 	ib_dealloc_device(&mib_dev->ib_dev);
 }
drivers/infiniband/hw/mana/main.c +19 -39

201 lines not on this page · raw message

drivers/infiniband/hw/mana/mana_ib.h +1 -0
index ee4efd0af278..3a2ba6b96f15 100644
@@ -30,6 +30,7 @@
 struct mana_ib_dev {
 	struct ib_device ib_dev;
 	struct gdma_dev *gdma_dev;
+	struct gdma_context *gc;
 };
 
 struct mana_ib_wq {
drivers/infiniband/hw/mana/mr.c +6 -11
index f6a53906204d..3106d1bce837 100644
@@ -29,13 +29,10 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *mib_dev,
 				struct mana_ib_mr *mr,
 				struct gdma_create_mr_params *mr_params)
 {
-	struct gdma_dev *mdev = mib_dev->gdma_dev;
 	struct gdma_create_mr_response resp = {};
 	struct gdma_create_mr_request req = {};
-	struct gdma_context *gc;
 	int err;
 
-	gc = mdev->gdma_context;
 
 	mana_gd_init_req_hdr(&req.hdr, GDMA_CREATE_MR, sizeof(req),
 			     sizeof(resp));
@@ -56,7 +53,8 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *mib_dev,
 		return -EINVAL;
 	}
 
-	err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp);
+	err = mana_gd_send_request(mib_dev->gc, sizeof(req), &req,
+				   sizeof(resp), &resp);
 
 	if (err || resp.hdr.status) {
 		ibdev_dbg(&mib_dev->ib_dev, "Failed to create mr %d, %u", err,
@@ -77,22 +75,19 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *mib_dev,
 static int mana_ib_gd_destroy_mr(struct mana_ib_dev *mib_dev, u64 mr_handle)
 {
 	struct gdma_destroy_mr_response resp = {};
-	struct gdma_dev *mdev = mib_dev->gdma_dev;
 	struct gdma_destroy_mr_request req = {};
-	struct gdma_context *gc;
 	int err;
 
-	gc = mdev->gdma_context;
-
 	mana_gd_init_req_hdr(&req.hdr, GDMA_DESTROY_MR, sizeof(req),
 			     sizeof(resp));
 
 	req.mr_handle = mr_handle;
 
-	err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp);
+	err = mana_gd_send_request(mib_dev->gc, sizeof(req), &req,
+				   sizeof(resp), &resp);
 	if (err || resp.hdr.status) {
-		dev_err(gc->dev, "Failed to destroy MR: %d, 0x%x\n", err,
-			resp.hdr.status);
+		dev_err(mib_dev->gc->dev, "Failed to destroy MR: %d, 0x%x\n",
+			err, resp.hdr.status);
 		if (!err)
 			err = -EPROTO;
 		return err;
drivers/infiniband/hw/mana/qp.c +4 -4
index 3540bf5bb497..ef3275ac92a0 100644
@@ -21,7 +21,7 @@ static int mana_ib_cfg_vport_steering(struct mana_ib_dev *mib_dev,
 	u32 req_buf_size;
 	int i, err;
 
-	mdev = mib_dev->gdma_dev;
+	mdev = &mib_dev->gc->mana;
 	gc = mdev->gdma_context;
 
 	req_buf_size =
@@ -267,7 +267,7 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd,
 		rdma_udata_to_drv_context(udata, struct mana_ib_ucontext,
 					  ibucontext);
 	struct mana_ib_create_qp_resp resp = {};
-	struct gdma_dev *gd = mib_dev->gdma_dev;
+	struct gdma_dev *gd = &mib_dev->gc->mana;
 	struct mana_ib_create_qp ucmd = {};
 	struct mana_obj_spec wq_spec = {};
 	struct mana_obj_spec cq_spec = {};
@@ -437,7 +437,7 @@ static int mana_ib_destroy_qp_rss(struct mana_ib_qp *qp,
 {
 	struct mana_ib_dev *mib_dev =
 		container_of(qp->ibqp.device, struct mana_ib_dev, ib_dev);
-	struct gdma_dev *gd = mib_dev->gdma_dev;
+	struct gdma_dev *gd = &mib_dev->gc->mana;
 	struct mana_port_context *mpc;
 	struct mana_context *mc;
 	struct net_device *ndev;
@@ -464,7 +464,7 @@ static int mana_ib_destroy_qp_raw(struct mana_ib_qp *qp, struct ib_udata *udata)
 {
 	struct mana_ib_dev *mib_dev =
 		container_of(qp->ibqp.device, struct mana_ib_dev, ib_dev);
-	struct gdma_dev *gd = mib_dev->gdma_dev;
+	struct gdma_dev *gd = &mib_dev->gc->mana;
 	struct ib_pd *ibpd = qp->ibqp.pd;
 	struct mana_port_context *mpc;
 	struct mana_context *mc;
drivers/net/ethernet/microsoft/mana/gdma_main.c +5 -0
index 8f3f78b68592..9fa7a2d6c2b2 100644
@@ -139,6 +139,9 @@ static int mana_gd_detect_devices(struct pci_dev *pdev)
 		if (dev_type == GDMA_DEVICE_MANA) {
 			gc->mana.gdma_context = gc;
 			gc->mana.dev_id = dev;
+		} else if (dev_type == GDMA_DEVICE_MANA_IB) {
+			gc->mana_ib.dev_id = dev;
+			gc->mana_ib.gdma_context = gc;
 		}
 	}
 
@@ -940,6 +943,7 @@ int mana_gd_register_device(struct gdma_dev *gd)
 
 	return 0;
 }
+EXPORT_SYMBOL(mana_gd_register_device);
 
 int mana_gd_deregister_device(struct gdma_dev *gd)
 {
@@ -970,6 +974,7 @@ int mana_gd_deregister_device(struct gdma_dev *gd)
 
 	return err;
 }
+EXPORT_SYMBOL(mana_gd_deregister_device);
 
 u32 mana_gd_wq_avail_space(struct gdma_queue *wq)
 {
include/net/mana/gdma.h +3 -0
index 96c120160f15..e2b212dd722b 100644
@@ -63,6 +63,7 @@ enum {
 	GDMA_DEVICE_NONE	= 0,
 	GDMA_DEVICE_HWC		= 1,
 	GDMA_DEVICE_MANA	= 2,
+	GDMA_DEVICE_MANA_IB	= 3,
 };
 
 struct gdma_resource {
@@ -384,6 +385,8 @@ struct gdma_context {
 
 	/* Azure network adapter */
 	struct gdma_dev		mana;
+	/* rdma device */
+	struct gdma_dev		mana_ib;
 };
 
 #define MAX_NUM_GDMA_DEVICES	4
Signature · 1 line
2.25.1
#1 lore raw

PATCH v5 1/5 RDMA/mana_ib : Rename all mana_ib_dev type variables to mib_dev

In reply to [email protected]

From: Ajay Sharma <[email protected]>

This patch does not introduce any functional changes. It creates naming convention to distinguish especially when used in the same function.Renaming all mana_ib_dev type variables to mib_dev to have clean separation between eth dev and ibdev variables.

---
 drivers/infiniband/hw/mana/cq.c      | 12 ++--
 drivers/infiniband/hw/mana/device.c  | 34 +++++------
 drivers/infiniband/hw/mana/main.c    | 87 ++++++++++++++--------------
 drivers/infiniband/hw/mana/mana_ib.h |  9 +--
 drivers/infiniband/hw/mana/mr.c      | 29 +++++-----
 drivers/infiniband/hw/mana/qp.c      | 84 +++++++++++++--------------
 drivers/infiniband/hw/mana/wq.c      | 21 +++----
 7 files changed, 141 insertions(+), 135 deletions(-)
drivers/infiniband/hw/mana/cq.c +6 -6
index d141cab8a1e6..1aed4e6360ba 100644
@@ -11,10 +11,10 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 	struct mana_ib_cq *cq = container_of(ibcq, struct mana_ib_cq, ibcq);
 	struct ib_device *ibdev = ibcq->device;
 	struct mana_ib_create_cq ucmd = {};
-	struct mana_ib_dev *mdev;
+	struct mana_ib_dev *mib_dev;
 	int err;
 
-	mdev = container_of(ibdev, struct mana_ib_dev, ib_dev);
+	mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev);
 
 	if (udata->inlen < sizeof(ucmd))
 		return -EINVAL;
@@ -41,7 +41,7 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 		return err;
 	}
 
-	err = mana_ib_gd_create_dma_region(mdev, cq->umem, &cq->gdma_region);
+	err = mana_ib_gd_create_dma_region(mib_dev, cq->umem, &cq->gdma_region);
 	if (err) {
 		ibdev_dbg(ibdev,
 			  "Failed to create dma region for create cq, %d\n",
@@ -68,11 +68,11 @@ int mana_ib_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)
 {
 	struct mana_ib_cq *cq = container_of(ibcq, struct mana_ib_cq, ibcq);
 	struct ib_device *ibdev = ibcq->device;
-	struct mana_ib_dev *mdev;
+	struct mana_ib_dev *mib_dev;
 
-	mdev = container_of(ibdev, struct mana_ib_dev, ib_dev);
+	mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev);
 
-	mana_ib_gd_destroy_dma_region(mdev, cq->gdma_region);
+	mana_ib_gd_destroy_dma_region(mib_dev, cq->gdma_region);
 	ib_umem_release(cq->umem);
 
 	return 0;
drivers/infiniband/hw/mana/device.c +17 -17
index d4541b8707e4..083f27246ba8 100644
@@ -51,51 +51,51 @@ static int mana_ib_probe(struct auxiliary_device *adev,
 {
 	struct mana_adev *madev = container_of(adev, struct mana_adev, adev);
 	struct gdma_dev *mdev = madev->mdev;
+	struct mana_ib_dev *mib_dev;
 	struct mana_context *mc;
-	struct mana_ib_dev *dev;
 	int ret;
 
 	mc = mdev->driver_data;
 
-	dev = ib_alloc_device(mana_ib_dev, ib_dev);
-	if (!dev)
+	mib_dev = ib_alloc_device(mana_ib_dev, ib_dev);
+	if (!mib_dev)
 		return -ENOMEM;
 
-	ib_set_device_ops(&dev->ib_dev, &mana_ib_dev_ops);
+	ib_set_device_ops(&mib_dev->ib_dev, &mana_ib_dev_ops);
 
-	dev->ib_dev.phys_port_cnt = mc->num_ports;
+	mib_dev->ib_dev.phys_port_cnt = mc->num_ports;
 
-	ibdev_dbg(&dev->ib_dev, "mdev=%p id=%d num_ports=%d\n", mdev,
-		  mdev->dev_id.as_uint32, dev->ib_dev.phys_port_cnt);
+	ibdev_dbg(&mib_dev->ib_dev, "mdev=%p id=%d num_ports=%d\n", mdev,
+		  mdev->dev_id.as_uint32, mib_dev->ib_dev.phys_port_cnt);
 
-	dev->gdma_dev = mdev;
-	dev->ib_dev.node_type = RDMA_NODE_IB_CA;
+	mib_dev->gdma_dev = mdev;
+	mib_dev->ib_dev.node_type = RDMA_NODE_IB_CA;
 
 	/*
 	 * num_comp_vectors needs to set to the max MSIX index
 	 * when interrupts and event queues are implemented
 	 */
-	dev->ib_dev.num_comp_vectors = 1;
-	dev->ib_dev.dev.parent = mdev->gdma_context->dev;
+	mib_dev->ib_dev.num_comp_vectors = 1;
+	mib_dev->ib_dev.dev.parent = mdev->gdma_context->dev;
 
-	ret = ib_register_device(&dev->ib_dev, "mana_%d",
+	ret = ib_register_device(&mib_dev->ib_dev, "mana_%d",
 				 mdev->gdma_context->dev);
 	if (ret) {
-		ib_dealloc_device(&dev->ib_dev);
+		ib_dealloc_device(&mib_dev->ib_dev);
 		return ret;
 	}
 
-	dev_set_drvdata(&adev->dev, dev);
+	dev_set_drvdata(&adev->dev, mib_dev);
 
 	return 0;
 }
 
 static void mana_ib_remove(struct auxiliary_device *adev)
 {
-	struct mana_ib_dev *dev = dev_get_drvdata(&adev->dev);
+	struct mana_ib_dev *mib_dev = dev_get_drvdata(&adev->dev);
 
-	ib_unregister_device(&dev->ib_dev);
-	ib_dealloc_device(&dev->ib_dev);
+	ib_unregister_device(&mib_dev->ib_dev);
+	ib_dealloc_device(&mib_dev->ib_dev);
 }
 
 static const struct auxiliary_device_id mana_id_table[] = {
drivers/infiniband/hw/mana/main.c +45 -42

274 lines not on this page · raw message

drivers/infiniband/hw/mana/mana_ib.h +5 -4
index 502cc8672eef..ee4efd0af278 100644
@@ -92,10 +92,11 @@ struct mana_ib_rwq_ind_table {
 	struct ib_rwq_ind_table ib_ind_table;
 };
 
-int mana_ib_gd_create_dma_region(struct mana_ib_dev *dev, struct ib_umem *umem,
+int mana_ib_gd_create_dma_region(struct mana_ib_dev *mib_dev,
+				 struct ib_umem *umem,
 				 mana_handle_t *gdma_region);
 
-int mana_ib_gd_destroy_dma_region(struct mana_ib_dev *dev,
+int mana_ib_gd_destroy_dma_region(struct mana_ib_dev *mib_dev,
 				  mana_handle_t gdma_region);
 
 struct ib_wq *mana_ib_create_wq(struct ib_pd *pd,
@@ -129,9 +130,9 @@ int mana_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
 int mana_ib_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata);
 
-int mana_ib_cfg_vport(struct mana_ib_dev *dev, u32 port_id,
+int mana_ib_cfg_vport(struct mana_ib_dev *mib_dev, u32 port_id,
 		      struct mana_ib_pd *pd, u32 doorbell_id);
-void mana_ib_uncfg_vport(struct mana_ib_dev *dev, struct mana_ib_pd *pd,
+void mana_ib_uncfg_vport(struct mana_ib_dev *mib_dev, struct mana_ib_pd *pd,
 			 u32 port);
 
 int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
drivers/infiniband/hw/mana/mr.c +15 -14
index 351207c60eb6..f6a53906204d 100644
@@ -25,12 +25,13 @@ mana_ib_verbs_to_gdma_access_flags(int access_flags)
 	return flags;
 }
 
-static int mana_ib_gd_create_mr(struct mana_ib_dev *dev, struct mana_ib_mr *mr,
+static int mana_ib_gd_create_mr(struct mana_ib_dev *mib_dev,
+				struct mana_ib_mr *mr,
 				struct gdma_create_mr_params *mr_params)
 {
+	struct gdma_dev *mdev = mib_dev->gdma_dev;
 	struct gdma_create_mr_response resp = {};
 	struct gdma_create_mr_request req = {};
-	struct gdma_dev *mdev = dev->gdma_dev;
 	struct gdma_context *gc;
 	int err;
 
@@ -49,7 +50,7 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *dev, struct mana_ib_mr *mr,
 		break;
 
 	default:
-		ibdev_dbg(&dev->ib_dev,
+		ibdev_dbg(&mib_dev->ib_dev,
 			  "invalid param (GDMA_MR_TYPE) passed, type %d\n",
 			  req.mr_type);
 		return -EINVAL;
@@ -58,7 +59,7 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *dev, struct mana_ib_mr *mr,
 	err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp);
 
 	if (err || resp.hdr.status) {
-		ibdev_dbg(&dev->ib_dev, "Failed to create mr %d, %u", err,
+		ibdev_dbg(&mib_dev->ib_dev, "Failed to create mr %d, %u", err,
 			  resp.hdr.status);
 		if (!err)
 			err = -EPROTO;
@@ -73,11 +74,11 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *dev, struct mana_ib_mr *mr,
 	return 0;
 }
 
-static int mana_ib_gd_destroy_mr(struct mana_ib_dev *dev, u64 mr_handle)
+static int mana_ib_gd_destroy_mr(struct mana_ib_dev *mib_dev, u64 mr_handle)
 {
 	struct gdma_destroy_mr_response resp = {};
+	struct gdma_dev *mdev = mib_dev->gdma_dev;
 	struct gdma_destroy_mr_request req = {};
-	struct gdma_dev *mdev = dev->gdma_dev;
 	struct gdma_context *gc;
 	int err;
 
@@ -107,12 +108,12 @@ struct ib_mr *mana_ib_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 length,
 	struct mana_ib_pd *pd = container_of(ibpd, struct mana_ib_pd, ibpd);
 	struct gdma_create_mr_params mr_params = {};
 	struct ib_device *ibdev = ibpd->device;
-	struct mana_ib_dev *dev;
+	struct mana_ib_dev *mib_dev;
 	struct mana_ib_mr *mr;
 	u64 dma_region_handle;
 	int err;
 
-	dev = container_of(ibdev, struct mana_ib_dev, ib_dev);
+	mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev);
 
 	ibdev_dbg(ibdev,
 		  "start 0x%llx, iova 0x%llx length 0x%llx access_flags 0x%x",
@@ -133,7 +134,7 @@ struct ib_mr *mana_ib_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 length,
 		goto err_free;
 	}
 
-	err = mana_ib_gd_create_dma_region(dev, mr->umem, &dma_region_handle);
+	err = mana_ib_gd_create_dma_region(mib_dev, mr->umem, &dma_region_handle);
 	if (err) {
 		ibdev_dbg(ibdev, "Failed create dma region for user-mr, %d\n",
 			  err);
@@ -151,7 +152,7 @@ struct ib_mr *mana_ib_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 length,
 	mr_params.gva.access_flags =
 		mana_ib_verbs_to_gdma_access_flags(access_flags);
 
-	err = mana_ib_gd_create_mr(dev, mr, &mr_params);
+	err = mana_ib_gd_create_mr(mib_dev, mr, &mr_params);
 	if (err)
 		goto err_dma_region;
 
@@ -164,7 +165,7 @@ struct ib_mr *mana_ib_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 length,
 	return &mr->ibmr;
 
 err_dma_region:
-	mana_gd_destroy_dma_region(dev->gdma_dev->gdma_context,
+	mana_gd_destroy_dma_region(mib_dev->gdma_dev->gdma_context,
 				   dma_region_handle);
 
 err_umem:
@@ -179,12 +180,12 @@ int mana_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
 {
 	struct mana_ib_mr *mr = container_of(ibmr, struct mana_ib_mr, ibmr);
 	struct ib_device *ibdev = ibmr->device;
-	struct mana_ib_dev *dev;
+	struct mana_ib_dev *mib_dev;
 	int err;
 
-	dev = container_of(ibdev, struct mana_ib_dev, ib_dev);
+	mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev);
 
-	err = mana_ib_gd_destroy_mr(dev, mr->mr_handle);
+	err = mana_ib_gd_destroy_mr(mib_dev, mr->mr_handle);
 	if (err)
 		return err;
 
drivers/infiniband/hw/mana/qp.c +42 -42

305 lines not on this page · raw message

drivers/infiniband/hw/mana/wq.c +11 -10
index 372d361510e0..56bc2b8b6690 100644
@@ -9,7 +9,7 @@ struct ib_wq *mana_ib_create_wq(struct ib_pd *pd,
 				struct ib_wq_init_attr *init_attr,
 				struct ib_udata *udata)
 {
-	struct mana_ib_dev *mdev =
+	struct mana_ib_dev *mib_dev =
 		container_of(pd->device, struct mana_ib_dev, ib_dev);
 	struct mana_ib_create_wq ucmd = {};
 	struct mana_ib_wq *wq;
@@ -21,7 +21,7 @@ struct ib_wq *mana_ib_create_wq(struct ib_pd *pd,
 
 	err = ib_copy_from_udata(&ucmd, udata, min(sizeof(ucmd), udata->inlen));
 	if (err) {
-		ibdev_dbg(&mdev->ib_dev,
+		ibdev_dbg(&mib_dev->ib_dev,
 			  "Failed to copy from udata for create wq, %d\n", err);
 		return ERR_PTR(err);
 	}
@@ -30,13 +30,14 @@ struct ib_wq *mana_ib_create_wq(struct ib_pd *pd,
 	if (!wq)
 		return ERR_PTR(-ENOMEM);
 
-	ibdev_dbg(&mdev->ib_dev, "ucmd wq_buf_addr 0x%llx\n", ucmd.wq_buf_addr);
+	ibdev_dbg(&mib_dev->ib_dev, "ucmd wq_buf_addr 0x%llx\n",
+		  ucmd.wq_buf_addr);
 
 	umem = ib_umem_get(pd->device, ucmd.wq_buf_addr, ucmd.wq_buf_size,
 			   IB_ACCESS_LOCAL_WRITE);
 	if (IS_ERR(umem)) {
 		err = PTR_ERR(umem);
-		ibdev_dbg(&mdev->ib_dev,
+		ibdev_dbg(&mib_dev->ib_dev,
 			  "Failed to get umem for create wq, err %d\n", err);
 		goto err_free_wq;
 	}
@@ -46,15 +47,15 @@ struct ib_wq *mana_ib_create_wq(struct ib_pd *pd,
 	wq->wq_buf_size = ucmd.wq_buf_size;
 	wq->rx_object = INVALID_MANA_HANDLE;
 
-	err = mana_ib_gd_create_dma_region(mdev, wq->umem, &wq->gdma_region);
+	err = mana_ib_gd_create_dma_region(mib_dev, wq->umem, &wq->gdma_region);
 	if (err) {
-		ibdev_dbg(&mdev->ib_dev,
+		ibdev_dbg(&mib_dev->ib_dev,
 			  "Failed to create dma region for create wq, %d\n",
 			  err);
 		goto err_release_umem;
 	}
 
-	ibdev_dbg(&mdev->ib_dev,
+	ibdev_dbg(&mib_dev->ib_dev,
 		  "mana_ib_gd_create_dma_region ret %d gdma_region 0x%llx\n",
 		  err, wq->gdma_region);
 
@@ -82,11 +83,11 @@ int mana_ib_destroy_wq(struct ib_wq *ibwq, struct ib_udata *udata)
 {
 	struct mana_ib_wq *wq = container_of(ibwq, struct mana_ib_wq, ibwq);
 	struct ib_device *ib_dev = ibwq->device;
-	struct mana_ib_dev *mdev;
+	struct mana_ib_dev *mib_dev;
 
-	mdev = container_of(ib_dev, struct mana_ib_dev, ib_dev);
+	mib_dev = container_of(ib_dev, struct mana_ib_dev, ib_dev);
 
-	mana_ib_gd_destroy_dma_region(mdev, wq->gdma_region);
+	mana_ib_gd_destroy_dma_region(mib_dev, wq->gdma_region);
 	ib_umem_release(wq->umem);
 
 	kfree(wq);
Signature · 1 line
2.25.1
#6 lore raw
In reply to [email protected]
Quoted 6 lines · On Thu, Sep 07, 2023 at 09:52:34AM -0700, [email protected] wrote:

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that
created the qp. Add lookup table for qp.

Quoted 6 lines

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to mib_dev RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

I didn't look very deep into the series and has three very initial comments.
1. Please do git log drivers/infiniband/hw/mana/ and use same format for commit messages.
2. Don't invent your own index-to-qp query mechanism in last patch and use xarray.
3. Once you decided to export mana_gd_register_device, it hinted me that it is time to move to auxbus infrastructure.

Thanks

Quoted 16 lines
 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-----
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)
Signature · 1 line
2.25.1
#7 lore raw

I have updated the last patch to use xarray, will post the update patch. We currently use aux bus for ib device. Gd_register_device is firmware specific. All the patches use RDMA/mana_ib format which is aligned with drivers/infiniband/hw/mana/ .

Thanks

Quoted 53 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 11, 2023 7:33 AM
To: [email protected]
Cc: Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; Ajay Sharma <[email protected]>
Subject: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 6 lines · On Thu, Sep 07, 2023 at 09:52:34AM -0700, [email protected] wrote:

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that created the qp. Add lookup table for qp.

Quoted 6 lines

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to mib_dev RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

I didn't look very deep into the series and has three very initial comments.
1. Please do git log drivers/infiniband/hw/mana/ and use same format for commit messages.
2. Don't invent your own index-to-qp query mechanism in last patch and use xarray.
3. Once you decided to export mana_gd_register_device, it hinted me that it is time to move to auxbus infrastructure.

Thanks

Quoted 16 lines
 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-----
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)

--
2.25.1

#8 lore raw
Quoted 1 line · Ajay Sharma

I have updated the last patch to use xarray, will post the update patch. We currently use aux bus for ib device. Gd_register_device is firmware specific. All the patches use RDMA/mana_ib format which is aligned with drivers/infiniband/hw/mana/ .

➜ kernel git:(wip/leon-for-rc) git l --no-merges drivers/infiniband/hw/mana/
2145328515c8 RDMA/mana_ib: Use v2 version of cfg_rx_steer_req to enable RX coalescing 89d42b8c85b4 RDMA/mana_ib: Fix a bug when the PF indicates more entries for registering memory on first packet 563ca0e9eab8 RDMA/mana_ib: Prevent array underflow in mana_ib_create_qp_raw()
3574cfdca285 RDMA/mana: Remove redefinition of basic u64 type
0266a177631d RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

It is different format from presented here. You added extra space before ":" and there is double space in one of the titles.

Regarding aux, I see it, but what confuses me is proliferation of terms and various calls: device, client, adapter. My expectation is to see more uniform methodology where IB is represented as device.

Thanks

Quoted 56 lines

Thanks

Quoted 53 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 11, 2023 7:33 AM
To: [email protected]
Cc: Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; Ajay Sharma <[email protected]>
Subject: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 6 lines · On Thu, Sep 07, 2023 at 09:52:34AM -0700, [email protected] wrote:

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that created the qp. Add lookup table for qp.

Quoted 6 lines

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to mib_dev RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

I didn't look very deep into the series and has three very initial comments.
1. Please do git log drivers/infiniband/hw/mana/ and use same format for commit messages.
2. Don't invent your own index-to-qp query mechanism in last patch and use xarray.
3. Once you decided to export mana_gd_register_device, it hinted me that it is time to move to auxbus infrastructure.

Thanks

Quoted 16 lines
 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-----
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)

--
2.25.1

#9 lore raw

I have sent v7 patch series with the space removed

Quoted 29 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 18, 2023 1:29 AM
To: Ajay Sharma <[email protected]>
Cc: [email protected]; Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 1 line · Ajay Sharma

I have updated the last patch to use xarray, will post the update patch. We

currently use aux bus for ib device. Gd_register_device is firmware specific. All the patches use RDMA/mana_ib format which is aligned with drivers/infiniband/hw/mana/ .

➜ kernel git:(wip/leon-for-rc) git l --no-merges drivers/infiniband/hw/mana/ 2145328515c8 RDMA/mana_ib: Use v2 version of cfg_rx_steer_req to enable RX coalescing
89d42b8c85b4 RDMA/mana_ib: Fix a bug when the PF indicates more entries for registering memory on first packet
563ca0e9eab8 RDMA/mana_ib: Prevent array underflow in mana_ib_create_qp_raw()
3574cfdca285 RDMA/mana: Remove redefinition of basic u64 type 0266a177631d RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

Quoted 3 lines

It is different format from presented here. You added extra space before ":" and there is double space in one of the titles.

I have removed the space

Quoted 4 lines

Regarding aux, I see it, but what confuses me is proliferation of terms and various calls: device, client, adapter. My expectation is to see more uniform methodology where IB is represented as device.

The adapter is a software construct. It is used as a container for resources. Client is used to distinguish between eth and ib. Please note that these are terms used for different purposes on the management side.

Quoted 60 lines

Thanks

Quoted 58 lines

Thanks

Quoted 55 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 11, 2023 7:33 AM
To: [email protected]
Cc: Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; Ajay Sharma <[email protected]>
Subject: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 6 lines · On Thu, Sep 07, 2023 at 09:52:34AM -0700, [email protected] wrote:

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that created the qp. Add lookup table for qp.

Quoted 6 lines

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to mib_dev RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

I didn't look very deep into the series and has three very initial comments.
1. Please do git log drivers/infiniband/hw/mana/ and use same format for commit messages.
2. Don't invent your own index-to-qp query mechanism in last patch and use xarray.
3. Once you decided to export mana_gd_register_device, it hinted me that it is time to move to auxbus infrastructure.

Thanks

Quoted 16 lines
 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-----
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)

--
2.25.1

#10 lore raw
Quoted 36 lines · Ajay Sharma

I have sent v7 patch series with the space removed

Quoted 29 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 18, 2023 1:29 AM
To: Ajay Sharma <[email protected]>
Cc: [email protected]; Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 1 line · Ajay Sharma

I have updated the last patch to use xarray, will post the update patch. We

currently use aux bus for ib device. Gd_register_device is firmware specific. All the patches use RDMA/mana_ib format which is aligned with drivers/infiniband/hw/mana/ .

➜ kernel git:(wip/leon-for-rc) git l --no-merges drivers/infiniband/hw/mana/ 2145328515c8 RDMA/mana_ib: Use v2 version of cfg_rx_steer_req to enable RX coalescing
89d42b8c85b4 RDMA/mana_ib: Fix a bug when the PF indicates more entries for registering memory on first packet
563ca0e9eab8 RDMA/mana_ib: Prevent array underflow in mana_ib_create_qp_raw()
3574cfdca285 RDMA/mana: Remove redefinition of basic u64 type 0266a177631d RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

Quoted 3 lines

It is different format from presented here. You added extra space before ":" and there is double space in one of the titles.

I have removed the space

Quoted 7 lines
Quoted 4 lines

Regarding aux, I see it, but what confuses me is proliferation of terms and various calls: device, client, adapter. My expectation is to see more uniform methodology where IB is represented as device.

The adapter is a software construct. It is used as a container for resources. Client is used to distinguish between eth and ib.

Do you have multiple "adapters" in one ib/eth device? If yes, at least for IB, it will be very unexpected to see.

Why do you have client and device when they are basically the same objects?

Quoted 1 line

Please note that these are terms used for different purposes on the management side.

We are discussing RDMA side of this series.

Thanks

Quoted 61 lines
Quoted 61 lines

Thanks

Quoted 58 lines

Thanks

Quoted 55 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 11, 2023 7:33 AM
To: [email protected]
Cc: Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; Ajay Sharma <[email protected]>
Subject: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 6 lines · On Thu, Sep 07, 2023 at 09:52:34AM -0700, [email protected] wrote:

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that created the qp. Add lookup table for qp.

Quoted 6 lines

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to mib_dev RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

I didn't look very deep into the series and has three very initial comments.
1. Please do git log drivers/infiniband/hw/mana/ and use same format for commit messages.
2. Don't invent your own index-to-qp query mechanism in last patch and use xarray.
3. Once you decided to export mana_gd_register_device, it hinted me that it is time to move to auxbus infrastructure.

Thanks

Quoted 16 lines
 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-----
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)

--
2.25.1

#11 lore raw
Quoted 59 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Tuesday, October 17, 2023 12:48 AM
To: Ajay Sharma <[email protected]>
Cc: [email protected]; Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 44 lines · Ajay Sharma

I have sent v7 patch series with the space removed

Quoted 32 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 18, 2023 1:29 AM
To: Ajay Sharma <[email protected]>
Cc: [email protected]; Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]
Subject: Re: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

Quoted 2 lines · Ajay Sharma

I have updated the last patch to use xarray, will post the update patch. We

currently use aux bus for ib device. Gd_register_device is firmware specific. All the patches use RDMA/mana_ib format which is aligned with drivers/infiniband/hw/mana/ .

➜ kernel git:(wip/leon-for-rc) git l --no-merges drivers/infiniband/hw/mana/
2145328515c8 RDMA/mana_ib: Use v2 version of cfg_rx_steer_req to enable RX coalescing
89d42b8c85b4 RDMA/mana_ib: Fix a bug when the PF indicates more entries for registering memory on first packet 563ca0e9eab8 RDMA/mana_ib: Prevent array underflow in mana_ib_create_qp_raw()
3574cfdca285 RDMA/mana: Remove redefinition of basic u64 type 0266a177631d RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter

Quoted 3 lines

It is different format from presented here. You added extra space before ":" and there is double space in one of the titles.

I have removed the space

Quoted 4 lines

Regarding aux, I see it, but what confuses me is proliferation of terms and various calls: device, client, adapter. My expectation is to see more uniform methodology where IB is represented as device.

Quoted 6 lines
Quoted 2 lines

The adapter is a software construct. It is used as a container for resources. Client is used to distinguish between eth and ib.

Do you have multiple "adapters" in one ib/eth device? If yes, at least for IB, it will be very unexpected to see.

Adapter is IB specific and one per VF/pcie device. It's the handle that is passed between the management and VM for book keeping.

Quoted 2 lines

Why do you have client and device when they are basically the same objects?

I am not sure which ones you are referring to specifically , can you please elaborate?

Quoted 71 lines
Quoted 1 line

Please note that these are terms used for different purposes on the

management side.

We are discussing RDMA side of this series.

Thanks

Quoted 23 lines
Quoted 23 lines

Thanks

Quoted 20 lines

Thanks

Quoted 17 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 11, 2023 7:33 AM
To: [email protected]
Cc: Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; Ajay Sharma <[email protected]>
Subject: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

On Thu, Sep 07, 2023 at 09:52:34AM -0700,
[email protected]
wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that created the qp. Add lookup table for qp.

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to

mib_dev

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

I didn't look very deep into the series and has three very initial

comments.

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines

1. Please do git log drivers/infiniband/hw/mana/ and use same format for commit messages.
2. Don't invent your own index-to-qp query mechanism in last patch and use xarray.
3. Once you decided to export mana_gd_register_device, it hinted me that it is time to move to auxbus infrastructure.

Thanks

Quoted 16 lines
 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-----
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)

--
2.25.1

#12 lore raw
Quoted 5 lines
Quoted 3 lines

Do you have multiple "adapters" in one ib/eth device? If yes, at least for IB, it will be very unexpected to see.

Adapter is IB specific and one per VF/pcie device. It's the handle that is passed between the management and VM for book keeping.

I think there are some confusions on the device.

There is one device, that supports both Ethernet and RDMA(through RoCE).

On the device, RoCE can't function without Ethernet. In the Linux, the RDMA device is modeled as auxiliary device to ethernet device.

The physical device exposes both Ethernet and RDMA management interfaces (as adapters) to the client (Linux kernel). When the MANA RDMA driver was first introduced, RAW QP was supported. There was no need to connect to the RDMA management interface. Many device hardware RDMA capabilities were hardcoded in the driver at the time. (There were some reviewers questioning this at the time).

With this patchset, we are connecting to the RDMA management interface on the device. This is for addressing the prior comments, and for supporting upcoming RC QP.

Thanks,

Long

Quoted 79 lines
Quoted 1 line

Why do you have client and device when they are basically the same

objects?

Quoted 1 line

I am not sure which ones you are referring to specifically , can you please elaborate?

Quoted 39 lines
Quoted 1 line

Please note that these are terms used for different purposes on the

management side.

We are discussing RDMA side of this series.

Thanks

Quoted 23 lines
Quoted 23 lines

Thanks

Quoted 20 lines

Thanks

Quoted 17 lines

-----Original Message-----
From: Leon Romanovsky <[email protected]>
Sent: Monday, September 11, 2023 7:33 AM
To: [email protected]
Cc: Long Li <[email protected]>; Jason Gunthorpe <[email protected]>; Dexuan Cui <[email protected]>; Wei Liu <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; linux- [email protected]; [email protected]; [email protected]; [email protected]; Ajay Sharma <[email protected]>
Subject: [EXTERNAL] Re: [Patch v5 0/5] RDMA/mana_ib

On Thu, Sep 07, 2023 at 09:52:34AM -0700,
[email protected]
wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

From: Ajay Sharma <[email protected]>

Change from v4:
Send qp fatal error event to the context that created the qp. Add lookup table for qp.

Ajay Sharma (5):
RDMA/mana_ib : Rename all mana_ib_dev type variables to

mib_dev

Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

RDMA/mana_ib : Register Mana IB device with Management SW RDMA/mana_ib : Create adapter and Add error eq RDMA/mana_ib : Query adapter capabilities RDMA/mana_ib : Send event to qp

I didn't look very deep into the series and has three very initial

comments.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

1. Please do git log drivers/infiniband/hw/mana/ and use same format for commit messages.
2. Don't invent your own index-to-qp query mechanism in last patch and use xarray.
3. Once you decided to export mana_gd_register_device, it hinted me that it is time to move to auxbus infrastructure.

Thanks

Quoted 4 lines
 drivers/infiniband/hw/mana/cq.c               |  12 +-
 drivers/infiniband/hw/mana/device.c           |  81 +++--
 drivers/infiniband/hw/mana/main.c             | 288 +++++++++++++-

----

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
 drivers/infiniband/hw/mana/mana_ib.h          | 102 ++++++-
 drivers/infiniband/hw/mana/mr.c               |  42 ++-
 drivers/infiniband/hw/mana/qp.c               |  86 +++---
 drivers/infiniband/hw/mana/wq.c               |  21 +-
 .../net/ethernet/microsoft/mana/gdma_main.c   | 152 +++++----
 drivers/net/ethernet/microsoft/mana/mana_en.c |   3 +
 include/net/mana/gdma.h                       |  16 +-
 10 files changed, 545 insertions(+), 258 deletions(-)

--
2.25.1