diff mbox

[1/1] iw_cxgb4: Fix cxgb4 arm CQ logic to handle IB_CQ_REPORT_MISSED_EVENTS

Message ID 20160823145733.21093-1-bharat@chelsio.com (mailing list archive)
State Accepted
Headers show

Commit Message

Potnuri Bharat Teja Aug. 23, 2016, 2:57 p.m. UTC
Current cxgb4 arm CQ logic ignores IB_CQ_REPORT_MISSED_EVENTS for
request completion notification on a CQ. Due to this ib_poll_handler()
assumes all events polled and avoids further iopoll scheduling.

This patch adds logic to cxgb4 ib_req_notify_cq() handler to check if
CQ is not empty and return accordingly. Based on the return value of
ib_req_notify_cq() handler, ib_poll_handler() will schedule a run of
iopoll handler.

Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
---
 drivers/infiniband/hw/cxgb4/cq.c | 10 +++++-----
 drivers/infiniband/hw/cxgb4/t4.h |  5 +++++
 2 files changed, 10 insertions(+), 5 deletions(-)

Comments

Steve Wise Aug. 23, 2016, 3:55 p.m. UTC | #1
> Current cxgb4 arm CQ logic ignores IB_CQ_REPORT_MISSED_EVENTS for
> request completion notification on a CQ. Due to this ib_poll_handler()
> assumes all events polled and avoids further iopoll scheduling.
> 
> This patch adds logic to cxgb4 ib_req_notify_cq() handler to check if
> CQ is not empty and return accordingly. Based on the return value of
> ib_req_notify_cq() handler, ib_poll_handler() will schedule a run of
> iopoll handler.
> 
> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>

Looks good.   Doug, perhaps this can make 4.8-rc?

Reviewed-by: Steve Wise <swise@opengridcomputing.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Aug. 23, 2016, 4:44 p.m. UTC | #2
On 8/23/2016 11:55 AM, Steve Wise wrote:
>> Current cxgb4 arm CQ logic ignores IB_CQ_REPORT_MISSED_EVENTS for
>> request completion notification on a CQ. Due to this ib_poll_handler()
>> assumes all events polled and avoids further iopoll scheduling.
>>
>> This patch adds logic to cxgb4 ib_req_notify_cq() handler to check if
>> CQ is not empty and return accordingly. Based on the return value of
>> ib_req_notify_cq() handler, ib_poll_handler() will schedule a run of
>> iopoll handler.
>>
>> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> 
> Looks good.   Doug, perhaps this can make 4.8-rc?
> 
> Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> 
> 

Yep, applied.  Thanks.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index 812ab7278b8e..ac926c942fee 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -1016,15 +1016,15 @@  int c4iw_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata)
 int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
 {
 	struct c4iw_cq *chp;
-	int ret;
+	int ret = 0;
 	unsigned long flag;
 
 	chp = to_c4iw_cq(ibcq);
 	spin_lock_irqsave(&chp->lock, flag);
-	ret = t4_arm_cq(&chp->cq,
-			(flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED);
+	t4_arm_cq(&chp->cq,
+		  (flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED);
+	if (flags & IB_CQ_REPORT_MISSED_EVENTS)
+		ret = t4_cq_notempty(&chp->cq);
 	spin_unlock_irqrestore(&chp->lock, flag);
-	if (ret && !(flags & IB_CQ_REPORT_MISSED_EVENTS))
-		ret = 0;
 	return ret;
 }
diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h
index 6126bbe36095..02173f4315fa 100644
--- a/drivers/infiniband/hw/cxgb4/t4.h
+++ b/drivers/infiniband/hw/cxgb4/t4.h
@@ -634,6 +634,11 @@  static inline int t4_valid_cqe(struct t4_cq *cq, struct t4_cqe *cqe)
 	return (CQE_GENBIT(cqe) == cq->gen);
 }
 
+static inline int t4_cq_notempty(struct t4_cq *cq)
+{
+	return cq->sw_in_use || t4_valid_cqe(cq, &cq->queue[cq->cidx]);
+}
+
 static inline int t4_next_hw_cqe(struct t4_cq *cq, struct t4_cqe **cqe)
 {
 	int ret;