All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next 0/3] Fixes to the mlx4 kernel XRC implementaion
@ 2013-04-10 14:26 Or Gerlitz
       [not found] ` <1365604008-22455-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2013-04-10 14:26 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A, sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	shlomop-VPRAkNaXOzVS1MOuV/RT9w, Or Gerlitz

From: Shlomo Pongratz <shlomop-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Hi Roland, Sean, everyone!

This patch series fixes the following two issues Shlomo stepped on
while experimenting with the kernel XRC code:

1. Calling an uninitalized XRC TGT QP event handler. QP envent handler 
is optional, the current code calls the event handelr for XRC TGT QP 
unconditionaly, fix that.

2. In the CQ polling code, when the QP is of type XRC TGT the srq field in the
QP has no meaning since an XRC TGT QP can redirect to more than one XRC SRQ. 
The XRC SRQ need to be retrived using the information form the XRCETH. 

Or.

Shlomo Pongratz (3):
  IB/core: Verify that QP handler is valid before dispatching events
  net/mlx4_core: Implement srq object lookup from srqn
  IB/mlx4: Fetch XRC SRQ in the CQ polling code

 drivers/infiniband/core/verbs.c          |    3 ++-
 drivers/infiniband/hw/mlx4/cq.c          |   21 +++++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx4/srq.c |   15 +++++++++++++++
 include/linux/mlx4/srq.h                 |    2 ++
 4 files changed, 40 insertions(+), 1 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH for-next 1/3] IB/core: Verify that QP handler is valid before dispatching events
       [not found] ` <1365604008-22455-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2013-04-10 14:26   ` Or Gerlitz
  2013-04-10 14:26   ` [PATCH for-next 2/3] net/mlx4_core: Implement srq object lookup from srqn Or Gerlitz
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Or Gerlitz @ 2013-04-10 14:26 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A, sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	shlomop-VPRAkNaXOzVS1MOuV/RT9w, Shlomo Pongratz, Or Gerlitz

From: Shlomo Pongratz <shlomop-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

For QPs of type IB_QPT_XRC_TGT the IB core assigns a common event handler
__ib_shared_qp_event_handler, and the optionally supplied event handler
is stored. When the common handler is called it iterates on all opened
QPs and calles the original handlers without checking if they are
NULL, fix that.

Signed-off-by: Shlomo Pongratz <shlomop-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/verbs.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index a8fdd33..22192de 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -348,7 +348,8 @@ static void __ib_shared_qp_event_handler(struct ib_event *event, void *context)
 	struct ib_qp *qp = context;
 
 	list_for_each_entry(event->element.qp, &qp->open_list, open_list)
-		event->element.qp->event_handler(event, event->element.qp->qp_context);
+		if (event->element.qp->event_handler)
+			event->element.qp->event_handler(event, event->element.qp->qp_context);
 }
 
 static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-next 2/3] net/mlx4_core: Implement srq object lookup from srqn
       [not found] ` <1365604008-22455-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2013-04-10 14:26   ` [PATCH for-next 1/3] IB/core: Verify that QP handler is valid before dispatching events Or Gerlitz
@ 2013-04-10 14:26   ` Or Gerlitz
  2013-04-10 14:26   ` [PATCH for-next 3/3] IB/mlx4: Fetch XRC SRQ in the CQ polling code Or Gerlitz
  2013-04-17  5:43   ` [PATCH for-next 0/3] Fixes to the mlx4 kernel XRC implementaion Roland Dreier
  3 siblings, 0 replies; 5+ messages in thread
From: Or Gerlitz @ 2013-04-10 14:26 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A, sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	shlomop-VPRAkNaXOzVS1MOuV/RT9w, Shlomo Pongratz, Or Gerlitz

From: Shlomo Pongratz <shlomop-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Expose a new API mlx4_srq_lookup to retrive a SRQ based on its number.
This API is needed in the mlx4_ib driver CQ polling logic, when a
work completion is associated with a XRC TGT QP. Since a target QP
may redirect to more than one XRC SRQ, the srq field in the QP has
no usage and the real XRC SRQ need to be retrived using the information
from the XRCETH IB header which is placed in the HW CQE.

Signed-off-by: Shlomo Pongratz <shlomop-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/net/ethernet/mellanox/mlx4/srq.c |   15 +++++++++++++++
 include/linux/mlx4/srq.h                 |    2 ++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
index e329fe1..79fd269 100644
--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
@@ -298,3 +298,18 @@ void mlx4_cleanup_srq_table(struct mlx4_dev *dev)
 		return;
 	mlx4_bitmap_cleanup(&mlx4_priv(dev)->srq_table.bitmap);
 }
+
+struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn)
+{
+	struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
+	struct mlx4_srq *srq;
+	unsigned long flags;
+
+	spin_lock_irqsave(&srq_table->lock, flags);
+	srq = radix_tree_lookup(&srq_table->tree,
+				srqn & (dev->caps.num_srqs - 1));
+	spin_unlock_irqrestore(&srq_table->lock, flags);
+
+	return srq;
+}
+EXPORT_SYMBOL_GPL(mlx4_srq_lookup);
diff --git a/include/linux/mlx4/srq.h b/include/linux/mlx4/srq.h
index 799a069..192e0f7 100644
--- a/include/linux/mlx4/srq.h
+++ b/include/linux/mlx4/srq.h
@@ -39,4 +39,6 @@ struct mlx4_wqe_srq_next_seg {
 	u32			reserved2[3];
 };
 
+struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn);
+
 #endif /* MLX4_SRQ_H */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-next 3/3] IB/mlx4: Fetch XRC SRQ in the CQ polling code
       [not found] ` <1365604008-22455-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2013-04-10 14:26   ` [PATCH for-next 1/3] IB/core: Verify that QP handler is valid before dispatching events Or Gerlitz
  2013-04-10 14:26   ` [PATCH for-next 2/3] net/mlx4_core: Implement srq object lookup from srqn Or Gerlitz
