* [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings
@ 2021-11-19 14:01 Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 1/9] RDMA/hns: Correct the hex print format Wenpeng Liang
` (9 more replies)
0 siblings, 10 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:01 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
Most static warnings are detected by tools, mainly about:
(1) #1~2: About printing format.
(2) #3 : About code comments.
(3) #4~6: About variable definition and initialization.
(4) #7~9: Other miscellaneous.
Haoyue Xu (1):
RDMA/hns: Initialize variable in the right place
Xinhao Liu (7):
RDMA/hns: Correct the hex print format
RDMA/hns: Correct the print format to be consistent with the variable
type
RDMA/hns: Replace tab with space in the right-side comments
RDMA/hns: Correct the type of variables participating in the shift
operation
RDMA/hns: Correctly initialize the members of Array[][]
RDMA/hns: Add void conversion for function whose return value is not
used
RDMA/hns: Remove magic number
Yixing Liu (1):
RDMA/hns: Remove macros that are no longer used
drivers/infiniband/hw/hns/hns_roce_cmd.c | 10 +++---
drivers/infiniband/hw/hns/hns_roce_device.h | 40 ++++++++++-----------
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 23 ++++++------
drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 18 +---------
drivers/infiniband/hw/hns/hns_roce_mr.c | 10 +++---
drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +-
6 files changed, 45 insertions(+), 58 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH for-next 1/9] RDMA/hns: Correct the hex print format
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 2/9] RDMA/hns: Correct the print format to be consistent with the variable type Wenpeng Liang
` (8 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Xinhao Liu <liuxinhao5@hisilicon.com>
The hex printf format should be "0xff" instead of "ff".
Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_cmd.c | 10 +++++-----
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_cmd.c b/drivers/infiniband/hw/hns/hns_roce_cmd.c
index 84f3f2b5f097..3f7fb7508585 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cmd.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cmd.c
@@ -61,7 +61,7 @@ static int __hns_roce_cmd_mbox_poll(struct hns_roce_dev *hr_dev, u64 in_param,
CMD_POLL_TOKEN, 0);
if (ret) {
dev_err_ratelimited(hr_dev->dev,
- "failed to post mailbox %x in poll mode, ret = %d.\n",
+ "failed to post mailbox 0x%x in poll mode, ret = %d.\n",
op, ret);
return ret;
}
@@ -91,7 +91,7 @@ void hns_roce_cmd_event(struct hns_roce_dev *hr_dev, u16 token, u8 status,
if (unlikely(token != context->token)) {
dev_err_ratelimited(hr_dev->dev,
- "[cmd] invalid ae token %x,context token is %x!\n",
+ "[cmd] invalid ae token 0x%x, context token is 0x%x.\n",
token, context->token);
return;
}
@@ -130,14 +130,14 @@ static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
context->token, 1);
if (ret) {
dev_err_ratelimited(dev,
- "failed to post mailbox %x in event mode, ret = %d.\n",
+ "failed to post mailbox 0x%x in event mode, ret = %d.\n",
op, ret);
goto out;
}
if (!wait_for_completion_timeout(&context->done,
msecs_to_jiffies(timeout))) {
- dev_err_ratelimited(dev, "[cmd] token %x mailbox %x timeout.\n",
+ dev_err_ratelimited(dev, "[cmd] token 0x%x mailbox 0x%x timeout.\n",
context->token, op);
ret = -EBUSY;
goto out;
@@ -145,7 +145,7 @@ static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
ret = context->result;
if (ret)
- dev_err_ratelimited(dev, "[cmd] token %x mailbox %x error %d\n",
+ dev_err_ratelimited(dev, "[cmd] token 0x%x mailbox 0x%x error %d.\n",
context->token, op, ret);
out:
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 9bfbaddd1763..1c3307d57b06 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1295,7 +1295,7 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
continue;
dev_err_ratelimited(hr_dev->dev,
- "Cmdq IO error, opcode = %x, return = %x\n",
+ "Cmdq IO error, opcode = 0x%x, return = 0x%x.\n",
desc->opcode, desc_ret);
ret = -EIO;
}
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 2/9] RDMA/hns: Correct the print format to be consistent with the variable type
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 1/9] RDMA/hns: Correct the hex print format Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 3/9] RDMA/hns: Replace tab with space in the right-side comments Wenpeng Liang
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Xinhao Liu <liuxinhao5@hisilicon.com>
The print format should be consistent with variant type.
Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 1c3307d57b06..42bbb4278273 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1302,7 +1302,7 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
} else {
/* FW/HW reset or incorrect number of desc */
tail = roce_read(hr_dev, ROCEE_TX_CMQ_CI_REG);
- dev_warn(hr_dev->dev, "CMDQ move tail from %d to %d\n",
+ dev_warn(hr_dev->dev, "CMDQ move tail from %u to %u.\n",
csq->head, tail);
csq->head = tail;
@@ -4723,7 +4723,7 @@ static int hns_roce_v2_set_path(struct ib_qp *ibqp,
hr_qp->sl = rdma_ah_get_sl(&attr->ah_attr);
if (unlikely(hr_qp->sl > MAX_SERVICE_LEVEL)) {
ibdev_err(ibdev,
- "failed to fill QPC, sl (%d) shouldn't be larger than %d.\n",
+ "failed to fill QPC, sl (%u) shouldn't be larger than %d.\n",
hr_qp->sl, MAX_SERVICE_LEVEL);
return -EINVAL;
}
@@ -5831,7 +5831,7 @@ static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, int eqn)
0, HNS_ROCE_CMD_DESTROY_AEQC,
HNS_ROCE_CMD_TIMEOUT_MSECS);
if (ret)
- dev_err(dev, "[mailbox cmd] destroy eqc(%d) failed.\n", eqn);
+ dev_err(dev, "[mailbox cmd] destroy eqc(%u) failed.\n", eqn);
}
static void free_eq_buf(struct hns_roce_dev *hr_dev, struct hns_roce_eq *eq)
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 3/9] RDMA/hns: Replace tab with space in the right-side comments
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 1/9] RDMA/hns: Correct the hex print format Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 2/9] RDMA/hns: Correct the print format to be consistent with the variable type Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 4/9] RDMA/hns: Correct the type of variables participating in the shift operation Wenpeng Liang
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Xinhao Liu <liuxinhao5@hisilicon.com>
There should be a space between the code and the comment on the right.
Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_device.h | 26 ++++++++++-----------
drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 2 +-
drivers/infiniband/hw/hns/hns_roce_mr.c | 2 +-
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 43e17d61cb63..4c3b2e8b0d07 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -354,10 +354,10 @@ struct hns_roce_mr {
u64 size; /* Address range of MR */
u32 key; /* Key of MR */
u32 pd; /* PD num of MR */
- u32 access; /* Access permission of MR */
+ u32 access; /* Access permission of MR */
int enabled; /* MR's active status */
- int type; /* MR's register type */
- u32 pbl_hop_num; /* multi-hop number */
+ int type; /* MR's register type */
+ u32 pbl_hop_num; /* multi-hop number */
struct hns_roce_mtr pbl_mtr;
u32 npages;
dma_addr_t *page_list;
@@ -375,16 +375,16 @@ struct hns_roce_wq {
u32 max_gs;
u32 rsv_sge;
int offset;
- int wqe_shift; /* WQE size */
+ int wqe_shift; /* WQE size */
u32 head;
u32 tail;
void __iomem *db_reg;
};
struct hns_roce_sge {
- unsigned int sge_cnt; /* SGE num */
+ unsigned int sge_cnt; /* SGE num */
int offset;
- int sge_shift; /* SGE size */
+ int sge_shift; /* SGE size */
};
struct hns_roce_buf_list {
@@ -672,9 +672,9 @@ struct hns_roce_qp {
unsigned long flush_flag;
struct hns_roce_work flush_work;
struct hns_roce_rinl_buf rq_inl_buf;
- struct list_head node; /* all qps are on a list */
- struct list_head rq_node; /* all recv qps are on a list */
- struct list_head sq_node; /* all send qps are on a list */
+ struct list_head node; /* all qps are on a list */
+ struct list_head rq_node; /* all recv qps are on a list */
+ struct list_head sq_node; /* all send qps are on a list */
};
struct hns_roce_ib_iboe {
@@ -855,7 +855,7 @@ struct hns_roce_caps {
u32 cqc_timer_ba_pg_sz;
u32 cqc_timer_buf_pg_sz;
u32 cqc_timer_hop_num;
- u32 cqe_ba_pg_sz; /* page_size = 4K*(2^cqe_ba_pg_sz) */
+ u32 cqe_ba_pg_sz; /* page_size = 4K*(2^cqe_ba_pg_sz) */
u32 cqe_buf_pg_sz;
u32 cqe_hop_num;
u32 srqwqe_ba_pg_sz;
@@ -874,7 +874,7 @@ struct hns_roce_caps {
u32 gmv_hop_num;
u32 sl_num;
u32 llm_buf_pg_sz;
- u32 chunk_sz; /* chunk size in non multihop mode */
+ u32 chunk_sz; /* chunk size in non multihop mode */
u64 flags;
u16 default_ceq_max_cnt;
u16 default_ceq_period;
@@ -1001,8 +1001,8 @@ struct hns_roce_dev {
int loop_idc;
u32 sdb_offset;
u32 odb_offset;
- dma_addr_t tptr_dma_addr; /* only for hw v1 */
- u32 tptr_size; /* only for hw v1 */
+ dma_addr_t tptr_dma_addr; /* only for hw v1 */
+ u32 tptr_size; /* only for hw v1 */
const struct hns_roce_hw *hw;
void *priv;
struct workqueue_struct *irq_workq;
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
index 4d904d5e82be..6858b939de63 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
@@ -1441,7 +1441,7 @@ struct hns_roce_v2_priv {
struct hns_roce_dip {
u8 dgid[GID_LEN_V2];
u32 dip_idx;
- struct list_head node; /* all dips are on a list */
+ struct list_head node; /* all dips are on a list */
};
#define HNS_ROCE_AEQ_DEFAULT_BURST_NUM 0x0
diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index 7089ac780291..bf47191ce38b 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -81,7 +81,7 @@ static int alloc_mr_key(struct hns_roce_dev *hr_dev, struct hns_roce_mr *mr)
return -ENOMEM;
}
- mr->key = hw_index_to_key(id); /* MR key */
+ mr->key = hw_index_to_key(id); /* MR key */
err = hns_roce_table_get(hr_dev, &hr_dev->mr_table.mtpt_table,
(unsigned long)id);
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 4/9] RDMA/hns: Correct the type of variables participating in the shift operation
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
` (2 preceding siblings ...)
2021-11-19 14:02 ` [PATCH for-next 3/9] RDMA/hns: Replace tab with space in the right-side comments Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place Wenpeng Liang
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Xinhao Liu <liuxinhao5@hisilicon.com>
The type of the variable participating in the shift operation should be an
unsigned type instead of a signed type.
Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_device.h | 18 +++++++++---------
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
drivers/infiniband/hw/hns/hns_roce_mr.c | 8 ++++----
drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +-
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 4c3b2e8b0d07..e35164ae7376 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -374,8 +374,8 @@ struct hns_roce_wq {
u32 wqe_cnt; /* WQE num */
u32 max_gs;
u32 rsv_sge;
- int offset;
- int wqe_shift; /* WQE size */
+ u32 offset;
+ u32 wqe_shift; /* WQE size */
u32 head;
u32 tail;
void __iomem *db_reg;
@@ -383,8 +383,8 @@ struct hns_roce_wq {
struct hns_roce_sge {
unsigned int sge_cnt; /* SGE num */
- int offset;
- int sge_shift; /* SGE size */
+ u32 offset;
+ u32 sge_shift; /* SGE size */
};
struct hns_roce_buf_list {
@@ -468,7 +468,7 @@ struct hns_roce_cq {
struct hns_roce_idx_que {
struct hns_roce_mtr mtr;
- int entry_shift;
+ u32 entry_shift;
unsigned long *bitmap;
u32 head;
u32 tail;
@@ -480,7 +480,7 @@ struct hns_roce_srq {
u32 wqe_cnt;
int max_gs;
u32 rsv_sge;
- int wqe_shift;
+ u32 wqe_shift;
u32 cqn;
u32 xrcdn;
void __iomem *db_reg;
@@ -767,7 +767,7 @@ struct hns_roce_caps {
u32 reserved_qps;
int num_qpc_timer;
int num_cqc_timer;
- int num_srqs;
+ u32 num_srqs;
u32 max_wqes;
u32 max_srq_wrs;
u32 max_srq_sges;
@@ -781,7 +781,7 @@ struct hns_roce_caps {
u32 min_cqes;
u32 min_wqes;
u32 reserved_cqs;
- int reserved_srqs;
+ u32 reserved_srqs;
int num_aeq_vectors;
int num_comp_vectors;
int num_other_vectors;
@@ -1158,7 +1158,7 @@ void hns_roce_cmd_use_polling(struct hns_roce_dev *hr_dev);
/* hns roce hw need current block and next block addr from mtt */
#define MTT_MIN_COUNT 2
int hns_roce_mtr_find(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
- int offset, u64 *mtt_buf, int mtt_max, u64 *base_addr);
+ u32 offset, u64 *mtt_buf, int mtt_max, u64 *base_addr);
int hns_roce_mtr_create(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
struct hns_roce_buf_attr *buf_attr,
unsigned int page_shift, struct ib_udata *udata,
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 42bbb4278273..ae4f6fa8ad71 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -5817,7 +5817,7 @@ static void hns_roce_v2_int_mask_enable(struct hns_roce_dev *hr_dev,
roce_write(hr_dev, ROCEE_VF_ABN_INT_CFG_REG, enable_flag);
}
-static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, int eqn)
+static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, u32 eqn)
{
struct device *dev = hr_dev->dev;
int ret;
diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index bf47191ce38b..8de899372567 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -824,11 +824,11 @@ int hns_roce_mtr_map(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
}
int hns_roce_mtr_find(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
- int offset, u64 *mtt_buf, int mtt_max, u64 *base_addr)
+ u32 offset, u64 *mtt_buf, int mtt_max, u64 *base_addr)
{
struct hns_roce_hem_cfg *cfg = &mtr->hem_cfg;
int mtt_count, left;
- int start_index;
+ u32 start_index;
int total = 0;
__le64 *mtts;
u32 npage;
@@ -884,10 +884,10 @@ int hns_roce_mtr_find(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,
static int mtr_init_buf_cfg(struct hns_roce_dev *hr_dev,
struct hns_roce_buf_attr *attr,
struct hns_roce_hem_cfg *cfg,
- unsigned int *buf_page_shift, int unalinged_size)
+ unsigned int *buf_page_shift, u64 unalinged_size)
{
struct hns_roce_buf_region *r;
- int first_region_padding;
+ u64 first_region_padding;
int page_cnt, region_cnt;
unsigned int page_shift;
size_t buf_size;
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 9af4509894e6..4fcab1611548 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -1391,7 +1391,7 @@ void hns_roce_unlock_cqs(struct hns_roce_cq *send_cq,
}
}
-static inline void *get_wqe(struct hns_roce_qp *hr_qp, int offset)
+static inline void *get_wqe(struct hns_roce_qp *hr_qp, u32 offset)
{
return hns_roce_buf_offset(hr_qp->mtr.kmem, offset);
}
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
` (3 preceding siblings ...)
2021-11-19 14:02 ` [PATCH for-next 4/9] RDMA/hns: Correct the type of variables participating in the shift operation Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 17:27 ` Jason Gunthorpe
2021-11-19 14:02 ` [PATCH for-next 6/9] RDMA/hns: Correctly initialize the members of Array[][] Wenpeng Liang
` (4 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Haoyue Xu <xuhaoyue1@hisilicon.com>
The "ret" should be initialized when it is defined instead of in the loop.
Signed-off-by: Haoyue Xu <xuhaoyue1@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index ae4f6fa8ad71..556d79fb2352 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1260,8 +1260,8 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
struct hns_roce_v2_cmq_ring *csq = &priv->cmq.csq;
u32 timeout = 0;
u16 desc_ret;
+ int ret = 0;
u32 tail;
- int ret;
int i;
spin_lock_bh(&csq->lock);
@@ -1284,7 +1284,7 @@ static int __hns_roce_cmq_send(struct hns_roce_dev *hr_dev,
} while (++timeout < priv->cmq.tx_timeout);
if (hns_roce_cmq_csq_done(hr_dev)) {
- for (ret = 0, i = 0; i < num; i++) {
+ for (i = 0; i < num; i++) {
/* check the result of hardware write back */
desc[i] = csq->desc[tail++];
if (tail == csq->desc_num)
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 6/9] RDMA/hns: Correctly initialize the members of Array[][]
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
` (4 preceding siblings ...)
2021-11-19 14:02 ` [PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 7/9] RDMA/hns: Add void conversion for function whose return value is not used Wenpeng Liang
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Xinhao Liu <liuxinhao@huawei.com>
Each member of Array[][] should be initialized on a separate line.
Signed-off-by: Xinhao Liu <liuxinhao@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 556d79fb2352..d8788819b827 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -4752,7 +4752,8 @@ static bool check_qp_state(enum ib_qp_state cur_state,
[IB_QPS_ERR] = true },
[IB_QPS_SQD] = {},
[IB_QPS_SQE] = {},
- [IB_QPS_ERR] = { [IB_QPS_RESET] = true, [IB_QPS_ERR] = true }
+ [IB_QPS_ERR] = { [IB_QPS_RESET] = true,
+ [IB_QPS_ERR] = true }
};
return sm[cur_state][new_state];
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 7/9] RDMA/hns: Add void conversion for function whose return value is not used
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
` (5 preceding siblings ...)
2021-11-19 14:02 ` [PATCH for-next 6/9] RDMA/hns: Correctly initialize the members of Array[][] Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 17:28 ` Jason Gunthorpe
2021-11-19 14:02 ` [PATCH for-next 8/9] RDMA/hns: Remove macros that are no longer used Wenpeng Liang
` (2 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Xinhao Liu <liuxinhao5@hisilicon.com>
If the return value of the function is not used, then void should be added.
Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index d8788819b827..978913fc7587 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -1509,7 +1509,7 @@ static void hns_roce_free_vf_resource(struct hns_roce_dev *hr_dev, int vf_id)
desc[0].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
hns_roce_cmq_setup_basic_desc(&desc[1], opcode, false);
hr_reg_write(req_a, FUNC_RES_A_VF_ID, vf_id);
- hns_roce_cmq_send(hr_dev, desc, 2);
+ (void)hns_roce_cmq_send(hr_dev, desc, 2);
}
static void hns_roce_function_clear(struct hns_roce_dev *hr_dev)
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 8/9] RDMA/hns: Remove macros that are no longer used
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
` (6 preceding siblings ...)
2021-11-19 14:02 ` [PATCH for-next 7/9] RDMA/hns: Add void conversion for function whose return value is not used Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 9/9] RDMA/hns: Remove magic number Wenpeng Liang
2021-11-19 18:18 ` [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Jason Gunthorpe
9 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Yixing Liu <liuyixing1@huawei.com>
These macros are no longer used, so remove them.
Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v2.h | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
index 6858b939de63..fddb9bc3c14c 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
@@ -35,26 +35,15 @@
#include <linux/bitops.h>
-#define HNS_ROCE_VF_QPC_BT_NUM 256
-#define HNS_ROCE_VF_SCCC_BT_NUM 64
-#define HNS_ROCE_VF_SRQC_BT_NUM 64
-#define HNS_ROCE_VF_CQC_BT_NUM 64
-#define HNS_ROCE_VF_MPT_BT_NUM 64
-#define HNS_ROCE_VF_SMAC_NUM 32
-#define HNS_ROCE_VF_SL_NUM 8
-#define HNS_ROCE_VF_GMV_BT_NUM 256
-
#define HNS_ROCE_V2_MAX_QP_NUM 0x1000
#define HNS_ROCE_V2_MAX_QPC_TIMER_NUM 0x200
#define HNS_ROCE_V2_MAX_WQE_NUM 0x8000
-#define HNS_ROCE_V2_MAX_SRQ 0x100000
#define HNS_ROCE_V2_MAX_SRQ_WR 0x8000
#define HNS_ROCE_V2_MAX_SRQ_SGE 64
#define HNS_ROCE_V2_MAX_CQ_NUM 0x100000
#define HNS_ROCE_V2_MAX_CQC_TIMER_NUM 0x100
#define HNS_ROCE_V2_MAX_SRQ_NUM 0x100000
#define HNS_ROCE_V2_MAX_CQE_NUM 0x400000
-#define HNS_ROCE_V2_MAX_SRQWQE_NUM 0x8000
#define HNS_ROCE_V2_MAX_RQ_SGE_NUM 64
#define HNS_ROCE_V2_MAX_SQ_SGE_NUM 64
#define HNS_ROCE_V2_MAX_EXTEND_SGE_NUM 0x200000
@@ -63,13 +52,10 @@
#define HNS_ROCE_V2_MAX_RC_INL_INN_SZ 32
#define HNS_ROCE_V2_UAR_NUM 256
#define HNS_ROCE_V2_PHY_UAR_NUM 1
-#define HNS_ROCE_V2_MAX_IRQ_NUM 65
-#define HNS_ROCE_V2_COMP_VEC_NUM 63
#define HNS_ROCE_V2_AEQE_VEC_NUM 1
#define HNS_ROCE_V2_ABNORMAL_VEC_NUM 1
#define HNS_ROCE_V2_MAX_MTPT_NUM 0x100000
#define HNS_ROCE_V2_MAX_MTT_SEGS 0x1000000
-#define HNS_ROCE_V2_MAX_CQE_SEGS 0x1000000
#define HNS_ROCE_V2_MAX_SRQWQE_SEGS 0x1000000
#define HNS_ROCE_V2_MAX_IDX_SEGS 0x1000000
#define HNS_ROCE_V2_MAX_PD_NUM 0x1000000
@@ -81,7 +67,6 @@
#define HNS_ROCE_V2_MAX_RQ_DESC_SZ 16
#define HNS_ROCE_V2_MAX_SRQ_DESC_SZ 64
#define HNS_ROCE_V2_IRRL_ENTRY_SZ 64
-#define HNS_ROCE_V2_TRRL_ENTRY_SZ 48
#define HNS_ROCE_V2_EXT_ATOMIC_TRRL_ENTRY_SZ 100
#define HNS_ROCE_V2_CQC_ENTRY_SZ 64
#define HNS_ROCE_V2_SRQC_ENTRY_SZ 64
@@ -103,7 +88,6 @@
#define HNS_ROCE_INVALID_LKEY 0x0
#define HNS_ROCE_INVALID_SGE_LENGTH 0x80000000
#define HNS_ROCE_CMQ_TX_TIMEOUT 30000
-#define HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE 2
#define HNS_ROCE_V2_RSV_QPS 8
#define HNS_ROCE_V2_HW_RST_TIMEOUT 1000
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH for-next 9/9] RDMA/hns: Remove magic number
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
` (7 preceding siblings ...)
2021-11-19 14:02 ` [PATCH for-next 8/9] RDMA/hns: Remove macros that are no longer used Wenpeng Liang
@ 2021-11-19 14:02 ` Wenpeng Liang
2021-11-19 18:18 ` [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Jason Gunthorpe
9 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-19 14:02 UTC (permalink / raw)
To: dledford, jgg; +Cc: linux-rdma, linuxarm, liangwenpeng
From: Xinhao Liu <liuxinhao5@hisilicon.com>
Don't use unintelligible constants.
Signed-off-by: Xinhao Liu <liuxinhao5@hisilicon.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 978913fc7587..66393b97a469 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -677,6 +677,7 @@ static void hns_roce_write512(struct hns_roce_dev *hr_dev, u64 *val,
static void write_dwqe(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp,
void *wqe)
{
+#define HNS_ROCE_SL_SHIFT 2
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe = wqe;
/* All kinds of DirectWQE have the same header field layout */
@@ -684,7 +685,8 @@ static void write_dwqe(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp,
roce_set_field(rc_sq_wqe->byte_4, V2_RC_SEND_WQE_BYTE_4_DB_SL_L_M,
V2_RC_SEND_WQE_BYTE_4_DB_SL_L_S, qp->sl);
roce_set_field(rc_sq_wqe->byte_4, V2_RC_SEND_WQE_BYTE_4_DB_SL_H_M,
- V2_RC_SEND_WQE_BYTE_4_DB_SL_H_S, qp->sl >> 2);
+ V2_RC_SEND_WQE_BYTE_4_DB_SL_H_S,
+ qp->sl >> HNS_ROCE_SL_SHIFT);
roce_set_field(rc_sq_wqe->byte_4, V2_RC_SEND_WQE_BYTE_4_WQE_INDEX_M,
V2_RC_SEND_WQE_BYTE_4_WQE_INDEX_S, qp->sq.head);
--
2.33.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place
2021-11-19 14:02 ` [PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place Wenpeng Liang
@ 2021-11-19 17:27 ` Jason Gunthorpe
2021-11-24 4:01 ` Wenpeng Liang
0 siblings, 1 reply; 15+ messages in thread
From: Jason Gunthorpe @ 2021-11-19 17:27 UTC (permalink / raw)
To: Wenpeng Liang; +Cc: dledford, linux-rdma, linuxarm
On Fri, Nov 19, 2021 at 10:02:04PM +0800, Wenpeng Liang wrote:
> From: Haoyue Xu <xuhaoyue1@hisilicon.com>
>
> The "ret" should be initialized when it is defined instead of in the loop.
Why?
It is a bit weird, but the code is fine as written
The only suggestion I'd make is
if (hns_roce_cmq_csq_done(hr_dev)) {
ret = 0;
for (i = 0; i < num; i++) {
Just because the , operator is not so typically used like that
Jason
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH for-next 7/9] RDMA/hns: Add void conversion for function whose return value is not used
2021-11-19 14:02 ` [PATCH for-next 7/9] RDMA/hns: Add void conversion for function whose return value is not used Wenpeng Liang
@ 2021-11-19 17:28 ` Jason Gunthorpe
2021-11-24 4:04 ` Wenpeng Liang
0 siblings, 1 reply; 15+ messages in thread
From: Jason Gunthorpe @ 2021-11-19 17:28 UTC (permalink / raw)
To: Wenpeng Liang; +Cc: dledford, linux-rdma, linuxarm
On Fri, Nov 19, 2021 at 10:02:06PM +0800, Wenpeng Liang wrote:
> From: Xinhao Liu <liuxinhao5@hisilicon.com>
>
> If the return value of the function is not used, then void should be
> added.
AFAIK we don't do this in the kernel
Jason
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
` (8 preceding siblings ...)
2021-11-19 14:02 ` [PATCH for-next 9/9] RDMA/hns: Remove magic number Wenpeng Liang
@ 2021-11-19 18:18 ` Jason Gunthorpe
9 siblings, 0 replies; 15+ messages in thread
From: Jason Gunthorpe @ 2021-11-19 18:18 UTC (permalink / raw)
To: Wenpeng Liang; +Cc: dledford, linux-rdma, linuxarm
On Fri, Nov 19, 2021 at 10:01:59PM +0800, Wenpeng Liang wrote:
> RDMA/hns: Correct the hex print format
> RDMA/hns: Correct the print format to be consistent with the variable
> type
> RDMA/hns: Replace tab with space in the right-side comments
> RDMA/hns: Correct the type of variables participating in the shift
> operation
> RDMA/hns: Correctly initialize the members of Array[][]
> RDMA/hns: Remove magic number
I took these patches to for-next
> RDMA/hns: Initialize variable in the right place
> RDMA/hns: Add void conversion for function whose return value is not
> used
Not keen on these
Thanks,
Jason
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place
2021-11-19 17:27 ` Jason Gunthorpe
@ 2021-11-24 4:01 ` Wenpeng Liang
0 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-24 4:01 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: dledford, linux-rdma, linuxarm
On 2021/11/20 1:27, Jason Gunthorpe wrote:
> On Fri, Nov 19, 2021 at 10:02:04PM +0800, Wenpeng Liang wrote:
>> From: Haoyue Xu <xuhaoyue1@hisilicon.com>
>>
>> The "ret" should be initialized when it is defined instead of in the loop.
>
> Why?
>
> It is a bit weird, but the code is fine as written
>
> The only suggestion I'd make is
>
> if (hns_roce_cmq_csq_done(hr_dev)) {
> ret = 0;
> for (i = 0; i < num; i++) {
>
> Just because the , operator is not so typically used like that
>
> Jason
> .
>
Thanks for your suggestion, I will assign ret in the if branch in v2.
Thanks,
Wenpeng
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH for-next 7/9] RDMA/hns: Add void conversion for function whose return value is not used
2021-11-19 17:28 ` Jason Gunthorpe
@ 2021-11-24 4:04 ` Wenpeng Liang
0 siblings, 0 replies; 15+ messages in thread
From: Wenpeng Liang @ 2021-11-24 4:04 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: dledford, linux-rdma, linuxarm
On 2021/11/20 1:28, Jason Gunthorpe wrote:
> On Fri, Nov 19, 2021 at 10:02:06PM +0800, Wenpeng Liang wrote:
>> From: Xinhao Liu <liuxinhao5@hisilicon.com>
>>
>> If the return value of the function is not used, then void should be
>> added.
>
> AFAIK we don't do this in the kernel
>
> Jason
> .
>
Thanks for your comments, I will fix it in v2.
Thanks
Wenpeng
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-11-24 4:04 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-19 14:01 [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 1/9] RDMA/hns: Correct the hex print format Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 2/9] RDMA/hns: Correct the print format to be consistent with the variable type Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 3/9] RDMA/hns: Replace tab with space in the right-side comments Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 4/9] RDMA/hns: Correct the type of variables participating in the shift operation Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 5/9] RDMA/hns: Initialize variable in the right place Wenpeng Liang
2021-11-19 17:27 ` Jason Gunthorpe
2021-11-24 4:01 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 6/9] RDMA/hns: Correctly initialize the members of Array[][] Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 7/9] RDMA/hns: Add void conversion for function whose return value is not used Wenpeng Liang
2021-11-19 17:28 ` Jason Gunthorpe
2021-11-24 4:04 ` Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 8/9] RDMA/hns: Remove macros that are no longer used Wenpeng Liang
2021-11-19 14:02 ` [PATCH for-next 9/9] RDMA/hns: Remove magic number Wenpeng Liang
2021-11-19 18:18 ` [PATCH for-next 0/9] RDMA/hns: Cleanup for clearing static warnings Jason Gunthorpe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.