Skip to content

Commit 6b227bd

Browse files
Sindhu-Devalerleon
authored andcommitted
RDMA/irdma: Return error on MR deregister CQP failure
The MR deregister CQP can fail if an MW is bound to it. Return an appropriate error for this case. Fixes: b48c24c ("RDMA/irdma: Implement device supported verb APIs") Signed-off-by: Sindhu-Devale <[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 12faad5 commit 6b227bd

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

drivers/infiniband/hw/irdma/utils.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,14 @@ static int irdma_wait_event(struct irdma_pci_f *rf,
590590
cqp_error = cqp_request->compl_info.error;
591591
if (cqp_error) {
592592
err_code = -EIO;
593-
if (cqp_request->compl_info.maj_err_code == 0xFFFF &&
594-
cqp_request->compl_info.min_err_code == 0x8029) {
595-
if (!rf->reset) {
596-
rf->reset = true;
597-
rf->gen_ops.request_reset(rf);
593+
if (cqp_request->compl_info.maj_err_code == 0xFFFF) {
594+
if (cqp_request->compl_info.min_err_code == 0x8002)
595+
err_code = -EBUSY;
596+
else if (cqp_request->compl_info.min_err_code == 0x8029) {
597+
if (!rf->reset) {
598+
rf->reset = true;
599+
rf->gen_ops.request_reset(rf);
600+
}
598601
}
599602
}
600603
}

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,7 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata)
30093009
struct irdma_pble_alloc *palloc = &iwpbl->pble_alloc;
30103010
struct irdma_cqp_request *cqp_request;
30113011
struct cqp_cmds_info *cqp_info;
3012+
int status;
30123013

30133014
if (iwmr->type != IRDMA_MEMREG_TYPE_MEM) {
30143015
if (iwmr->region) {
@@ -3039,8 +3040,11 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata)
30393040
cqp_info->post_sq = 1;
30403041
cqp_info->in.u.dealloc_stag.dev = &iwdev->rf->sc_dev;
30413042
cqp_info->in.u.dealloc_stag.scratch = (uintptr_t)cqp_request;
3042-
irdma_handle_cqp_op(iwdev->rf, cqp_request);
3043+
status = irdma_handle_cqp_op(iwdev->rf, cqp_request);
30433044
irdma_put_cqp_request(&iwdev->rf->cqp, cqp_request);
3045+
if (status)
3046+
return status;
3047+
30443048
irdma_free_stag(iwdev, iwmr->stag);
30453049
done:
30463050
if (iwpbl->pbl_allocated)

0 commit comments

Comments
 (0)