aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2014-10-01 07:02:11 -0400
committerRoland Dreier <roland@purestorage.com>2014-10-09 03:06:07 -0400
commit6e6fe2fb1d61b4baef1cf350049c6877583681ee (patch)
tree67293f7bfbed569b1b5150f4a4b077c626804b1b /drivers/infiniband
parentff3dd52d267165347d6f92a90016e692d074a00c (diff)
IB/iser: Optimize completion polling
Poll in batch of 16. Since we don't want it on the stack, keep under iser completion context (iser_comp). Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h4
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c12
2 files changed, 11 insertions, 5 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index 4fcb25604d80..6c3743b6860e 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -145,6 +145,8 @@
145 ISER_MAX_TX_MISC_PDUS + \ 145 ISER_MAX_TX_MISC_PDUS + \
146 ISER_MAX_RX_MISC_PDUS) 146 ISER_MAX_RX_MISC_PDUS)
147 147
148#define ISER_WC_BATCH_COUNT 16
149
148#define ISER_VER 0x10 150#define ISER_VER 0x10
149#define ISER_WSV 0x08 151#define ISER_WSV 0x08
150#define ISER_RSV 0x04 152#define ISER_RSV 0x04
@@ -273,6 +275,7 @@ struct iscsi_iser_task;
273 * 275 *
274 * @device: pointer to device handle 276 * @device: pointer to device handle
275 * @cq: completion queue 277 * @cq: completion queue
278 * @wcs: work completion array
276 * @tasklet: Tasklet handle 279 * @tasklet: Tasklet handle
277 * @active_qps: Number of active QPs attached 280 * @active_qps: Number of active QPs attached
278 * to completion context 281 * to completion context
@@ -280,6 +283,7 @@ struct iscsi_iser_task;
280struct iser_comp { 283struct iser_comp {
281 struct iser_device *device; 284 struct iser_device *device;
282 struct ib_cq *cq; 285 struct ib_cq *cq;
286 struct ib_wc wcs[ISER_WC_BATCH_COUNT];
283 struct tasklet_struct tasklet; 287 struct tasklet_struct tasklet;
284 int active_qps; 288 int active_qps;
285}; 289};
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 805a9bdc9520..82bedbc260b2 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -1232,13 +1232,15 @@ static void iser_cq_tasklet_fn(unsigned long data)
1232{ 1232{
1233 struct iser_comp *comp = (struct iser_comp *)data; 1233 struct iser_comp *comp = (struct iser_comp *)data;
1234 struct ib_cq *cq = comp->cq; 1234 struct ib_cq *cq = comp->cq;
1235 struct ib_wc wc; 1235 struct ib_wc *const wcs = comp->wcs;
1236 int completed = 0; 1236 int i, n, completed = 0;
1237 1237
1238 while (ib_poll_cq(cq, 1, &wc) == 1) { 1238 while ((n = ib_poll_cq(cq, ARRAY_SIZE(comp->wcs), wcs)) > 0) {
1239 iser_handle_wc(&wc); 1239 for (i = 0; i < n; i++)
1240 iser_handle_wc(&wcs[i]);
1240 1241
1241 if (++completed >= iser_cq_poll_limit) 1242 completed += n;
1243 if (completed >= iser_cq_poll_limit)
1242 break; 1244 break;
1243 } 1245 }
1244 1246