diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-11-09 17:59:57 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-11-10 13:22:51 -0500 |
commit | ae57e24a4006fd46b73d842ee99db9580ef74a02 (patch) | |
tree | 17115437026be55dcd74641be21561fecf33dcdb /drivers/infiniband/hw/mthca/mthca_srq.c | |
parent | 64044bcf75063cb5a6d42712886a712449df2ce3 (diff) |
[IB] mthca: fix posting long lists of receive work requests
In Tavor mode, when posting a long list of receive work requests, a
doorbell must be rung every 256 requests. Add code to do this when
required.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_srq.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_srq.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 292f55be8cb..c3c0331a1f6 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -414,6 +414,7 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
414 | { | 414 | { |
415 | struct mthca_dev *dev = to_mdev(ibsrq->device); | 415 | struct mthca_dev *dev = to_mdev(ibsrq->device); |
416 | struct mthca_srq *srq = to_msrq(ibsrq); | 416 | struct mthca_srq *srq = to_msrq(ibsrq); |
417 | __be32 doorbell[2]; | ||
417 | unsigned long flags; | 418 | unsigned long flags; |
418 | int err = 0; | 419 | int err = 0; |
419 | int first_ind; | 420 | int first_ind; |
@@ -429,6 +430,25 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
429 | first_ind = srq->first_free; | 430 | first_ind = srq->first_free; |
430 | 431 | ||
431 | for (nreq = 0; wr; ++nreq, wr = wr->next) { | 432 | for (nreq = 0; wr; ++nreq, wr = wr->next) { |
433 | if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) { | ||
434 | nreq = 0; | ||
435 | |||
436 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | ||
437 | doorbell[1] = cpu_to_be32(srq->srqn << 8); | ||
438 | |||
439 | /* | ||
440 | * Make sure that descriptors are written | ||
441 | * before doorbell is rung. | ||
442 | */ | ||
443 | wmb(); | ||
444 | |||
445 | mthca_write64(doorbell, | ||
446 | dev->kar + MTHCA_RECEIVE_DOORBELL, | ||
447 | MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock)); | ||
448 | |||
449 | first_ind = srq->first_free; | ||
450 | } | ||
451 | |||
432 | ind = srq->first_free; | 452 | ind = srq->first_free; |
433 | 453 | ||
434 | if (ind < 0) { | 454 | if (ind < 0) { |
@@ -491,8 +511,6 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
491 | } | 511 | } |
492 | 512 | ||
493 | if (likely(nreq)) { | 513 | if (likely(nreq)) { |
494 | __be32 doorbell[2]; | ||
495 | |||
496 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); | 514 | doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift); |
497 | doorbell[1] = cpu_to_be32((srq->srqn << 8) | nreq); | 515 | doorbell[1] = cpu_to_be32((srq->srqn << 8) | nreq); |
498 | 516 | ||