Skip to content

Commit ed2b5dd

Browse files
rpearsonhpe-designjgunthorpe
authored andcommitted
RDMA/rxe: Move qp cleanup code to rxe_qp_do_cleanup()
Move the code from rxe_qp_destroy() to rxe_qp_do_cleanup(). This allows flows holding references to qp to complete before the qp object is torn down. Link: https://lore.kernel.org/r/20220421014042.26985-5-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 4e05a4b commit ed2b5dd

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

drivers/infiniband/sw/rxe/rxe_loc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr,
114114
int rxe_qp_to_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask);
115115
void rxe_qp_error(struct rxe_qp *qp);
116116
int rxe_qp_chk_destroy(struct rxe_qp *qp);
117-
void rxe_qp_destroy(struct rxe_qp *qp);
118117
void rxe_qp_cleanup(struct rxe_pool_elem *elem);
119118

120119
static inline int qp_num(struct rxe_qp *qp)

drivers/infiniband/sw/rxe/rxe_qp.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,11 @@ int rxe_qp_chk_destroy(struct rxe_qp *qp)
765765
return 0;
766766
}
767767

768-
/* called by the destroy qp verb */
769-
void rxe_qp_destroy(struct rxe_qp *qp)
768+
/* called when the last reference to the qp is dropped */
769+
static void rxe_qp_do_cleanup(struct work_struct *work)
770770
{
771+
struct rxe_qp *qp = container_of(work, typeof(*qp), cleanup_work.work);
772+
771773
qp->valid = 0;
772774
qp->qp_timeout_jiffies = 0;
773775
rxe_cleanup_task(&qp->resp.task);
@@ -786,12 +788,6 @@ void rxe_qp_destroy(struct rxe_qp *qp)
786788
__rxe_do_task(&qp->comp.task);
787789
__rxe_do_task(&qp->req.task);
788790
}
789-
}
790-
791-
/* called when the last reference to the qp is dropped */
792-
static void rxe_qp_do_cleanup(struct work_struct *work)
793-
{
794-
struct rxe_qp *qp = container_of(work, typeof(*qp), cleanup_work.work);
795791

796792
if (qp->sq.queue)
797793
rxe_queue_cleanup(qp->sq.queue);

drivers/infiniband/sw/rxe/rxe_verbs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
485485
if (ret)
486486
return ret;
487487

488-
rxe_qp_destroy(qp);
489488
rxe_put(qp);
490489
return 0;
491490
}

0 commit comments

Comments
 (0)