net/mlx4: introducing consumer index mask
authorMoti Haimovsky <motih@mellanox.com>
Wed, 25 Oct 2017 15:37:26 +0000 (18:37 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 26 Oct 2017 23:05:55 +0000 (01:05 +0200)
This commit defines MLX4_CQ_DB_CI_MASK which is used when updating
the consumer index of the completion queue instead of the hardcoded
0xffffff used until now.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
drivers/net/mlx4/mlx4_prm.h
drivers/net/mlx4/mlx4_rxtx.c

index 3a77502..bd9a574 100644 (file)
@@ -93,6 +93,9 @@ struct mlx4_sq {
 
 #define mlx4_get_send_wqe(sq, n) ((sq)->buf + ((n) * (MLX4_TXBB_SIZE)))
 
+/* Completion queue consumer index mask. */
+#define MLX4_CQ_DB_CI_MASK 0xffffff
+
 /* Completion queue information. */
 struct mlx4_cq {
        uint8_t *buf; /**< Pointer to the completion queue buffer. */
index 36173ad..67dc712 100644 (file)
@@ -200,7 +200,7 @@ mlx4_txq_complete(struct txq *txq)
         * the ring consumer.
         */
        cq->cons_index = cons_index;
-       *cq->set_ci_db = rte_cpu_to_be_32(cq->cons_index & 0xffffff);
+       *cq->set_ci_db = rte_cpu_to_be_32(cq->cons_index & MLX4_CQ_DB_CI_MASK);
        rte_wmb();
        sq->tail = sq->tail + nr_txbbs;
        /* Update the list of packets posted for transmission. */
@@ -829,7 +829,8 @@ skip:
        rxq->rq_ci = rq_ci >> sges_n;
        rte_wmb();
        *rxq->rq_db = rte_cpu_to_be_32(rxq->rq_ci);
-       *rxq->mcq.set_ci_db = rte_cpu_to_be_32(rxq->mcq.cons_index & 0xffffff);
+       *rxq->mcq.set_ci_db =
+               rte_cpu_to_be_32(rxq->mcq.cons_index & MLX4_CQ_DB_CI_MASK);
        /* Increment packets counter. */
        rxq->stats.ipackets += i;
        return i;