aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/cq.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-20 18:39:24 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-20 18:39:24 -0400
commitb3f4256fe0682143883ce6903e4646a03943f792 (patch)
tree3f090af16d721dd3d088a96a6defb0637ae74f76 /drivers/infiniband/hw/mlx4/cq.c
parent044f620ac65d0d90727cdbd0c058e4d150d62ddc (diff)
parente61ef2416b0b92828512b6cfcd0104a02b6431fe (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: IB/mlx4: Make sure inline data segments don't cross a 64 byte boundary IB/mlx4: Handle FW command interface rev 3 IB/mlx4: Handle buffer wraparound in __mlx4_ib_cq_clean() IB/mlx4: Get rid of max_inline_data calculation IB/mlx4: Handle new FW requirement for send request prefetching IB/mlx4: Fix warning in rounding up queue sizes IB/mlx4: Fix handling of wq->tail for send completions
Diffstat (limited to 'drivers/infiniband/hw/mlx4/cq.c')
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index b2a290c6703a..660b27aecae5 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -354,8 +354,8 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
354 if (is_send) { 354 if (is_send) {
355 wq = &(*cur_qp)->sq; 355 wq = &(*cur_qp)->sq;
356 wqe_ctr = be16_to_cpu(cqe->wqe_index); 356 wqe_ctr = be16_to_cpu(cqe->wqe_index);
357 wq->tail += wqe_ctr - (u16) wq->tail; 357 wq->tail += (u16) (wqe_ctr - (u16) wq->tail);
358 wc->wr_id = wq->wrid[wq->tail & (wq->max - 1)]; 358 wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)];
359 ++wq->tail; 359 ++wq->tail;
360 } else if ((*cur_qp)->ibqp.srq) { 360 } else if ((*cur_qp)->ibqp.srq) {
361 srq = to_msrq((*cur_qp)->ibqp.srq); 361 srq = to_msrq((*cur_qp)->ibqp.srq);
@@ -364,7 +364,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
364 mlx4_ib_free_srq_wqe(srq, wqe_ctr); 364 mlx4_ib_free_srq_wqe(srq, wqe_ctr);
365 } else { 365 } else {
366 wq = &(*cur_qp)->rq; 366 wq = &(*cur_qp)->rq;
367 wc->wr_id = wq->wrid[wq->tail & (wq->max - 1)]; 367 wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)];
368 ++wq->tail; 368 ++wq->tail;
369 } 369 }
370 370
@@ -478,7 +478,8 @@ void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq)
478{ 478{
479 u32 prod_index; 479 u32 prod_index;
480 int nfreed = 0; 480 int nfreed = 0;
481 struct mlx4_cqe *cqe; 481 struct mlx4_cqe *cqe, *dest;
482 u8 owner_bit;
482 483
483 /* 484 /*
484 * First we need to find the current producer index, so we 485 * First we need to find the current producer index, so we
@@ -501,9 +502,13 @@ void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq)
501 if (srq && !(cqe->owner_sr_opcode & MLX4_CQE_IS_SEND_MASK)) 502 if (srq && !(cqe->owner_sr_opcode & MLX4_CQE_IS_SEND_MASK))
502 mlx4_ib_free_srq_wqe(srq, be16_to_cpu(cqe->wqe_index)); 503 mlx4_ib_free_srq_wqe(srq, be16_to_cpu(cqe->wqe_index));
503 ++nfreed; 504 ++nfreed;
504 } else if (nfreed) 505 } else if (nfreed) {
505 memcpy(get_cqe(cq, (prod_index + nfreed) & cq->ibcq.cqe), 506 dest = get_cqe(cq, (prod_index + nfreed) & cq->ibcq.cqe);
506 cqe, sizeof *cqe); 507 owner_bit = dest->owner_sr_opcode & MLX4_CQE_OWNER_MASK;
508 memcpy(dest, cqe, sizeof *cqe);
509 dest->owner_sr_opcode = owner_bit |
510 (dest->owner_sr_opcode & ~MLX4_CQE_OWNER_MASK);
511 }
507 } 512 }
508 513
509 if (nfreed) { 514 if (nfreed) {