Skip to content

Commit 295c95a

Browse files
shirazsaleemrleon
authored andcommitted
RDMA/irdma: Drop unused kernel push code
The driver has code blocks for kernel push WQEs but does not map the doorbell page rendering this mode non functional [1] Remove code associated with this feature from the kernel fast path as there is currently no plan of record to support this. This also address a sparse issue reported by lkp. drivers/infiniband/hw/irdma/uk.c:285:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected bool [usertype] push_wqe:1 @@ got restricted __le32 [usertype] *push_db @@ drivers/infiniband/hw/irdma/uk.c:285:24: sparse: expected bool [usertype] push_wqe:1 drivers/infiniband/hw/irdma/uk.c:285:24: sparse: got restricted __le32 [usertype] *push_db drivers/infiniband/hw/irdma/uk.c:386:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected bool [usertype] push_wqe:1 @@ got restricted __le32 [usertype] *push_db @@ [1] https://lore.kernel.org/linux-rdma/20230815051809.GB22185@unreal/T/#t Fixes: 272bba1 ("RDMA: Remove unnecessary ternary operators") Fixes: 551c46e ("RDMA/irdma: Add user/kernel shared libraries") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Shiraz Saleem <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 0a30e59 commit 295c95a

File tree

4 files changed

+19
-119
lines changed

4 files changed

+19
-119
lines changed

drivers/infiniband/hw/irdma/ctrl.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,6 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp,
13011301

13021302
sq_info.wr_id = info->wr_id;
13031303
sq_info.signaled = info->signaled;
1304-
sq_info.push_wqe = info->push_wqe;
13051304

13061305
wqe = irdma_qp_get_next_send_wqe(&qp->qp_uk, &wqe_idx,
13071306
IRDMA_QP_WQE_MIN_QUANTA, 0, &sq_info);
@@ -1335,7 +1334,6 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp,
13351334
FIELD_PREP(IRDMAQPSQ_HPAGESIZE, page_size) |
13361335
FIELD_PREP(IRDMAQPSQ_STAGRIGHTS, info->access_rights) |
13371336
FIELD_PREP(IRDMAQPSQ_VABASEDTO, info->addr_type) |
1338-
FIELD_PREP(IRDMAQPSQ_PUSHWQE, (sq_info.push_wqe ? 1 : 0)) |
13391337
FIELD_PREP(IRDMAQPSQ_READFENCE, info->read_fence) |
13401338
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, info->local_fence) |
13411339
FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) |
@@ -1346,13 +1344,9 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp,
13461344

13471345
print_hex_dump_debug("WQE: FAST_REG WQE", DUMP_PREFIX_OFFSET, 16, 8,
13481346
wqe, IRDMA_QP_WQE_MIN_SIZE, false);
1349-
if (sq_info.push_wqe) {
1350-
irdma_qp_push_wqe(&qp->qp_uk, wqe, IRDMA_QP_WQE_MIN_QUANTA,
1351-
wqe_idx, post_sq);
1352-
} else {
1353-
if (post_sq)
1354-
irdma_uk_qp_post_wr(&qp->qp_uk);
1355-
}
1347+
1348+
if (post_sq)
1349+
irdma_uk_qp_post_wr(&qp->qp_uk);
13561350

13571351
return 0;
13581352
}

