Commit 6e6fe2fb authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Roland Dreier

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: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent ff3dd52d
...@@ -145,6 +145,8 @@ ...@@ -145,6 +145,8 @@
ISER_MAX_TX_MISC_PDUS + \ ISER_MAX_TX_MISC_PDUS + \
ISER_MAX_RX_MISC_PDUS) ISER_MAX_RX_MISC_PDUS)
#define ISER_WC_BATCH_COUNT 16
#define ISER_VER 0x10 #define ISER_VER 0x10
#define ISER_WSV 0x08 #define ISER_WSV 0x08
#define ISER_RSV 0x04 #define ISER_RSV 0x04
...@@ -273,6 +275,7 @@ struct iscsi_iser_task; ...@@ -273,6 +275,7 @@ struct iscsi_iser_task;
* *
* @device: pointer to device handle * @device: pointer to device handle
* @cq: completion queue * @cq: completion queue
* @wcs: work completion array
* @tasklet: Tasklet handle * @tasklet: Tasklet handle
* @active_qps: Number of active QPs attached * @active_qps: Number of active QPs attached
* to completion context * to completion context
...@@ -280,6 +283,7 @@ struct iscsi_iser_task; ...@@ -280,6 +283,7 @@ struct iscsi_iser_task;
struct iser_comp { struct iser_comp {
struct iser_device *device; struct iser_device *device;
struct ib_cq *cq; struct ib_cq *cq;
struct ib_wc wcs[ISER_WC_BATCH_COUNT];
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
int active_qps; int active_qps;
}; };
......
...@@ -1232,13 +1232,15 @@ static void iser_cq_tasklet_fn(unsigned long data) ...@@ -1232,13 +1232,15 @@ static void iser_cq_tasklet_fn(unsigned long data)
{ {
struct iser_comp *comp = (struct iser_comp *)data; struct iser_comp *comp = (struct iser_comp *)data;
struct ib_cq *cq = comp->cq; struct ib_cq *cq = comp->cq;
struct ib_wc wc; struct ib_wc *const wcs = comp->wcs;
int completed = 0; int i, n, completed = 0;
while (ib_poll_cq(cq, 1, &wc) == 1) { while ((n = ib_poll_cq(cq, ARRAY_SIZE(comp->wcs), wcs)) > 0) {
iser_handle_wc(&wc); for (i = 0; i < n; i++)
iser_handle_wc(&wcs[i]);
if (++completed >= iser_cq_poll_limit) completed += n;
if (completed >= iser_cq_poll_limit)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment