RDMA/hns: Various cleanups
Subsystems (2)
cover RDMA/hns: Various cleanups
No logic of code was changed by these patches, all of them are tiny cleanups.
By the way, this series has nothing to do with the series I sent a PR to rdma-core recently.
Lijun Ou (4):
RDMA/hns: Remove unused function hns_roce_init_eq_table() RDMA/hns: Update the value of qp type
RDMA/hns: Delete unnessary parameters in hns_roce_v2_qp_modify() RDMA/hns: Fix coding style issues
Wenpeng Liang (2):
RDMA/hns: Avoid printing address of mtt page RDMA/hns: Replace custom macros HNS_ROCE_ALIGN_UP
Yixing Liu (1):
RDMA/hns: Remove redundant print information
drivers/infiniband/hw/hns/hns_roce_device.h | 15 ++- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 172 ++++++++++------------------ drivers/infiniband/hw/hns/hns_roce_main.c | 56 +++++---- drivers/infiniband/hw/hns/hns_roce_mr.c | 4 +- drivers/infiniband/hw/hns/hns_roce_qp.c | 44 ++++--- 5 files changed, 116 insertions(+), 175 deletions(-)
Signature · 1 line
2.8.1
PATCH 1/7 RDMA/hns: Avoid printing address of mtt page
From: Wenpeng Liang <[email protected]>
Address of a page shouldn't be printed in case of security issues.
--- drivers/infiniband/hw/hns/hns_roce_mr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_mr.c +2 -2
@@ -1064,8 +1064,8 @@ int hns_roce_ib_umem_write_mtt(struct hns_roce_dev *hr_dev,if (!(npage % (1 << (mtt->page_shift -PAGE_SHIFT )))) {if (page_addr & ((1 << mtt->page_shift) -1 )) {dev_err (dev, -"page_addr 0x%llx is not page_shift %d alignment!\n" , - page_addr, mtt->page_shift); +"page_addr is not page_shift %d alignment!\n" , + mtt->page_shift); ret = -EINVAL ; goto out; }
Signature · 1 line
2.8.1
PATCH 2/7 RDMA/hns: Remove unused function hns_roce_init_eq_table()
In reply to Weihang LiFrom: Lijun Ou <[email protected]>
hns_roce_init_eq_table() is an unused function that only retains its declaration in driver.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_device.h +0 -1
@@ -1133,7 +1133,6 @@ int hns_roce_mtr_find(struct hns_roce_dev *hr_dev, struct hns_roce_mtr *mtr,int hns_roce_init_pd_table (struct hns_roce_dev *hr_dev);int hns_roce_init_mr_table (struct hns_roce_dev *hr_dev); -int hns_roce_init_eq_table (struct hns_roce_dev *hr_dev);int hns_roce_init_cq_table (struct hns_roce_dev *hr_dev);int hns_roce_init_qp_table (struct hns_roce_dev *hr_dev);int hns_roce_init_srq_table (struct hns_roce_dev *hr_dev);
Signature · 1 line
2.8.1
PATCH 3/7 RDMA/hns: Update the value of qp type
In reply to Weihang LiFrom: Lijun Ou <[email protected]>
The values used to represent service type of RC and UD should be interchanged according to design of hardware. And it's better to define these types in enumeration than macros.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +7 -5
@@ -107,11 +107,6 @@#define NODE_DESC_SIZE 64#define DB_REG_OFFSET 0x1000 -#define SERV_TYPE_RC 0 -#define SERV_TYPE_RD 1 -#define SERV_TYPE_UC 2 -#define SERV_TYPE_UD 3 -/* Configure to HW for PAGE_SIZE larger than 4KB */ #define PG_SHIFT_OFFSET (PAGE_SHIFT - 12)
@@ -131,6 +126,13 @@#define EQ_DEPTH_COEFF 2enum { +SERV_TYPE_RC , +SERV_TYPE_UC , +SERV_TYPE_RD , +SERV_TYPE_UD , +}; + +enum {HNS_ROCE_SUPPORT_RQ_RECORD_DB =1 <<0 ,HNS_ROCE_SUPPORT_SQ_RECORD_DB =1 <<1 , };
Signature · 1 line
2.8.1
PATCH 4/7 RDMA/hns: Delete unnessary parameters in hns_roce_v2_qp_modify()
In reply to Weihang LiFrom: Lijun Ou <[email protected]>
Current state and new state of qp won't be configured when modifying qp, so these two redundant parameters should be removed.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -3
@@ -3159,8 +3159,6 @@ static int hns_roce_v2_clear_hem(struct hns_roce_dev *hr_dev, }static int hns_roce_v2_qp_modify (struct hns_roce_dev *hr_dev, -enum ib_qp_state cur_state, -enum ib_qp_state new_state,struct hns_roce_v2_qp_context *context,struct hns_roce_qp *hr_qp) {
@@ -4443,7 +4441,7 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp, V2_QPC_BYTE_60_QP_ST_S, 0);/* SW pass context to HW */ - ret =hns_roce_v2_qp_modify (hr_dev, cur_state, new_state, ctx, hr_qp); + ret =hns_roce_v2_qp_modify (hr_dev, ctx, hr_qp);if (ret) {dev_err (dev,"hns_roce_qp_modify failed(%d)\n" , ret); goto out;
Signature · 1 line
2.8.1
PATCH 5/7 RDMA/hns: Remove redundant print information
In reply to Weihang LiFrom: Yixing Liu <[email protected]>
There are already necessary prints in outer function, prints in hns_roce_function_clear() may confuse users. So these prints is removed.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +0 -1
@@ -1254,7 +1254,6 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev) } out: -dev_err (hr_dev->dev,"Func clear fail.\n" );hns_roce_func_clr_rst_prc (hr_dev, ret, fclr_write_fail_flag); }
Signature · 1 line
2.8.1
PATCH 6/7 RDMA/hns: Replace custom macros HNS_ROCE_ALIGN_UP
In reply to Weihang LiFrom: Wenpeng Liang <[email protected]>
HNS_ROCE_ALIGN_UP can be replaced by round_up() which is defined in kernel.h.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 2 -- drivers/infiniband/hw/hns/hns_roce_qp.c | 44 +++++++++++++---------------- 2 files changed, 20 insertions(+), 26 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +0 -2
@@ -45,8 +45,6 @@#define HNS_ROCE_MAX_MSG_LEN 0x80000000 -#define HNS_ROCE_ALIGN_UP (a, b) ((((a) + (b) - 1) / (b)) * (b)) -#define HNS_ROCE_IB_MIN_SQ_STRIDE 6#define HNS_ROCE_BA_SIZE (32 * 4096)
drivers/infiniband/hw/hns/hns_roce_qp.c +20 -24
80 lines not on this page · raw message
Signature · 1 line
2.8.1
PATCH 7/7 RDMA/hns: Fix coding style issues
In reply to Weihang LiFrom: Lijun Ou <[email protected]>
Fix some coding style issuses without changing logic of codes, most of the modification is unreasonable line breaks and alignments.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 167 ++++++++++------------------- drivers/infiniband/hw/hns/hns_roce_main.c | 56 +++++----- 2 files changed, 86 insertions(+), 137 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +59 -108
@@ -63,20 +63,15 @@ static void set_frmr_seg(struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,struct hns_roce_mr *mr =to_hr_mr (wr->mr);/* use ib_access_flags */ -roce_set_bit (rc_sq_wqe->byte_4, -V2_RC_FRMR_WQE_BYTE_4_BIND_EN_S , +roce_set_bit (rc_sq_wqe->byte_4,V2_RC_FRMR_WQE_BYTE_4_BIND_EN_S , wr->access &IB_ACCESS_MW_BIND ?1 :0 ); -roce_set_bit (rc_sq_wqe->byte_4, -V2_RC_FRMR_WQE_BYTE_4_ATOMIC_S , +roce_set_bit (rc_sq_wqe->byte_4,V2_RC_FRMR_WQE_BYTE_4_ATOMIC_S , wr->access &IB_ACCESS_REMOTE_ATOMIC ?1 :0 ); -roce_set_bit (rc_sq_wqe->byte_4, -V2_RC_FRMR_WQE_BYTE_4_RR_S , +roce_set_bit (rc_sq_wqe->byte_4,V2_RC_FRMR_WQE_BYTE_4_RR_S , wr->access &IB_ACCESS_REMOTE_READ ?1 :0 ); -roce_set_bit (rc_sq_wqe->byte_4, -V2_RC_FRMR_WQE_BYTE_4_RW_S , +roce_set_bit (rc_sq_wqe->byte_4,V2_RC_FRMR_WQE_BYTE_4_RW_S , wr->access &IB_ACCESS_REMOTE_WRITE ?1 :0 ); -roce_set_bit (rc_sq_wqe->byte_4, -V2_RC_FRMR_WQE_BYTE_4_LW_S , +roce_set_bit (rc_sq_wqe->byte_4,V2_RC_FRMR_WQE_BYTE_4_LW_S , wr->access &IB_ACCESS_LOCAL_WRITE ?1 :0 );/* Data structure reuse may lead to confusion */
@@ -1378,7 +1373,7 @@ static int hns_roce_query_pf_timer_resource(struct hns_roce_dev *hr_dev) }static int hns_roce_set_vf_switch_param (struct hns_roce_dev *hr_dev, -int vf_id) +int vf_id) {struct hns_roce_cmq_desc desc;struct hns_roce_vf_switch *swt;
@@ -1387,13 +1382,12 @@ static int hns_roce_set_vf_switch_param(struct hns_roce_dev *hr_dev, swt = (struct hns_roce_vf_switch *)desc.data;hns_roce_cmq_setup_basic_desc (&desc,HNS_SWITCH_PARAMETER_CFG , true); swt->rocee_sel |=cpu_to_le32 (HNS_ICL_SWITCH_CMD_ROCEE_SEL ); -roce_set_field (swt->fun_id, -VF_SWITCH_DATA_FUN_ID_VF_ID_M , -VF_SWITCH_DATA_FUN_ID_VF_ID_S , - vf_id); +roce_set_field (swt->fun_id,VF_SWITCH_DATA_FUN_ID_VF_ID_M , +VF_SWITCH_DATA_FUN_ID_VF_ID_S , vf_id); ret =hns_roce_cmq_send (hr_dev, &desc,1 );if (ret)return ret; + desc.flag =cpu_to_le16 (HNS_ROCE_CMD_FLAG_NO_INTR |HNS_ROCE_CMD_FLAG_IN ); desc.flag &=cpu_to_le16 (~HNS_ROCE_CMD_FLAG_WR );
@@ -1817,37 +1811,32 @@ static int hns_roce_config_link_table(struct hns_roce_dev *hr_dev, req_a->base_addr_h =cpu_to_le32 (link_tbl->table.map >>32 );roce_set_field (req_a->depth_pgsz_init_en, -CFG_LLM_QUE_DEPTH_M , -CFG_LLM_QUE_DEPTH_S , +CFG_LLM_QUE_DEPTH_M ,CFG_LLM_QUE_DEPTH_S , link_tbl->npages);roce_set_field (req_a->depth_pgsz_init_en, -CFG_LLM_QUE_PGSZ_M , -CFG_LLM_QUE_PGSZ_S , +CFG_LLM_QUE_PGSZ_M ,CFG_LLM_QUE_PGSZ_S , link_tbl->pg_sz); req_a->head_ba_l =cpu_to_le32 (entry[0 ].blk_ba0); req_a->head_ba_h_nxtptr =cpu_to_le32 (entry[0 ].blk_ba1_nxt_ptr); -roce_set_field (req_a->head_ptr, -CFG_LLM_HEAD_PTR_M , +roce_set_field (req_a->head_ptr,CFG_LLM_HEAD_PTR_M ,CFG_LLM_HEAD_PTR_S ,0 ); }else { req_b->tail_ba_l =cpu_to_le32 (entry[page_num -1 ].blk_ba0); -roce_set_field (req_b->tail_ba_h, -CFG_LLM_TAIL_BA_H_M , +roce_set_field (req_b->tail_ba_h,CFG_LLM_TAIL_BA_H_M ,CFG_LLM_TAIL_BA_H_S , entry[page_num -1 ].blk_ba1_nxt_ptr &HNS_ROCE_LINK_TABLE_BA1_M ); -roce_set_field (req_b->tail_ptr, -CFG_LLM_TAIL_PTR_M , +roce_set_field (req_b->tail_ptr,CFG_LLM_TAIL_PTR_M ,CFG_LLM_TAIL_PTR_S , (entry[page_num -2 ].blk_ba1_nxt_ptr &HNS_ROCE_LINK_TABLE_NXT_PTR_M ) >>HNS_ROCE_LINK_TABLE_NXT_PTR_S ); } } -roce_set_field (req_a->depth_pgsz_init_en, -CFG_LLM_INIT_EN_M ,CFG_LLM_INIT_EN_S ,1 ); +roce_set_field (req_a->depth_pgsz_init_en,CFG_LLM_INIT_EN_M , +CFG_LLM_INIT_EN_S ,1 );return hns_roce_cmq_send (hr_dev, desc,2 ); }
@@ -2140,11 +2129,9 @@ static int hns_roce_config_sgid_table(struct hns_roce_dev *hr_dev,hns_roce_cmq_setup_basic_desc (&desc,HNS_ROCE_OPC_CFG_SGID_TB , false); -roce_set_field (sgid_tb->table_idx_rsv, -CFG_SGID_TB_TABLE_IDX_M , +roce_set_field (sgid_tb->table_idx_rsv,CFG_SGID_TB_TABLE_IDX_M ,CFG_SGID_TB_TABLE_IDX_S , gid_index); -roce_set_field (sgid_tb->vf_sgid_type_rsv, -CFG_SGID_TB_VF_SGID_TYPE_M , +roce_set_field (sgid_tb->vf_sgid_type_rsv,CFG_SGID_TB_VF_SGID_TYPE_M ,CFG_SGID_TB_VF_SGID_TYPE_S , sgid_type); p = (u32 *)&gid->raw[0 ];
@@ -2415,8 +2402,7 @@ static int hns_roce_v2_mw_write_mtpt(void *mb_buf, struct hns_roce_mw *mw) V2_MPT_BYTE_4_MPT_ST_S, V2_MPT_ST_FREE);roce_set_field (mpt_entry->byte_4_pd_hop_st,V2_MPT_BYTE_4_PD_M ,V2_MPT_BYTE_4_PD_S , mw->pdn); -roce_set_field (mpt_entry->byte_4_pd_hop_st, -V2_MPT_BYTE_4_PBL_HOP_NUM_M , +roce_set_field (mpt_entry->byte_4_pd_hop_st,V2_MPT_BYTE_4_PBL_HOP_NUM_M ,V2_MPT_BYTE_4_PBL_HOP_NUM_S , mw->pbl_hop_num ==HNS_ROCE_HOP_NUM_0 ?0 : mw->pbl_hop_num);
@@ -2560,8 +2546,7 @@ static void hns_roce_v2_write_cqc(struct hns_roce_dev *hr_dev,roce_set_field (cq_context->byte_4_pg_ceqn,V2_CQC_BYTE_4_ARM_ST_M ,V2_CQC_BYTE_4_ARM_ST_S ,REG_NXT_CEQE );roce_set_field (cq_context->byte_4_pg_ceqn,V2_CQC_BYTE_4_SHIFT_M , -V2_CQC_BYTE_4_SHIFT_S , -ilog2 (hr_cq->cq_depth)); +V2_CQC_BYTE_4_SHIFT_S ,ilog2 (hr_cq->cq_depth));roce_set_field (cq_context->byte_4_pg_ceqn,V2_CQC_BYTE_4_CEQN_M ,V2_CQC_BYTE_4_CEQN_S , hr_cq->vector);
@@ -3835,13 +3820,11 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,/* Configure GID index */ port_num =rdma_ah_get_port_num (&attr->ah_attr);roce_set_field (context->byte_20_smac_sgid_idx, -V2_QPC_BYTE_20_SGID_IDX_M , -V2_QPC_BYTE_20_SGID_IDX_S , +V2_QPC_BYTE_20_SGID_IDX_M ,V2_QPC_BYTE_20_SGID_IDX_S ,hns_get_gid_index (hr_dev, port_num -1 , grh->sgid_index));roce_set_field (qpc_mask->byte_20_smac_sgid_idx, -V2_QPC_BYTE_20_SGID_IDX_M , -V2_QPC_BYTE_20_SGID_IDX_S ,0 ); +V2_QPC_BYTE_20_SGID_IDX_M ,V2_QPC_BYTE_20_SGID_IDX_S ,0 );memcpy (&(context->dmac), dmac,sizeof (u32));roce_set_field (context->byte_52_udpspn_dmac,V2_QPC_BYTE_52_DMAC_M ,V2_QPC_BYTE_52_DMAC_S , *((u16 *)(&dmac[4 ])));
@@ -4231,8 +4214,7 @@ static int hns_roce_v2_set_opt_fields(struct ib_qp *ibqp,roce_set_field (context->byte_212_lsn,V2_QPC_BYTE_212_RETRY_CNT_M , -V2_QPC_BYTE_212_RETRY_CNT_S , - attr->retry_cnt); +V2_QPC_BYTE_212_RETRY_CNT_S , attr->retry_cnt);roce_set_field (qpc_mask->byte_212_lsn,V2_QPC_BYTE_212_RETRY_CNT_M ,V2_QPC_BYTE_212_RETRY_CNT_S ,0 );
@@ -5152,8 +5134,7 @@ static int hns_roce_v2_ceq_int(struct hns_roce_dev *hr_dev,*/ dma_rmb (); - cqn =roce_get_field (ceqe->comp, -HNS_ROCE_V2_CEQE_COMP_CQN_M , + cqn =roce_get_field (ceqe->comp,HNS_ROCE_V2_CEQE_COMP_CQN_M ,HNS_ROCE_V2_CEQE_COMP_CQN_S );hns_roce_cq_completion (hr_dev, cqn);
@@ -5406,126 +5387,98 @@ static void hns_roce_config_eqc(struct hns_roce_dev *hr_dev, eq->eqe_ba = eq->l0_dma;/* set eqc state */ -roce_set_field (eqc->byte_4, -HNS_ROCE_EQC_EQ_ST_M , -HNS_ROCE_EQC_EQ_ST_S , +roce_set_field (eqc->byte_4,HNS_ROCE_EQC_EQ_ST_M ,HNS_ROCE_EQC_EQ_ST_S ,HNS_ROCE_V2_EQ_STATE_VALID );/* set eqe hop num */ -roce_set_field (eqc->byte_4, -HNS_ROCE_EQC_HOP_NUM_M , +roce_set_field (eqc->byte_4,HNS_ROCE_EQC_HOP_NUM_M ,HNS_ROCE_EQC_HOP_NUM_S , eq->hop_num);/* set eqc over_ignore */ -roce_set_field (eqc->byte_4, -HNS_ROCE_EQC_OVER_IGNORE_M , +roce_set_field (eqc->byte_4,HNS_ROCE_EQC_OVER_IGNORE_M ,HNS_ROCE_EQC_OVER_IGNORE_S , eq->over_ignore);/* set eqc coalesce */ -roce_set_field (eqc->byte_4, -HNS_ROCE_EQC_COALESCE_M , +roce_set_field (eqc->byte_4,HNS_ROCE_EQC_COALESCE_M ,HNS_ROCE_EQC_COALESCE_S , eq->coalesce);/* set eqc arm_state */ -roce_set_field (eqc->byte_4, -HNS_ROCE_EQC_ARM_ST_M , +roce_set_field (eqc->byte_4,HNS_ROCE_EQC_ARM_ST_M ,HNS_ROCE_EQC_ARM_ST_S , eq->arm_st);/* set eqn */ -roce_set_field (eqc->byte_4, -HNS_ROCE_EQC_EQN_M , -HNS_ROCE_EQC_EQN_S , eq->eqn); +roce_set_field (eqc->byte_4,HNS_ROCE_EQC_EQN_M ,HNS_ROCE_EQC_EQN_S , + eq->eqn);/* set eqe_cnt */ -roce_set_field (eqc->byte_4, -HNS_ROCE_EQC_EQE_CNT_M , -HNS_ROCE_EQC_EQE_CNT_S , -HNS_ROCE_EQ_INIT_EQE_CNT ); +roce_set_field (eqc->byte_4,HNS_ROCE_EQC_EQE_CNT_M , +HNS_ROCE_EQC_EQE_CNT_S ,HNS_ROCE_EQ_INIT_EQE_CNT );/* set eqe_ba_pg_sz */ -roce_set_field (eqc->byte_8, -HNS_ROCE_EQC_BA_PG_SZ_M , +roce_set_field (eqc->byte_8,HNS_ROCE_EQC_BA_PG_SZ_M ,HNS_ROCE_EQC_BA_PG_SZ_S , eq->eqe_ba_pg_sz +PG_SHIFT_OFFSET );/* set eqe_buf_pg_sz */ -roce_set_field (eqc->byte_8, -HNS_ROCE_EQC_BUF_PG_SZ_M , +roce_set_field (eqc->byte_8,HNS_ROCE_EQC_BUF_PG_SZ_M ,HNS_ROCE_EQC_BUF_PG_SZ_S , eq->eqe_buf_pg_sz +PG_SHIFT_OFFSET );/* set eq_producer_idx */ -roce_set_field (eqc->byte_8, -HNS_ROCE_EQC_PROD_INDX_M , -HNS_ROCE_EQC_PROD_INDX_S , -HNS_ROCE_EQ_INIT_PROD_IDX ); +roce_set_field (eqc->byte_8,HNS_ROCE_EQC_PROD_INDX_M , +HNS_ROCE_EQC_PROD_INDX_S ,HNS_ROCE_EQ_INIT_PROD_IDX );/* set eq_max_cnt */ -roce_set_field (eqc->byte_12, -HNS_ROCE_EQC_MAX_CNT_M , +roce_set_field (eqc->byte_12,HNS_ROCE_EQC_MAX_CNT_M ,HNS_ROCE_EQC_MAX_CNT_S , eq->eq_max_cnt);/* set eq_period */ -roce_set_field (eqc->byte_12, -HNS_ROCE_EQC_PERIOD_M , +roce_set_field (eqc->byte_12,HNS_ROCE_EQC_PERIOD_M ,HNS_ROCE_EQC_PERIOD_S , eq->eq_period);/* set eqe_report_timer */ -roce_set_field (eqc->eqe_report_timer, -HNS_ROCE_EQC_REPORT_TIMER_M , +roce_set_field (eqc->eqe_report_timer,HNS_ROCE_EQC_REPORT_TIMER_M ,HNS_ROCE_EQC_REPORT_TIMER_S ,HNS_ROCE_EQ_INIT_REPORT_TIMER );/* set eqe_ba [34:3] */ -roce_set_field (eqc->eqe_ba0, -HNS_ROCE_EQC_EQE_BA_L_M , +roce_set_field (eqc->eqe_ba0,HNS_ROCE_EQC_EQE_BA_L_M ,HNS_ROCE_EQC_EQE_BA_L_S , eq->eqe_ba >>3 );/* set eqe_ba [64:35] */ -roce_set_field (eqc->eqe_ba1, -HNS_ROCE_EQC_EQE_BA_H_M , +roce_set_field (eqc->eqe_ba1,HNS_ROCE_EQC_EQE_BA_H_M ,HNS_ROCE_EQC_EQE_BA_H_S , eq->eqe_ba >>35 );/* set eq shift */ -roce_set_field (eqc->byte_28, -HNS_ROCE_EQC_SHIFT_M , -HNS_ROCE_EQC_SHIFT_S , eq->shift); +roce_set_field (eqc->byte_28,HNS_ROCE_EQC_SHIFT_M ,HNS_ROCE_EQC_SHIFT_S , + eq->shift);/* set eq MSI_IDX */ -roce_set_field (eqc->byte_28, -HNS_ROCE_EQC_MSI_INDX_M , -HNS_ROCE_EQC_MSI_INDX_S , -HNS_ROCE_EQ_INIT_MSI_IDX ); +roce_set_field (eqc->byte_28,HNS_ROCE_EQC_MSI_INDX_M , +HNS_ROCE_EQC_MSI_INDX_S ,HNS_ROCE_EQ_INIT_MSI_IDX );/* set cur_eqe_ba [27:12] */ -roce_set_field (eqc->byte_28, -HNS_ROCE_EQC_CUR_EQE_BA_L_M , +roce_set_field (eqc->byte_28,HNS_ROCE_EQC_CUR_EQE_BA_L_M ,HNS_ROCE_EQC_CUR_EQE_BA_L_S , eq->cur_eqe_ba >>12 );/* set cur_eqe_ba [59:28] */ -roce_set_field (eqc->byte_32, -HNS_ROCE_EQC_CUR_EQE_BA_M_M , +roce_set_field (eqc->byte_32,HNS_ROCE_EQC_CUR_EQE_BA_M_M ,HNS_ROCE_EQC_CUR_EQE_BA_M_S , eq->cur_eqe_ba >>28 );/* set cur_eqe_ba [63:60] */ -roce_set_field (eqc->byte_36, -HNS_ROCE_EQC_CUR_EQE_BA_H_M , +roce_set_field (eqc->byte_36,HNS_ROCE_EQC_CUR_EQE_BA_H_M ,HNS_ROCE_EQC_CUR_EQE_BA_H_S , eq->cur_eqe_ba >>60 );/* set eq consumer idx */ -roce_set_field (eqc->byte_36, -HNS_ROCE_EQC_CONS_INDX_M , -HNS_ROCE_EQC_CONS_INDX_S , -HNS_ROCE_EQ_INIT_CONS_IDX ); +roce_set_field (eqc->byte_36,HNS_ROCE_EQC_CONS_INDX_M , +HNS_ROCE_EQC_CONS_INDX_S ,HNS_ROCE_EQ_INIT_CONS_IDX );/* set nex_eqe_ba[43:12] */ -roce_set_field (eqc->nxt_eqe_ba0, -HNS_ROCE_EQC_NXT_EQE_BA_L_M , +roce_set_field (eqc->nxt_eqe_ba0,HNS_ROCE_EQC_NXT_EQE_BA_L_M ,HNS_ROCE_EQC_NXT_EQE_BA_L_S , eq->nxt_eqe_ba >>12 );/* set nex_eqe_ba[63:44] */ -roce_set_field (eqc->nxt_eqe_ba1, -HNS_ROCE_EQC_NXT_EQE_BA_H_M , +roce_set_field (eqc->nxt_eqe_ba1,HNS_ROCE_EQC_NXT_EQE_BA_H_M ,HNS_ROCE_EQC_NXT_EQE_BA_H_S , eq->nxt_eqe_ba >>44 ); }
@@ -5825,18 +5778,16 @@ static int __hns_roce_request_irq(struct hns_roce_dev *hr_dev, int irq_num,/* irq contains: abnormal + AEQ + CEQ */ for (j =0 ; j < other_num; j++) -snprintf ((char *)hr_dev->irq_names[j], -HNS_ROCE_INT_NAME_LEN ,"hns-abn-%d" , j); +snprintf ((char *)hr_dev->irq_names[j],HNS_ROCE_INT_NAME_LEN , +"hns-abn-%d" , j);for (j = other_num; j < (other_num + aeq_num); j++) -snprintf ((char *)hr_dev->irq_names[j], -HNS_ROCE_INT_NAME_LEN ,"hns-aeq-%d" , - j - other_num); +snprintf ((char *)hr_dev->irq_names[j],HNS_ROCE_INT_NAME_LEN , +"hns-aeq-%d" , j - other_num);for (j = (other_num + aeq_num); j < irq_num; j++) -snprintf ((char *)hr_dev->irq_names[j], -HNS_ROCE_INT_NAME_LEN ,"hns-ceq-%d" , - j - other_num - aeq_num); +snprintf ((char *)hr_dev->irq_names[j],HNS_ROCE_INT_NAME_LEN , +"hns-ceq-%d" , j - other_num - aeq_num);for (j =0 ; j < irq_num; j++) {if (j < other_num)
drivers/infiniband/hw/hns/hns_roce_main.c +27 -29
132 lines not on this page · raw message
Signature · 1 line
2.8.1
Re: [PATCH for-next 7/7] RDMA/hns: Fix coding style issues
Quoted 5 lines · Weihang Li
From: Lijun Ou <[email protected]>
Fix some coding style issuses without changing logic of codes, most of the modification is unreasonable line breaks and alignments.
Quoted 7 lines
Signed-off-by Lijun Ou <[email protected]>Signed-off-by Lang Cheng <[email protected]>Signed-off-by Weihang Li <[email protected]>--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 167 ++++++++++------------------- drivers/infiniband/hw/hns/hns_roce_main.c | 56 +++++----- 2 files changed, 86 insertions(+), 137 deletions(-)
If you are going to be re-intending code please at least refer to clang-format's presentation. I recommend clang-format as an interactive editor plugin to do single statement reformatting on demand to help follow the coding style.
I ran it over the lines changed here and it suggested the below, which seems like a reasonable improvement so I folded it in:
- One line is better than two
- Subexpressions crossing lines should be indented more than the normal indent. ie
foo(a &
B,
c)- ?: should line up under the ?
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +6 -7
@@ -1366,8 +1366,7 @@ static int hns_roce_query_pf_timer_resource(struct hns_roce_dev *hr_dev)return 0 ; } -static int hns_roce_set_vf_switch_param (struct hns_roce_dev *hr_dev, -int vf_id) +static int hns_roce_set_vf_switch_param (struct hns_roce_dev *hr_dev,int vf_id) {struct hns_roce_cmq_desc desc;struct hns_roce_vf_switch *swt;
@@ -1821,12 +1820,12 @@ static int hns_roce_config_link_table(struct hns_roce_dev *hr_dev,roce_set_field (req_b->tail_ba_h,CFG_LLM_TAIL_BA_H_M ,CFG_LLM_TAIL_BA_H_S , entry[page_num -1 ].blk_ba1_nxt_ptr & -HNS_ROCE_LINK_TABLE_BA1_M ); +HNS_ROCE_LINK_TABLE_BA1_M );roce_set_field (req_b->tail_ptr,CFG_LLM_TAIL_PTR_M ,CFG_LLM_TAIL_PTR_S , (entry[page_num -2 ].blk_ba1_nxt_ptr & -HNS_ROCE_LINK_TABLE_NXT_PTR_M ) >> -HNS_ROCE_LINK_TABLE_NXT_PTR_S ); +HNS_ROCE_LINK_TABLE_NXT_PTR_M ) >> +HNS_ROCE_LINK_TABLE_NXT_PTR_S ); } } roce_set_field(req_a->depth_pgsz_init_en, CFG_LLM_INIT_EN_M,
@@ -2398,8 +2397,8 @@ static int hns_roce_v2_mw_write_mtpt(void *mb_buf, struct hns_roce_mw *mw) V2_MPT_BYTE_4_PD_S, mw->pdn);roce_set_field (mpt_entry->byte_4_pd_hop_st,V2_MPT_BYTE_4_PBL_HOP_NUM_M ,V2_MPT_BYTE_4_PBL_HOP_NUM_S , - mw->pbl_hop_num ==HNS_ROCE_HOP_NUM_0 ? -0 : mw->pbl_hop_num); + mw->pbl_hop_num ==HNS_ROCE_HOP_NUM_0 ?0 : + mw->pbl_hop_num); roce_set_field(mpt_entry->byte_4_pd_hop_st, V2_MPT_BYTE_4_PBL_BA_PG_SZ_M, V2_MPT_BYTE_4_PBL_BA_PG_SZ_S,
drivers/infiniband/hw/hns/hns_roce_main.c +4 -3
@@ -260,10 +260,11 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u8 port_num, mtu =iboe_get_mtu (net_dev->mtu); props->active_mtu = mtu ?min (props->max_mtu, mtu) :IB_MTU_256 ; props->state =netif_running (net_dev) &&netif_carrier_ok (net_dev) ? -IB_PORT_ACTIVE :IB_PORT_DOWN ; +IB_PORT_ACTIVE : +IB_PORT_DOWN ; props->phys_state = props->state ==IB_PORT_ACTIVE ? -IB_PORT_PHYS_STATE_LINK_UP : -IB_PORT_PHYS_STATE_DISABLED ; +IB_PORT_PHYS_STATE_LINK_UP : +IB_PORT_PHYS_STATE_DISABLED ;spin_unlock_irqrestore (&hr_dev->iboe.lock, flags);
Re: [PATCH for-next 7/7] RDMA/hns: Fix coding style issues
Quoted 24 lines · Jason Gunthorpe
Quoted 5 lines · Weihang Li
From: Lijun Ou <[email protected]>
Fix some coding style issuses without changing logic of codes, most of the modification is unreasonable line breaks and alignments.
Quoted 7 lines
Signed-off-by Lijun Ou <[email protected]>Signed-off-by Lang Cheng <[email protected]>Signed-off-by Weihang Li <[email protected]>--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 167 ++++++++++------------------- drivers/infiniband/hw/hns/hns_roce_main.c | 56 +++++----- 2 files changed, 86 insertions(+), 137 deletions(-)If you are going to be re-intending code please at least refer to clang-format's presentation. I recommend clang-format as an interactive editor plugin to do single statement reformatting on demand to help follow the coding style.
I ran it over the lines changed here and it suggested the below, which seems like a reasonable improvement so I folded it in:
- One line is better than two
- Subexpressions crossing lines should be indented more than the normal indent. ie
Quoted 5 lines
foo(a & B, c)- ?: should line up under the ?
Hi Jason,
Thanks for your advice and your modifications on this patch :) We will use clang-format and other tools to help fix coding style issues next time.
Weihang
Jason Gunthorpe
AppliedQuoted 12 lines · Weihang Li
No logic of code was changed by these patches, all of them are tiny cleanups.
By the way, this series has nothing to do with the series I sent a PR to rdma-core recently.
Lijun Ou (4):
RDMA/hns: Remove unused functionhns_roce_init_eq_table()RDMA/hns: Update the value of qp type
RDMA/hns: Delete unnessary parameters inhns_roce_v2_qp_modify()RDMA/hns: Fix coding style issues
Quoted 6 lines
Wenpeng Liang (2):
RDMA/hns: Avoid printing address of mtt page RDMA/hns: Replace custom macrosHNS_ROCE_ALIGN_UPYixing Liu (1):
RDMA/hns: Remove redundant print information
Applied to for-next, thanks
Jason