]> git.openfabrics.org - ~shefty/libmlx4.git/commitdiff
Fix handling of wq->tail for send completions
authorEli Cohen <eli@mellanox.co.il>
Mon, 11 Jun 2007 21:43:26 +0000 (14:43 -0700)
committerRoland Dreier <rolandd@cisco.com>
Mon, 11 Jun 2007 21:43:26 +0000 (14:43 -0700)
Cast the increment added to wq->tail when send completions are
processed to uint16_t to avoid using wrong values caused by standard
integer promotions.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
src/cq.c

index c4a3ca4bf19c6cd3d547517e87d40710427311d9..a1831ff9378db8d71b754fee3d0033952d335888 100644 (file)
--- a/src/cq.c
+++ b/src/cq.c
@@ -238,7 +238,7 @@ static int mlx4_poll_one(struct mlx4_cq *cq,
        if (is_send) {
                wq = &(*cur_qp)->sq;
                wqe_index = ntohs(cqe->wqe_index);
-               wq->tail += wqe_index - (uint16_t) wq->tail;
+               wq->tail += (uint16_t) (wqe_index - (uint16_t) wq->tail);
                wc->wr_id = wq->wrid[wq->tail & (wq->max - 1)];
                ++wq->tail;
        } else if ((*cur_qp)->ibv_qp.srq) {