Skip to content

Commit eaaa98d

Browse files
Weihang Lijgunthorpe
authored andcommitted
RDMA/hns: Remove redundant parameters in set_rc_wqe()
There are some functions called by set_rc_wqe() use two parameters: "void *wqe" and "struct hns_roce_v2_rc_send_wqe *rc_sq_wqe", but the first one can be got from the second one. So remove the redundant wqe from related functions. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Weihang Li <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent a247fd2 commit eaaa98d

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ static u32 to_hr_opcode(u32 ib_opcode)
9191
}
9292

9393
static void set_frmr_seg(struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
94-
void *wqe, const struct ib_reg_wr *wr)
94+
const struct ib_reg_wr *wr)
9595
{
96+
struct hns_roce_wqe_frmr_seg *fseg =
97+
(void *)rc_sq_wqe + sizeof(struct hns_roce_v2_rc_send_wqe);
9698
struct hns_roce_mr *mr = to_hr_mr(wr->mr);
97-
struct hns_roce_wqe_frmr_seg *fseg = wqe;
9899
u64 pbl_ba;
99100

100101
/* use ib_access_flags */
@@ -128,22 +129,24 @@ static void set_frmr_seg(struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
128129
V2_RC_FRMR_WQE_BYTE_40_BLK_MODE_S, 0);
129130
}
130131

131-
static void set_atomic_seg(const struct ib_send_wr *wr, void *wqe,
132+
static void set_atomic_seg(const struct ib_send_wr *wr,
132133
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
133134
unsigned int valid_num_sge)
134135
{
135-
struct hns_roce_wqe_atomic_seg *aseg;
136+
struct hns_roce_v2_wqe_data_seg *dseg =
137+
(void *)rc_sq_wqe + sizeof(struct hns_roce_v2_rc_send_wqe);
138+
struct hns_roce_wqe_atomic_seg *aseg =
139+
(void *)dseg + sizeof(struct hns_roce_v2_wqe_data_seg);
136140

137-
set_data_seg_v2(wqe, wr->sg_list);
138-
aseg = wqe + sizeof(struct hns_roce_v2_wqe_data_seg);
141+
set_data_seg_v2(dseg, wr->sg_list);
139142

140143
if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP) {
141144
aseg->fetchadd_swap_data = cpu_to_le64(atomic_wr(wr)->swap);
142145
aseg->cmp_data = cpu_to_le64(atomic_wr(wr)->compare_add);
143146
} else {
144147
aseg->fetchadd_swap_data =
145148
cpu_to_le64(atomic_wr(wr)->compare_add);
146-
aseg->cmp_data = 0;
149+
aseg->cmp_data = 0;
147150
}
148151

149152
roce_set_field(rc_sq_wqe->byte_16, V2_RC_SEND_WQE_BYTE_16_SGE_NUM_M,
@@ -176,13 +179,15 @@ static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
176179

177180
static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
178181
struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
179-
void *wqe, unsigned int *sge_ind,
182+
unsigned int *sge_ind,
180183
unsigned int valid_num_sge)
181184
{
182185
struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
183-
struct hns_roce_v2_wqe_data_seg *dseg = wqe;
186+
struct hns_roce_v2_wqe_data_seg *dseg =
187+
(void *)rc_sq_wqe + sizeof(struct hns_roce_v2_rc_send_wqe);
184188
struct ib_device *ibdev = &hr_dev->ib_dev;
185189
struct hns_roce_qp *qp = to_hr_qp(ibqp);
190+
void *wqe = dseg;
186191
int j = 0;
187192
int i;
188193

@@ -438,7 +443,6 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
438443
roce_set_bit(rc_sq_wqe->byte_4, V2_RC_SEND_WQE_BYTE_4_OWNER_S,
439444
owner_bit);
440445

441-
wqe += sizeof(struct hns_roce_v2_rc_send_wqe);
442446
switch (wr->opcode) {
443447
case IB_WR_RDMA_READ:
444448
case IB_WR_RDMA_WRITE:
@@ -451,7 +455,7 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
451455
rc_sq_wqe->inv_key = cpu_to_le32(wr->ex.invalidate_rkey);
452456
break;
453457
case IB_WR_REG_MR:
454-
set_frmr_seg(rc_sq_wqe, wqe, reg_wr(wr));
458+
set_frmr_seg(rc_sq_wqe, reg_wr(wr));
455459
break;
456460
case IB_WR_ATOMIC_CMP_AND_SWP:
457461
case IB_WR_ATOMIC_FETCH_AND_ADD:
@@ -468,10 +472,10 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
468472

469473
if (wr->opcode == IB_WR_ATOMIC_CMP_AND_SWP ||
470474
wr->opcode == IB_WR_ATOMIC_FETCH_AND_ADD)
471-
set_atomic_seg(wr, wqe, rc_sq_wqe, valid_num_sge);
475+
set_atomic_seg(wr, rc_sq_wqe, valid_num_sge);
472476
else if (wr->opcode != IB_WR_REG_MR)
473477
ret = set_rwqe_data_seg(&qp->ibqp, wr, rc_sq_wqe,
474-
wqe, &curr_idx, valid_num_sge);
478+
&curr_idx, valid_num_sge);
475479

476480
*sge_idx = curr_idx;
477481

0 commit comments

Comments
 (0)