drivers/infiniband/hw/irdma/type.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,6 @@ struct irdma_fast_reg_stag_info {
10151015
bool local_fence:1;
10161016
bool read_fence:1;
10171017
bool signaled:1;
1018-
bool push_wqe:1;
10191018
bool use_hmc_fcn_index:1;
10201019
u8 hmc_fcn_index;
10211020
bool use_pf_rid:1;

drivers/infiniband/hw/irdma/uk.c

Lines changed: 16 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ void irdma_uk_qp_post_wr(struct irdma_qp_uk *qp)
127127
hw_sq_tail = (u32)FIELD_GET(IRDMA_QP_DBSA_HW_SQ_TAIL, temp);
128128
sw_sq_head = IRDMA_RING_CURRENT_HEAD(qp->sq_ring);
129129
if (sw_sq_head != qp->initial_ring.head) {
130-
if (qp->push_dropped) {
131-
writel(qp->qp_id, qp->wqe_alloc_db);
132-
qp->push_dropped = false;
133-
} else if (sw_sq_head != hw_sq_tail) {
130+
if (sw_sq_head != hw_sq_tail) {
134131
if (sw_sq_head > qp->initial_ring.head) {
135132
if (hw_sq_tail >= qp->initial_ring.head &&
136133
hw_sq_tail < sw_sq_head)
@@ -146,38 +143,6 @@ void irdma_uk_qp_post_wr(struct irdma_qp_uk *qp)
146143
qp->initial_ring.head = qp->sq_ring.head;
147144
}
148145

149-
/**
150-
* irdma_qp_ring_push_db - ring qp doorbell
151-
* @qp: hw qp ptr
152-
* @wqe_idx: wqe index
153-
*/
154-
static void irdma_qp_ring_push_db(struct irdma_qp_uk *qp, u32 wqe_idx)
155-
{
156-
set_32bit_val(qp->push_db, 0,
157-
FIELD_PREP(IRDMA_WQEALLOC_WQE_DESC_INDEX, wqe_idx >> 3) | qp->qp_id);
158-
qp->initial_ring.head = qp->sq_ring.head;
159-
qp->push_mode = true;
160-
qp->push_dropped = false;
161-
}
162-
163-
void irdma_qp_push_wqe(struct irdma_qp_uk *qp, __le64 *wqe, u16 quanta,
164-
u32 wqe_idx, bool post_sq)
165-
{
166-
__le64 *push;
167-
168-
if (IRDMA_RING_CURRENT_HEAD(qp->initial_ring) !=
169-
IRDMA_RING_CURRENT_TAIL(qp->sq_ring) &&
170-
!qp->push_mode) {
171-
if (post_sq)
172-
irdma_uk_qp_post_wr(qp);
173-
} else {
174-
push = (__le64 *)((uintptr_t)qp->push_wqe +
175-
(wqe_idx & 0x7) * 0x20);
176-
memcpy(push, wqe, quanta * IRDMA_QP_WQE_MIN_SIZE);
177-
irdma_qp_ring_push_db(qp, wqe_idx);
178-
}
179-
}
180-
181146
/**
182147
* irdma_qp_get_next_send_wqe - pad with NOP if needed, return where next WR should go
183148
* @qp: hw qp ptr
@@ -192,7 +157,6 @@ __le64 *irdma_qp_get_next_send_wqe(struct irdma_qp_uk *qp, u32 *wqe_idx,
192157
{
193158
__le64 *wqe;
194159
__le64 *wqe_0 = NULL;
195-
u32 nop_wqe_idx;
196160
u16 avail_quanta;
197161
u16 i;
198162

@@ -209,14 +173,10 @@ __le64 *irdma_qp_get_next_send_wqe(struct irdma_qp_uk *qp, u32 *wqe_idx,
209173
IRDMA_SQ_RING_FREE_QUANTA(qp->sq_ring))
210174
return NULL;
211175

212-
nop_wqe_idx = IRDMA_RING_CURRENT_HEAD(qp->sq_ring);
213176
for (i = 0; i < avail_quanta; i++) {
214177
irdma_nop_1(qp);
215178
IRDMA_RING_MOVE_HEAD_NOCHECK(qp->sq_ring);
216179
}
217-
if (qp->push_db && info->push_wqe)
218-
irdma_qp_push_wqe(qp, qp->sq_base[nop_wqe_idx].elem,
219-
avail_quanta, nop_wqe_idx, true);
220180
}
221181

222182
*wqe_idx = IRDMA_RING_CURRENT_HEAD(qp->sq_ring);
@@ -282,8 +242,6 @@ int irdma_uk_rdma_write(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
282242
bool read_fence = false;
283243
u16 quanta;
284244

285-
info->push_wqe = qp->push_db;
286-
287245
op_info = &info->op.rdma_write;
288246
if (op_info->num_lo_sges > qp->max_sq_frag_cnt)
289247
return -EINVAL;
@@ -344,7 +302,6 @@ int irdma_uk_rdma_write(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
344302
FIELD_PREP(IRDMAQPSQ_IMMDATAFLAG, info->imm_data_valid) |
345303
FIELD_PREP(IRDMAQPSQ_REPORTRTT, info->report_rtt) |
346304
FIELD_PREP(IRDMAQPSQ_ADDFRAGCNT, addl_frag_cnt) |
347-
FIELD_PREP(IRDMAQPSQ_PUSHWQE, info->push_wqe) |
348305
FIELD_PREP(IRDMAQPSQ_READFENCE, read_fence) |
349306
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, info->local_fence) |
350307
FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) |
@@ -353,12 +310,9 @@ int irdma_uk_rdma_write(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
353310
dma_wmb(); /* make sure WQE is populated before valid bit is set */
354311

355312
set_64bit_val(wqe, 24, hdr);
356-
if (info->push_wqe) {
357-
irdma_qp_push_wqe(qp, wqe, quanta, wqe_idx, post_sq);
358-
} else {
359-
if (post_sq)
360-
irdma_uk_qp_post_wr(qp);
361-
}
313+
314+
if (post_sq)
315+
irdma_uk_qp_post_wr(qp);
362316

363317
return 0;
364318
}
@@ -383,8 +337,6 @@ int irdma_uk_rdma_read(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
383337
u16 quanta;
384338
u64 hdr;
385339

386-
info->push_wqe = qp->push_db;
387-
388340
op_info = &info->op.rdma_read;
389341
if (qp->max_sq_frag_cnt < op_info->num_lo_sges)
390342
return -EINVAL;
@@ -431,7 +383,6 @@ int irdma_uk_rdma_read(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
431383
FIELD_PREP(IRDMAQPSQ_ADDFRAGCNT, addl_frag_cnt) |
432384
FIELD_PREP(IRDMAQPSQ_OPCODE,
433385
(inv_stag ? IRDMAQP_OP_RDMA_READ_LOC_INV : IRDMAQP_OP_RDMA_READ)) |
434-
FIELD_PREP(IRDMAQPSQ_PUSHWQE, info->push_wqe) |
435386
FIELD_PREP(IRDMAQPSQ_READFENCE, info->read_fence) |
436387
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, local_fence) |
437388
FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) |
@@ -440,12 +391,9 @@ int irdma_uk_rdma_read(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
440391
dma_wmb(); /* make sure WQE is populated before valid bit is set */
441392

442393
set_64bit_val(wqe, 24, hdr);
443-
if (info->push_wqe) {
444-
irdma_qp_push_wqe(qp, wqe, quanta, wqe_idx, post_sq);
445-
} else {
446-
if (post_sq)
447-
irdma_uk_qp_post_wr(qp);
448-
}
394+
395+
if (post_sq)
396+
irdma_uk_qp_post_wr(qp);
449397

450398
return 0;
451399
}
@@ -468,8 +416,6 @@ int irdma_uk_send(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
468416
bool read_fence = false;
469417
u16 quanta;
470418

471-
info->push_wqe = qp->push_db;
472-
473419
op_info = &info->op.send;
474420
if (qp->max_sq_frag_cnt < op_info->num_sges)
475421
return -EINVAL;
@@ -530,7 +476,6 @@ int irdma_uk_send(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
530476
FIELD_PREP(IRDMAQPSQ_REPORTRTT, (info->report_rtt ? 1 : 0)) |
531477
FIELD_PREP(IRDMAQPSQ_OPCODE, info->op_type) |
532478
FIELD_PREP(IRDMAQPSQ_ADDFRAGCNT, addl_frag_cnt) |
533-
FIELD_PREP(IRDMAQPSQ_PUSHWQE, info->push_wqe) |
534479
FIELD_PREP(IRDMAQPSQ_READFENCE, read_fence) |
535480
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, info->local_fence) |
536481
FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) |
@@ -541,12 +486,9 @@ int irdma_uk_send(struct irdma_qp_uk *qp, struct irdma_post_sq_info *info,
541486
dma_wmb(); /* make sure WQE is populated before valid bit is set */
542487

543488
set_64bit_val(wqe, 24, hdr);
544-
if (info->push_wqe) {
545-
irdma_qp_push_wqe(qp, wqe, quanta, wqe_idx, post_sq);
546-
} else {
547-
if (post_sq)
548-
irdma_uk_qp_post_wr(qp);
549-
}
489+
490+
if (post_sq)
491+
irdma_uk_qp_post_wr(qp);
550492

551493
return 0;
552494
}
@@ -720,7 +662,6 @@ int irdma_uk_inline_rdma_write(struct irdma_qp_uk *qp,
720662
u32 i, total_size = 0;
721663
u16 quanta;
722664

723-
info->push_wqe = qp->push_db;
724665
op_info = &info->op.rdma_write;
725666

726667
if (unlikely(qp->max_sq_frag_cnt < op_info->num_lo_sges))
@@ -750,7 +691,6 @@ int irdma_uk_inline_rdma_write(struct irdma_qp_uk *qp,
750691
FIELD_PREP(IRDMAQPSQ_REPORTRTT, info->report_rtt ? 1 : 0) |
751692
FIELD_PREP(IRDMAQPSQ_INLINEDATAFLAG, 1) |
752693
FIELD_PREP(IRDMAQPSQ_IMMDATAFLAG, info->imm_data_valid ? 1 : 0) |
753-
FIELD_PREP(IRDMAQPSQ_PUSHWQE, info->push_wqe ? 1 : 0) |
754694
FIELD_PREP(IRDMAQPSQ_READFENCE, read_fence) |
755695
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, info->local_fence) |
756696
FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) |
@@ -767,12 +707,8 @@ int irdma_uk_inline_rdma_write(struct irdma_qp_uk *qp,
767707

768708
set_64bit_val(wqe, 24, hdr);
769709

770-
if (info->push_wqe) {
771-
irdma_qp_push_wqe(qp, wqe, quanta, wqe_idx, post_sq);
772-
} else {
773-
if (post_sq)
774-
irdma_uk_qp_post_wr(qp);
775-
}
710+
if (post_sq)
711+
irdma_uk_qp_post_wr(qp);
776712

777713
return 0;
778714
}
@@ -794,7 +730,6 @@ int irdma_uk_inline_send(struct irdma_qp_uk *qp,
794730
u32 i, total_size = 0;
795731
u16 quanta;
796732

797-
info->push_wqe = qp->push_db;
798733
op_info = &info->op.send;
799734

800735
if (unlikely(qp->max_sq_frag_cnt < op_info->num_sges))
@@ -827,7 +762,6 @@ int irdma_uk_inline_send(struct irdma_qp_uk *qp,
827762
(info->imm_data_valid ? 1 : 0)) |
828763
FIELD_PREP(IRDMAQPSQ_REPORTRTT, (info->report_rtt ? 1 : 0)) |
829764
FIELD_PREP(IRDMAQPSQ_INLINEDATAFLAG, 1) |
830-
FIELD_PREP(IRDMAQPSQ_PUSHWQE, info->push_wqe) |
831765
FIELD_PREP(IRDMAQPSQ_READFENCE, read_fence) |
832766
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, info->local_fence) |
833767
FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) |
@@ -845,12 +779,8 @@ int irdma_uk_inline_send(struct irdma_qp_uk *qp,
845779

846780
set_64bit_val(wqe, 24, hdr);
847781

848-
if (info->push_wqe) {
849-
irdma_qp_push_wqe(qp, wqe, quanta, wqe_idx, post_sq);
850-
} else {
851-
if (post_sq)
852-
irdma_uk_qp_post_wr(qp);
853-
}
782+
if (post_sq)
783+
irdma_uk_qp_post_wr(qp);
854784

855785
return 0;
856786
}
@@ -872,7 +802,6 @@ int irdma_uk_stag_local_invalidate(struct irdma_qp_uk *qp,
872802
bool local_fence = false;
873803
struct ib_sge sge = {};
874804

875-
info->push_wqe = qp->push_db;
876805
op_info = &info->op.inv_local_stag;
877806
local_fence = info->local_fence;
878807

@@ -889,7 +818,6 @@ int irdma_uk_stag_local_invalidate(struct irdma_qp_uk *qp,
889818
set_64bit_val(wqe, 16, 0);
890819

891820
hdr = FIELD_PREP(IRDMAQPSQ_OPCODE, IRDMA_OP_TYPE_INV_STAG) |
892-
FIELD_PREP(IRDMAQPSQ_PUSHWQE, info->push_wqe) |
893821
FIELD_PREP(IRDMAQPSQ_READFENCE, info->read_fence) |
894822
FIELD_PREP(IRDMAQPSQ_LOCALFENCE, local_fence) |
895823
FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) |
@@ -899,13 +827,8 @@ int irdma_uk_stag_local_invalidate(struct irdma_qp_uk *qp,
899827

900828
set_64bit_val(wqe, 24, hdr);
901829

902-
if (info->push_wqe) {
903-
irdma_qp_push_wqe(qp, wqe, IRDMA_QP_WQE_MIN_QUANTA, wqe_idx,
904-
post_sq);
905-
} else {
906-
if (post_sq)
907-
irdma_uk_qp_post_wr(qp);
908-
}
830+
if (post_sq)
831+
irdma_uk_qp_post_wr(qp);
909832

910833
return 0;
911834
}
@@ -1124,7 +1047,6 @@ int irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq,
11241047

11251048
info->q_type = (u8)FIELD_GET(IRDMA_CQ_SQ, qword3);
11261049
info->error = (bool)FIELD_GET(IRDMA_CQ_ERROR, qword3);
1127-
info->push_dropped = (bool)FIELD_GET(IRDMACQ_PSHDROP, qword3);
11281050
info->ipv4 = (bool)FIELD_GET(IRDMACQ_IPV4, qword3);
11291051
if (info->error) {
11301052
info->major_err = FIELD_GET(IRDMA_CQ_MAJERR, qword3);
@@ -1213,11 +1135,6 @@ int irdma_uk_cq_poll_cmpl(struct irdma_cq_uk *cq,
12131135
return irdma_uk_cq_poll_cmpl(cq, info);
12141136
}
12151137
}
1216-
/*cease posting push mode on push drop*/
1217-
if (info->push_dropped) {
1218-
qp->push_mode = false;
1219-
qp->push_dropped = true;
1220-
}
12211138
if (info->comp_status != IRDMA_COMPL_STATUS_FLUSHED) {
12221139
info->wr_id = qp->sq_wrtrk_array[wqe_idx].wrid;
12231140
if (!info->comp_status)
@@ -1521,7 +1438,6 @@ int irdma_uk_qp_init(struct irdma_qp_uk *qp, struct irdma_qp_uk_init_info *info)
15211438
qp->wqe_alloc_db = info->wqe_alloc_db;
15221439
qp->qp_id = info->qp_id;
15231440
qp->sq_size = info->sq_size;
1524-
qp->push_mode = false;
15251441
qp->max_sq_frag_cnt = info->max_sq_frag_cnt;
15261442
sq_ring_size = qp->sq_size << info->sq_shift;
15271443
IRDMA_RING_INIT(qp->sq_ring, sq_ring_size);
@@ -1616,7 +1532,6 @@ int irdma_nop(struct irdma_qp_uk *qp, u64 wr_id, bool signaled, bool post_sq)
16161532
u32 wqe_idx;
16171533
struct irdma_post_sq_info info = {};
16181534

1619-
info.push_wqe = false;
16201535
info.wr_id = wr_id;
16211536
wqe = irdma_qp_get_next_send_wqe(qp, &wqe_idx, IRDMA_QP_WQE_MIN_QUANTA,
16221537
0, &info);

drivers/infiniband/hw/irdma/user.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ struct irdma_post_sq_info {
216216
bool local_fence:1;
217217
bool inline_data:1;
218218
bool imm_data_valid:1;
219-
bool push_wqe:1;
220219
bool report_rtt:1;
221220
bool udp_hdr:1;
222221
bool defer_flag:1;
@@ -248,7 +247,6 @@ struct irdma_cq_poll_info {
248247
u8 op_type;
249248
u8 q_type;
250249
bool stag_invalid_set:1; /* or L_R_Key set */
251-
bool push_dropped:1;
252250
bool error:1;
253251
bool solicited_event:1;
254252
bool ipv4:1;
@@ -321,8 +319,6 @@ struct irdma_qp_uk {
321319
struct irdma_sq_uk_wr_trk_info *sq_wrtrk_array;
322320
u64 *rq_wrid_array;
323321
__le64 *shadow_area;
324-
__le32 *push_db;
325-
__le64 *push_wqe;
326322
struct irdma_ring sq_ring;
327323
struct irdma_ring rq_ring;
328324
struct irdma_ring initial_ring;
@@ -342,8 +338,6 @@ struct irdma_qp_uk {
342338
u8 rq_wqe_size;
343339
u8 rq_wqe_size_multiplier;
344340
bool deferred_flag:1;
345-
bool push_mode:1; /* whether the last post wqe was pushed */
346-
bool push_dropped:1;
347341
bool first_sq_wq:1;
348342
bool sq_flush_complete:1; /* Indicates flush was seen and SQ was empty after the flush */
349343
bool rq_flush_complete:1; /* Indicates flush was seen and RQ was empty after the flush */
@@ -415,7 +409,5 @@ int irdma_get_sqdepth(struct irdma_uk_attrs *uk_attrs, u32 sq_size, u8 shift,
415409
u32 *wqdepth);
416410
int irdma_get_rqdepth(struct irdma_uk_attrs *uk_attrs, u32 rq_size, u8 shift,
417411
u32 *wqdepth);
418-
void irdma_qp_push_wqe(struct irdma_qp_uk *qp, __le64 *wqe, u16 quanta,
419-
u32 wqe_idx, bool post_sq);
420412
void irdma_clr_wqes(struct irdma_qp_uk *qp, u32 qp_wqe_idx);
421413
#endif /* IRDMA_USER_H */

0 commit comments

Comments
 (0)