diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx4/cq.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/cq.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 7950aa6e8184..7360bbafbe84 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -64,13 +64,7 @@ static void mlx4_ib_cq_event(struct mlx4_cq *cq, enum mlx4_event type) | |||
64 | 64 | ||
65 | static void *get_cqe_from_buf(struct mlx4_ib_cq_buf *buf, int n) | 65 | static void *get_cqe_from_buf(struct mlx4_ib_cq_buf *buf, int n) |
66 | { | 66 | { |
67 | int offset = n * sizeof (struct mlx4_cqe); | 67 | return mlx4_buf_offset(&buf->buf, n * sizeof (struct mlx4_cqe)); |
68 | |||
69 | if (buf->buf.nbufs == 1) | ||
70 | return buf->buf.u.direct.buf + offset; | ||
71 | else | ||
72 | return buf->buf.u.page_list[offset >> PAGE_SHIFT].buf + | ||
73 | (offset & (PAGE_SIZE - 1)); | ||
74 | } | 68 | } |
75 | 69 | ||
76 | static void *get_cqe(struct mlx4_ib_cq *cq, int n) | 70 | static void *get_cqe(struct mlx4_ib_cq *cq, int n) |
@@ -332,6 +326,12 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, | |||
332 | is_error = (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == | 326 | is_error = (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == |
333 | MLX4_CQE_OPCODE_ERROR; | 327 | MLX4_CQE_OPCODE_ERROR; |
334 | 328 | ||
329 | if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_OPCODE_NOP && | ||
330 | is_send)) { | ||
331 | printk(KERN_WARNING "Completion for NOP opcode detected!\n"); | ||
332 | return -EINVAL; | ||
333 | } | ||
334 | |||
335 | if (!*cur_qp || | 335 | if (!*cur_qp || |
336 | (be32_to_cpu(cqe->my_qpn) & 0xffffff) != (*cur_qp)->mqp.qpn) { | 336 | (be32_to_cpu(cqe->my_qpn) & 0xffffff) != (*cur_qp)->mqp.qpn) { |
337 | /* | 337 | /* |
@@ -354,8 +354,10 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, | |||
354 | 354 | ||
355 | if (is_send) { | 355 | if (is_send) { |
356 | wq = &(*cur_qp)->sq; | 356 | wq = &(*cur_qp)->sq; |
357 | wqe_ctr = be16_to_cpu(cqe->wqe_index); | 357 | if (!(*cur_qp)->sq_signal_bits) { |
358 | wq->tail += (u16) (wqe_ctr - (u16) wq->tail); | 358 | wqe_ctr = be16_to_cpu(cqe->wqe_index); |
359 | wq->tail += (u16) (wqe_ctr - (u16) wq->tail); | ||
360 | } | ||
359 | wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)]; | 361 | wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)]; |
360 | ++wq->tail; | 362 | ++wq->tail; |
361 | } else if ((*cur_qp)->ibqp.srq) { | 363 | } else if ((*cur_qp)->ibqp.srq) { |