Skip to content

Commit add5353

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA: Restore ability to return error for destroy WQ
Make this interface symmetrical to other destroy paths. Fixes: a49b1dc ("RDMA: Convert destroy_wq to be void") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent d0c45c8 commit add5353

File tree

9 files changed

+27
-18
lines changed

9 files changed

+27
-18
lines changed

drivers/infiniband/core/uverbs_std_types_wq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static int uverbs_free_wq(struct ib_uobject *uobject,
1616
container_of(uobject, struct ib_uwq_object, uevent.uobject);
1717
int ret;
1818

19-
ret = ib_destroy_wq(wq, &attrs->driver_udata);
19+
ret = ib_destroy_wq_user(wq, &attrs->driver_udata);
2020
if (ib_is_destroy_retryable(ret, why, uobject))
2121
return ret;
2222

drivers/infiniband/core/verbs.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,25 +2399,28 @@ struct ib_wq *ib_create_wq(struct ib_pd *pd,
23992399
EXPORT_SYMBOL(ib_create_wq);
24002400

24012401
/**
2402-
* ib_destroy_wq - Destroys the specified user WQ.
2402+
* ib_destroy_wq_user - Destroys the specified user WQ.
24032403
* @wq: The WQ to destroy.
24042404
* @udata: Valid user data
24052405
*/
2406-
int ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata)
2406+
int ib_destroy_wq_user(struct ib_wq *wq, struct ib_udata *udata)
24072407
{
24082408
struct ib_cq *cq = wq->cq;
24092409
struct ib_pd *pd = wq->pd;
2410+
int ret;
24102411

24112412
if (atomic_read(&wq->usecnt))
24122413
return -EBUSY;
24132414

2414-
wq->device->ops.destroy_wq(wq, udata);
2415+
ret = wq->device->ops.destroy_wq(wq, udata);
2416+
if (ret)
2417+
return ret;
2418+
24152419
atomic_dec(&pd->usecnt);
24162420
atomic_dec(&cq->usecnt);
2417-
2418-
return 0;
2421+
return ret;
24192422
}
2420-
EXPORT_SYMBOL(ib_destroy_wq);
2423+
EXPORT_SYMBOL(ib_destroy_wq_user);
24212424

24222425
/**
24232426
* ib_modify_wq - Modifies the specified WQ.

drivers/infiniband/hw/mlx4/mlx4_ib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ void mlx4_ib_sl2vl_update(struct mlx4_ib_dev *mdev, int port);
899899
struct ib_wq *mlx4_ib_create_wq(struct ib_pd *pd,
900900
struct ib_wq_init_attr *init_attr,
901901
struct ib_udata *udata);
902-
void mlx4_ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata);
902+
int mlx4_ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata);
903903
int mlx4_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr,
904904
u32 wq_attr_mask, struct ib_udata *udata);
905905

drivers/infiniband/hw/mlx4/qp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4327,7 +4327,7 @@ int mlx4_ib_modify_wq(struct ib_wq *ibwq, struct ib_wq_attr *wq_attr,
43274327
return err;
43284328
}
43294329

4330-
void mlx4_ib_destroy_wq(struct ib_wq *ibwq, struct ib_udata *udata)
4330+
int mlx4_ib_destroy_wq(struct ib_wq *ibwq, struct ib_udata *udata)
43314331
{
43324332
struct mlx4_ib_dev *dev = to_mdev(ibwq->device);
43334333
struct mlx4_ib_qp *qp = to_mqp((struct ib_qp *)ibwq);
@@ -4338,6 +4338,7 @@ void mlx4_ib_destroy_wq(struct ib_wq *ibwq, struct ib_udata *udata)
43384338
destroy_qp_common(dev, qp, MLX4_IB_RWQ_SRC, udata);
43394339

43404340
kfree(qp);
4341+
return 0;
43414342
}
43424343

43434344
struct ib_rwq_ind_table

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ int mlx5_ib_check_mr_status(struct ib_mr *ibmr, u32 check_mask,
12411241
struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd,
12421242
struct ib_wq_init_attr *init_attr,
12431243
struct ib_udata *udata);
1244-
void mlx5_ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata);
1244+
int mlx5_ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata);
12451245
int mlx5_ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *wq_attr,
12461246
u32 wq_attr_mask, struct ib_udata *udata);
12471247
struct ib_rwq_ind_table *mlx5_ib_create_rwq_ind_table(struct ib_device *device,

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5085,14 +5085,18 @@ struct ib_wq *mlx5_ib_create_wq(struct ib_pd *pd,
50855085
return ERR_PTR(err);
50865086
}
50875087

5088-
void mlx5_ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata)
5088+
int mlx5_ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata)
50895089
{
50905090
struct mlx5_ib_dev *dev = to_mdev(wq->device);
50915091
struct mlx5_ib_rwq *rwq = to_mrwq(wq);
5092+
int ret;
50925093

5093-
mlx5_core_destroy_rq_tracked(dev, &rwq->core_qp);
5094+
ret = mlx5_core_destroy_rq_tracked(dev, &rwq->core_qp);
5095+
if (ret)
5096+
return ret;
50945097
destroy_user_rq(dev, wq->pd, rwq, udata);
50955098
kfree(rwq);
5099+
return 0;
50965100
}
50975101

50985102
struct ib_rwq_ind_table *mlx5_ib_create_rwq_ind_table(struct ib_device *device,

drivers/infiniband/hw/mlx5/qp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ int mlx5_core_dct_query(struct mlx5_ib_dev *dev, struct mlx5_core_dct *dct,
2626

2727
int mlx5_core_set_delay_drop(struct mlx5_ib_dev *dev, u32 timeout_usec);
2828

29-
void mlx5_core_destroy_rq_tracked(struct mlx5_ib_dev *dev,
30-
struct mlx5_core_qp *rq);
29+
int mlx5_core_destroy_rq_tracked(struct mlx5_ib_dev *dev,
30+
struct mlx5_core_qp *rq);
3131
int mlx5_core_create_sq_tracked(struct mlx5_ib_dev *dev, u32 *in, int inlen,
3232
struct mlx5_core_qp *sq);
3333
void mlx5_core_destroy_sq_tracked(struct mlx5_ib_dev *dev,

drivers/infiniband/hw/mlx5/qpc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,12 @@ int mlx5_core_create_rq_tracked(struct mlx5_ib_dev *dev, u32 *in, int inlen,
576576
return err;
577577
}
578578

579-
void mlx5_core_destroy_rq_tracked(struct mlx5_ib_dev *dev,
580-
struct mlx5_core_qp *rq)
579+
int mlx5_core_destroy_rq_tracked(struct mlx5_ib_dev *dev,
580+
struct mlx5_core_qp *rq)
581581
{
582582
destroy_resource_common(dev, rq);
583583
destroy_rq_tracked(dev, rq->qpn, rq->uid);
584+
return 0;
584585
}
585586

586587
static void destroy_sq_tracked(struct mlx5_ib_dev *dev, u32 sqn, u16 uid)

include/rdma/ib_verbs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,7 +2480,7 @@ struct ib_device_ops {
24802480
struct ib_wq *(*create_wq)(struct ib_pd *pd,
24812481
struct ib_wq_init_attr *init_attr,
24822482
struct ib_udata *udata);
2483-
void (*destroy_wq)(struct ib_wq *wq, struct ib_udata *udata);
2483+
int (*destroy_wq)(struct ib_wq *wq, struct ib_udata *udata);
24842484
int (*modify_wq)(struct ib_wq *wq, struct ib_wq_attr *attr,
24852485
u32 wq_attr_mask, struct ib_udata *udata);
24862486
struct ib_rwq_ind_table *(*create_rwq_ind_table)(
@@ -4316,7 +4316,7 @@ struct net_device *ib_device_netdev(struct ib_device *dev, u8 port);
43164316

43174317
struct ib_wq *ib_create_wq(struct ib_pd *pd,
43184318
struct ib_wq_init_attr *init_attr);
4319-
int ib_destroy_wq(struct ib_wq *wq, struct ib_udata *udata);
4319+
int ib_destroy_wq_user(struct ib_wq *wq, struct ib_udata *udata);
43204320
int ib_modify_wq(struct ib_wq *wq, struct ib_wq_attr *attr,
43214321
u32 wq_attr_mask);
43224322
int ib_destroy_rwq_ind_table(struct ib_rwq_ind_table *wq_ind_table);

0 commit comments

Comments
 (0)