diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2017-03-16 18:57:00 +0200 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-03-24 22:19:48 -0400 |
commit | fedd9e1f75828992ace5833379116f38c66ad7bb (patch) | |
tree | 607abbff46baa43b4abdf61936a2761eb4f86342 /drivers/infiniband | |
parent | 9fcd67d1772c43d2f23e8fca56acc7219e991676 (diff) |
IB/cq: Don't process more than the given budget
The caller might not want this overhead.
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/cq.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c index 2746d2eb3d52..f2ae75fa3128 100644 --- a/drivers/infiniband/core/cq.c +++ b/drivers/infiniband/core/cq.c @@ -29,7 +29,13 @@ static int __ib_process_cq(struct ib_cq *cq, int budget) { int i, n, completed = 0; - while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) { + /* + * budget might be (-1) if the caller does not + * want to bound this call, thus we need unsigned + * minimum here. + */ + while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH, + budget - completed), cq->wc)) > 0) { for (i = 0; i < n; i++) { struct ib_wc *wc = &cq->wc[i]; |