From 6440794f3dad8d6f54c65fd0c6e787c6a7d77226 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 11 Jun 2015 16:36:08 +0000 Subject: [PATCH] Merge r6000 from the iser branch git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@6269 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser_rdma.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 4fc3134f4..fcf237cd0 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -579,18 +579,19 @@ static void isert_handle_wc_error(struct ib_wc *wc) static int isert_poll_cq(struct isert_cq *cq) { - int err, i; + int err; + struct ib_wc *wc, *last_wc; TRACE_ENTRY(); do { err = ib_poll_cq(cq->cq, ARRAY_SIZE(cq->wc), cq->wc); - - for (i = 0; i < err; ++i) { - if (likely(cq->wc[i].status == IB_WC_SUCCESS)) - isert_handle_wc(&cq->wc[i]); + last_wc = &cq->wc[err]; + for (wc = cq->wc; wc < last_wc; ++wc) { + if (likely(wc->status == IB_WC_SUCCESS)) + isert_handle_wc(wc); else - isert_handle_wc_error(&cq->wc[i]); + isert_handle_wc_error(wc); } } while (err > 0);