@ 2013-04-10 14:26   ` Or Gerlitz
  2013-04-17  5:43   ` [PATCH for-next 0/3] Fixes to the mlx4 kernel XRC implementaion Roland Dreier
  3 siblings, 0 replies; 5+ messages in thread
From: Or Gerlitz @ 2013-04-10 14:26 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A, sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	shlomop-VPRAkNaXOzVS1MOuV/RT9w, Shlomo Pongratz, Or Gerlitz

From: Shlomo Pongratz <shlomop-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

An XRC target QP may redirect to more than one XRC SRQ. This means
that for work completions associated with a XRC TGT QP, the srq field
in the QP has no usage and the real XRC SRQ need to be retrived using
the information from the XRCETH placed into the CQE, do that.

Signed-off-by: Shlomo Pongratz <shlomop-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx4/cq.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index ae67df3..dab4b51 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -33,6 +33,7 @@
 
 #include <linux/mlx4/cq.h>
 #include <linux/mlx4/qp.h>
+#include <linux/mlx4/srq.h>
 #include <linux/slab.h>
 
 #include "mlx4_ib.h"
@@ -585,6 +586,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
 	struct mlx4_qp *mqp;
 	struct mlx4_ib_wq *wq;
 	struct mlx4_ib_srq *srq;
+	struct mlx4_srq *msrq = NULL;
 	int is_send;
 	int is_error;
 	u32 g_mlpath_rqpn;
@@ -653,6 +655,20 @@ repoll:
 
 	wc->qp = &(*cur_qp)->ibqp;
 
+	if (wc->qp->qp_type == IB_QPT_XRC_TGT) {
+		u32 srq_num;
+		g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn);
+		srq_num       = g_mlpath_rqpn & 0xffffff;
+		/* SRQ is also in the radix tree */
+		msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev,
+				       srq_num);
+		if (unlikely(!msrq)) {
+			pr_warn("CQ %06x with entry for unknown SRQN %06x\n",
+				cq->mcq.cqn, srq_num);
+			return -EINVAL;
+		}
+	}
+
 	if (is_send) {
 		wq = &(*cur_qp)->sq;
 		if (!(*cur_qp)->sq_signal_bits) {
@@ -666,6 +682,11 @@ repoll:
 		wqe_ctr = be16_to_cpu(cqe->wqe_index);
 		wc->wr_id = srq->wrid[wqe_ctr];
 		mlx4_ib_free_srq_wqe(srq, wqe_ctr);
+	} else if (msrq) {
+		srq = to_mibsrq(msrq);
+		wqe_ctr = be16_to_cpu(cqe->wqe_index);
+		wc->wr_id = srq->wrid[wqe_ctr];
+		mlx4_ib_free_srq_wqe(srq, wqe_ctr);
 	} else {
 		wq	  = &(*cur_qp)->rq;
 		tail	  = wq->tail & (wq->wqe_cnt - 1);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH for-next 0/3] Fixes to the mlx4 kernel XRC implementaion
       [not found] ` <1365604008-22455-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2013-04-10 14:26   ` [PATCH for-next 3/3] IB/mlx4: Fetch XRC SRQ in the CQ polling code Or Gerlitz
@ 2013-04-17  5:43   ` Roland Dreier
  3 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2013-04-17  5:43 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: Sean Hefty, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	shlomop-VPRAkNaXOzVS1MOuV/RT9w

Thanks, applied all 3.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-17  5:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 14:26 [PATCH for-next 0/3] Fixes to the mlx4 kernel XRC implementaion Or Gerlitz
     [not found] ` <1365604008-22455-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2013-04-10 14:26   ` [PATCH for-next 1/3] IB/core: Verify that QP handler is valid before dispatching events Or Gerlitz
2013-04-10 14:26   ` [PATCH for-next 2/3] net/mlx4_core: Implement srq object lookup from srqn Or Gerlitz
2013-04-10 14:26   ` [PATCH for-next 3/3] IB/mlx4: Fetch XRC SRQ in the CQ polling code Or Gerlitz
2013-04-17  5:43   ` [PATCH for-next 0/3] Fixes to the mlx4 kernel XRC implementaion Roland Dreier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.