Commit ed2b5dd0 authored by Bob Pearson's avatar Bob Pearson Committed by Jason Gunthorpe

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.comSigned-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 4e05a4b3
...@@ -114,7 +114,6 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, ...@@ -114,7 +114,6 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr,
int rxe_qp_to_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask); int rxe_qp_to_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask);
void rxe_qp_error(struct rxe_qp *qp); void rxe_qp_error(struct rxe_qp *qp);
int rxe_qp_chk_destroy(struct rxe_qp *qp); int rxe_qp_chk_destroy(struct rxe_qp *qp);
void rxe_qp_destroy(struct rxe_qp *qp);
void rxe_qp_cleanup(struct rxe_pool_elem *elem); void rxe_qp_cleanup(struct rxe_pool_elem *elem);
static inline int qp_num(struct rxe_qp *qp) static inline int qp_num(struct rxe_qp *qp)
......
...@@ -765,9 +765,11 @@ int rxe_qp_chk_destroy(struct rxe_qp *qp) ...@@ -765,9 +765,11 @@ int rxe_qp_chk_destroy(struct rxe_qp *qp)
return 0; return 0;
} }
/* called by the destroy qp verb */ /* called when the last reference to the qp is dropped */
void rxe_qp_destroy(struct rxe_qp *qp) static void rxe_qp_do_cleanup(struct work_struct *work)
{ {
struct rxe_qp *qp = container_of(work, typeof(*qp), cleanup_work.work);
qp->valid = 0; qp->valid = 0;
qp->qp_timeout_jiffies = 0; qp->qp_timeout_jiffies = 0;
rxe_cleanup_task(&qp->resp.task); rxe_cleanup_task(&qp->resp.task);
...@@ -786,12 +788,6 @@ void rxe_qp_destroy(struct rxe_qp *qp) ...@@ -786,12 +788,6 @@ void rxe_qp_destroy(struct rxe_qp *qp)
__rxe_do_task(&qp->comp.task); __rxe_do_task(&qp->comp.task);
__rxe_do_task(&qp->req.task); __rxe_do_task(&qp->req.task);
} }
}
/* called when the last reference to the qp is dropped */
static void rxe_qp_do_cleanup(struct work_struct *work)
{
struct rxe_qp *qp = container_of(work, typeof(*qp), cleanup_work.work);
if (qp->sq.queue) if (qp->sq.queue)
rxe_queue_cleanup(qp->sq.queue); rxe_queue_cleanup(qp->sq.queue);
......
...@@ -485,7 +485,6 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) ...@@ -485,7 +485,6 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
if (ret) if (ret)
return ret; return ret;
rxe_qp_destroy(qp);
rxe_put(qp); rxe_put(qp);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment