[dpdk-dev] [PATCH V3 2/6] net/hns3: use unsigned types for bit operator

Lijun Ou oulijun at huawei.com
Mon Nov 9 15:28:58 CET 2020


From: Hongbo Zheng <zhenghongbo3 at huawei.com>

According to bit operator reliability style, variables in
the right expression participating int bit operation
must be an unsigned type.

Signed-off-by: Hongbo Zheng <zhenghongbo3 at huawei.com>
Signed-off-by: Lijun Ou <oulijun at huawei.com>
---
V2->V3:
- fix commit log for correct descriptions
- fix unnecessary variable declarations line merge

V1->V2:
- no fix
---
 drivers/net/hns3/hns3_ethdev_vf.c     | 2 +-
 drivers/net/hns3/hns3_rxtx_vec_neon.h | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 6f71cd6..2e9bfda 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1331,7 +1331,7 @@ hns3vf_get_tc_info(struct hns3_hw *hw)
 {
 	uint8_t resp_msg;
 	int ret;
-	int i;
+	uint32_t i;
 
 	ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_TCINFO, 0, NULL, 0,
 				true, &resp_msg, sizeof(resp_msg));
diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h
index 8d7721b..54addbf 100644
--- a/drivers/net/hns3/hns3_rxtx_vec_neon.h
+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h
@@ -93,9 +93,10 @@ hns3_desc_parse_field(struct hns3_rx_queue *rxq,
 	struct rte_mbuf *pkt;
 	uint32_t retcode = 0;
 	uint32_t cksum_err;
-	int ret, i;
+	uint32_t i;
+	int ret;
 
-	for (i = 0; i < (int)bd_vld_num; i++) {
+	for (i = 0; i < bd_vld_num; i++) {
 		pkt = sw_ring[i].mbuf;
 
 		/* init rte_mbuf.rearm_data last 64-bit */
@@ -131,7 +132,8 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq,
 	struct hns3_desc *rxdp = &rxq->rx_ring[rx_id];
 	uint32_t bd_valid_num, parse_retcode;
 	uint16_t nb_rx = 0;
-	int pos, offset;
+	uint32_t pos;
+	int offset;
 
 	/* mask to shuffle from desc to mbuf's rx_descriptor_fields1 */
 	uint8x16_t shuf_desc_fields_msk = {
-- 
2.7.4



More information about the dev mailing list