Skip to contentSkip to conversation

RDMA/cxgb4: notify rdma stack for IB_EVENT_QP_LAST_WQE_REACHED event

PATCH Applied Anumula Murali Mohan Reddy 2 participants 4 messages Jan 7, 2025 – Jan 14, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 RDMA/cxgb4: notify rdma stack for IB_EVENT_QP_LAST_WQE_REACHED event

This patch sends IB_EVENT_QP_LAST_WQE_REACHED event on a QP that is in error state and associated with an SRQ. This behaviour is incorporated in flush_qp() which is called when QP transitions to error state. Supports SRQ drain functionality added by commit 844bc12e6da3 ("IB/core:
add support for draining Shared receive queues")

Fixes 844bc12e6da3 ("IB/core: add support for draining Shared receive queues")

---
Changes since v1:
Addressed previous review comments

---
 drivers/infiniband/hw/cxgb4/qp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/infiniband/hw/cxgb4/qp.c +9 -0
index 7b5c4522b426..10f61bc16dd5 100644
@@ -1599,6 +1599,7 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
 	int count;
 	int rq_flushed = 0, sq_flushed;
 	unsigned long flag;
+	struct ib_event ev;
 
 	pr_debug("qhp %p rchp %p schp %p\n", qhp, rchp, schp);
 
@@ -1607,6 +1608,14 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
 	if (schp != rchp)
 		spin_lock(&schp->lock);
 	spin_lock(&qhp->lock);
+	if (qhp->srq) {
+		if (qhp->attr.state == C4IW_QP_STATE_ERROR && qhp->ibqp.event_handler) {
+			ev.device = qhp->ibqp.device;
+			ev.element.qp = &qhp->ibqp;
+			ev.event = IB_EVENT_QP_LAST_WQE_REACHED;
+			qhp->ibqp.event_handler(&ev, qhp->ibqp.qp_context);
+		}
+	}
 
 	if (qhp->wq.flushed) {
 		spin_unlock(&qhp->lock);
Signature · 1 line
2.39.3
#1 lore raw
Quoted 6 lines · Anumula Murali Mohan Reddy

This patch sends IB_EVENT_QP_LAST_WQE_REACHED event on a QP that is in error state and associated with an SRQ. This behaviour is incorporated in flush_qp() which is called when QP transitions to error state. Supports SRQ drain functionality added by commit 844bc12e6da3 ("IB/core:
add support for draining Shared receive queues")

Quoted 6 lines
Fixes 844bc12e6da3 ("IB/core: add support for draining Shared receive queues")

---
Changes since v1:
Addressed previous review comments

There are two review comments. One is Fixes line, which is not a big deal as I can add it when applying patch, but what about second comment?

Why is this event limited to QP with SRQ only?
https://lore.kernel.org/all/20250105090622.GA5511@unreal/

Thanks

Quoted 35 lines
---
 drivers/infiniband/hw/cxgb4/qp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/infiniband/hw/cxgb4/qp.c +9 -0
index 7b5c4522b426..10f61bc16dd5 100644
@@ -1599,6 +1599,7 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
 	int count;
 	int rq_flushed = 0, sq_flushed;
 	unsigned long flag;
+	struct ib_event ev;
 
 	pr_debug("qhp %p rchp %p schp %p\n", qhp, rchp, schp);
 
@@ -1607,6 +1608,14 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
 	if (schp != rchp)
 		spin_lock(&schp->lock);
 	spin_lock(&qhp->lock);
+	if (qhp->srq) {
+		if (qhp->attr.state == C4IW_QP_STATE_ERROR && qhp->ibqp.event_handler) {
+			ev.device = qhp->ibqp.device;
+			ev.element.qp = &qhp->ibqp;
+			ev.event = IB_EVENT_QP_LAST_WQE_REACHED;
+			qhp->ibqp.event_handler(&ev, qhp->ibqp.qp_context);
+		}
+	}
 
 	if (qhp->wq.flushed) {
 		spin_unlock(&qhp->lock);
Signature · 1 line
2.39.3
#2 lore raw
Quoted 51 lines · Leon Romanovsky
Quoted 6 lines · Anumula Murali Mohan Reddy

This patch sends IB_EVENT_QP_LAST_WQE_REACHED event on a QP that is in error state and associated with an SRQ. This behaviour is incorporated in flush_qp() which is called when QP transitions to error state. Supports SRQ drain functionality added by commit 844bc12e6da3 ("IB/core:
add support for draining Shared receive queues")

Quoted 6 lines
Fixes 844bc12e6da3 ("IB/core: add support for draining Shared receive queues")

---
Changes since v1:
Addressed previous review comments

There are two review comments. One is Fixes line, which is not a big deal as I can add it when applying patch, but what about second comment?

Why is this event limited to QP with SRQ only?
https://lore.kernel.org/all/20250105090622.GA5511@unreal/

Thanks

Quoted 29 lines
---
 drivers/infiniband/hw/cxgb4/qp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/infiniband/hw/cxgb4/qp.c +9 -0
index 7b5c4522b426..10f61bc16dd5 100644
@@ -1599,6 +1599,7 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
 	int count;
 	int rq_flushed = 0, sq_flushed;
 	unsigned long flag;
+	struct ib_event ev;
 
 	pr_debug("qhp %p rchp %p schp %p\n", qhp, rchp, schp);
 
@@ -1607,6 +1608,14 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
 	if (schp != rchp)
 		spin_lock(&schp->lock);
 	spin_lock(&qhp->lock);
+	if (qhp->srq) {
+		if (qhp->attr.state == C4IW_QP_STATE_ERROR && qhp->ibqp.event_handler) {
+			ev.device = qhp->ibqp.device;
+			ev.element.qp = &qhp->ibqp;
+			ev.event = IB_EVENT_QP_LAST_WQE_REACHED;
+			qhp->ibqp.event_handler(&ev, qhp->ibqp.qp_context);
+		}
+	}
 
Quoted 6 lines
Quoted 6 lines
drivers/infiniband/hw/cxgb4/qp.c +0 -0
 	if (qhp->wq.flushed) {
 		spin_unlock(&qhp->lock);
Signature · 1 line
2.39.3

RDMA stack expects the IB_EVENT_QP_LAST_WQE_REACHED event only for SRQ , for non-SRQ it is handled via the drain cqe

Thanks,
Anumula Murali Mohan Reddy

#3 lore raw
In reply to Anumula Murali Mohan Reddy
Quoted 8 lines · Anumula Murali Mohan Reddy

This patch sends IB_EVENT_QP_LAST_WQE_REACHED event on a QP that is in error state and associated with an SRQ. This behaviour is incorporated in flush_qp() which is called when QP transitions to error state. Supports SRQ drain functionality added by commit 844bc12e6da3 ("IB/core:
add support for draining Shared receive queues")

[...]

Applied, thanks!

[1/1] RDMA/cxgb4: notify rdma stack for IB_EVENT_QP_LAST_WQE_REACHED event

      https://git.kernel.org/rdma/rdma/c/42e6ddda4c17fa

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>