net/mlx5: fix endianness in Tx completion queue
authorNélio Laranjeiro <nelio.laranjeiro@6wind.com>
Thu, 17 Nov 2016 09:49:55 +0000 (10:49 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:24:51 +0000 (19:24 +0100)
Completion queue entry data uses network endian, to access them we should
use ntoh*().

Fixes: c305090bbaf8 ("net/mlx5: replace countdown with threshold for Tx completions")

Reported-by: Liming Sun <lsun@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
drivers/net/mlx5/mlx5_rxtx.c

index b31b33b..2c5ca74 100644 (file)
@@ -199,7 +199,7 @@ txq_complete(struct txq *txq)
        } while (1);
        if (unlikely(cqe == NULL))
                return;
-       wqe = &(*txq->wqes)[htons(cqe->wqe_counter) &
+       wqe = &(*txq->wqes)[ntohs(cqe->wqe_counter) &
                            ((1 << txq->wqe_n) - 1)].hdr;
        elts_tail = wqe->ctrl[3];
        assert(elts_tail < (1 << txq->wqe_n));