summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>2018-05-16 18:20:54 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-05-17 19:06:29 +0200
commit911bbb0f7cae2c182471bebb4d72895083ce9fb9 (patch)
tree20739d0db9377b9fd54d6f21d68517a5c94dc47b
parent607fc8e4a9900b027b65ec4ca6a50453cfdd5875 (diff)
downloaddpdk-911bbb0f7cae2c182471bebb4d72895083ce9fb9.zip
dpdk-911bbb0f7cae2c182471bebb4d72895083ce9fb9.tar.gz
dpdk-911bbb0f7cae2c182471bebb4d72895083ce9fb9.tar.xz
net/mlx4: fix shifts of signed values in Tx
This patch addresses the following issues reported by cppcheck: [drivers/net/mlx4/mlx4_rxtx.c:266]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour [drivers/net/mlx4/mlx4_rxtx.c:624]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour [drivers/net/mlx4/mlx4_txq.c:89]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour [drivers/net/mlx4/mlx4_txq.c:91]: (error) Shifting signed 32-bit value by 31 bits is undefined behaviour Fixes: 78e81a9844f8 ("net/mlx4: merge Tx queue rings management") Cc: stable@dpdk.org Reported-by: Ferruh Yigit <ferruh.yigit@intel.com> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
-rw-r--r--drivers/net/mlx4/mlx4_rxtx.c4
-rw-r--r--drivers/net/mlx4/mlx4_txq.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c
index 44efeb4..a92da66 100644
--- a/drivers/net/mlx4/mlx4_rxtx.c
+++ b/drivers/net/mlx4/mlx4_rxtx.c
@@ -263,7 +263,7 @@ mlx4_txq_stamp_freed_wqe(struct mlx4_sq *sq, volatile uint32_t *start,
} while (start != (volatile uint32_t *)sq->eob);
start = (volatile uint32_t *)sq->buf;
/* Flip invalid stamping ownership. */
- stamp ^= RTE_BE32(0x1 << MLX4_SQ_OWNER_BIT);
+ stamp ^= RTE_BE32(1u << MLX4_SQ_OWNER_BIT);
sq->stamp = stamp;
if (start == end)
return size;
@@ -621,7 +621,7 @@ mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
ctrl_next = (volatile struct mlx4_wqe_ctrl_seg *)
((volatile uint8_t *)ctrl_next - sq->size);
/* Flip HW valid ownership. */
- sq->owner_opcode ^= 0x1 << MLX4_SQ_OWNER_BIT;
+ sq->owner_opcode ^= 1u << MLX4_SQ_OWNER_BIT;
}
/*
* For raw Ethernet, the SOLICIT flag is used to indicate
diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c
index a358732..6edaadb 100644
--- a/drivers/net/mlx4/mlx4_txq.c
+++ b/drivers/net/mlx4/mlx4_txq.c
@@ -86,9 +86,9 @@ mlx4_txq_fill_dv_obj_info(struct txq *txq, struct mlx4dv_obj *mlxdv)
uint32_t headroom_size = 2048 + (1 << dqp->sq.wqe_shift);
/* Continuous headroom size bytes must always stay freed. */
sq->remain_size = sq->size - headroom_size;
- sq->owner_opcode = MLX4_OPCODE_SEND | (0 << MLX4_SQ_OWNER_BIT);
+ sq->owner_opcode = MLX4_OPCODE_SEND | (0u << MLX4_SQ_OWNER_BIT);
sq->stamp = rte_cpu_to_be_32(MLX4_SQ_STAMP_VAL |
- (0 << MLX4_SQ_OWNER_BIT));
+ (0u << MLX4_SQ_OWNER_BIT));
sq->db = dqp->sdb;
sq->doorbell_qpn = dqp->doorbell_qpn;
cq->buf = dcq->buf.buf;