From 978ee4effa70fbdc5e66e1ac461277a036cfbc88 Mon Sep 17 00:00:00 2001 From: Yan Burman Date: Wed, 28 Jan 2015 12:15:46 +0000 Subject: [PATCH] isert: Micro-optimization of poll_cq WC loop Signed-off-by: Yan Burman git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@6000 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 bcafa771f..4ce204983 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);