diff options
author | Roland Dreier <rolandd@cisco.com> | 2005-09-13 13:41:03 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2005-09-19 01:02:37 -0400 |
commit | d6cff021e24515255b296d399ec517a68bf2ed08 (patch) | |
tree | f3d21aca027cb7065522629c00f65fc3a8fb1d96 /drivers/infiniband/hw/mthca/mthca_srq.c | |
parent | bb4a7f0da75ce9f3e933880428d39b2aa1f16961 (diff) |
[PATCH] IB/mthca: fix posting of first work request
Fix posting first WQE for mem-free HCAs: we need to link to previous
WQE even in that case. While we're at it, simplify code for
Tavor-mode HCAs. We don't really need the conditional test there
either; we can similarly always link to the previous WQE.
Based on Michael S. Tsirkin's analogous fix for userspace libmthca.
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 | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c index 75cd2d84ef12..fe06cc0df936 100644 --- a/drivers/infiniband/hw/mthca/mthca_srq.c +++ b/drivers/infiniband/hw/mthca/mthca_srq.c | |||
@@ -189,7 +189,6 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd, | |||
189 | 189 | ||
190 | srq->max = attr->max_wr; | 190 | srq->max = attr->max_wr; |
191 | srq->max_gs = attr->max_sge; | 191 | srq->max_gs = attr->max_sge; |
192 | srq->last = NULL; | ||
193 | srq->counter = 0; | 192 | srq->counter = 0; |
194 | 193 | ||
195 | if (mthca_is_memfree(dev)) | 194 | if (mthca_is_memfree(dev)) |
@@ -264,6 +263,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd, | |||
264 | 263 | ||
265 | srq->first_free = 0; | 264 | srq->first_free = 0; |
266 | srq->last_free = srq->max - 1; | 265 | srq->last_free = srq->max - 1; |
266 | srq->last = get_wqe(srq, srq->max - 1); | ||
267 | 267 | ||
268 | return 0; | 268 | return 0; |
269 | 269 | ||
@@ -446,13 +446,11 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
446 | ((struct mthca_data_seg *) wqe)->addr = 0; | 446 | ((struct mthca_data_seg *) wqe)->addr = 0; |
447 | } | 447 | } |
448 | 448 | ||
449 | if (likely(prev_wqe)) { | 449 | ((struct mthca_next_seg *) prev_wqe)->nda_op = |
450 | ((struct mthca_next_seg *) prev_wqe)->nda_op = | 450 | cpu_to_be32((ind << srq->wqe_shift) | 1); |
451 | cpu_to_be32((ind << srq->wqe_shift) | 1); | 451 | wmb(); |
452 | wmb(); | 452 | ((struct mthca_next_seg *) prev_wqe)->ee_nds = |
453 | ((struct mthca_next_seg *) prev_wqe)->ee_nds = | 453 | cpu_to_be32(MTHCA_NEXT_DBD); |
454 | cpu_to_be32(MTHCA_NEXT_DBD); | ||
455 | } | ||
456 | 454 | ||
457 | srq->wrid[ind] = wr->wr_id; | 455 | srq->wrid[ind] = wr->wr_id; |
458 | srq->first_free = next_ind; | 456 | srq->first_free = next_ind; |