Skip to content

Commit d0c45c8

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA: Change XRCD destroy return value
Update XRCD destroy flow to allow command failure. Fixes: 28ad5f6 ("RDMA: Move XRCD to be under ib_core responsibility") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 43d781b commit d0c45c8

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

drivers/infiniband/core/verbs.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,13 +2345,17 @@ EXPORT_SYMBOL(ib_alloc_xrcd_user);
23452345
*/
23462346
int ib_dealloc_xrcd_user(struct ib_xrcd *xrcd, struct ib_udata *udata)
23472347
{
2348+
int ret;
2349+
23482350
if (atomic_read(&xrcd->usecnt))
23492351
return -EBUSY;
23502352

23512353
WARN_ON(!xa_empty(&xrcd->tgt_qps));
2352-
xrcd->device->ops.dealloc_xrcd(xrcd, udata);
2354+
ret = xrcd->device->ops.dealloc_xrcd(xrcd, udata);
2355+
if (ret)
2356+
return ret;
23532357
kfree(xrcd);
2354-
return 0;
2358+
return ret;
23552359
}
23562360
EXPORT_SYMBOL(ib_dealloc_xrcd_user);
23572361

drivers/infiniband/hw/mlx4/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,11 +1256,12 @@ static int mlx4_ib_alloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata)
12561256
return err;
12571257
}
12581258

1259-
static void mlx4_ib_dealloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata)
1259+
static int mlx4_ib_dealloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata)
12601260
{
12611261
ib_destroy_cq(to_mxrcd(xrcd)->cq);
12621262
ib_dealloc_pd(to_mxrcd(xrcd)->pd);
12631263
mlx4_xrcd_free(to_mdev(xrcd->device)->dev, to_mxrcd(xrcd)->xrcdn);
1264+
return 0;
12641265
}
12651266

12661267
static int add_gid_entry(struct ib_qp *ibqp, union ib_gid *gid)

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
11961196
const struct ib_mad *in, struct ib_mad *out,
11971197
size_t *out_mad_size, u16 *out_mad_pkey_index);
11981198
int mlx5_ib_alloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata);
1199-
void mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata);
1199+
int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata);
12001200
int mlx5_ib_get_buf_offset(u64 addr, int page_shift, u32 *offset);
12011201
int mlx5_query_ext_port_caps(struct mlx5_ib_dev *dev, u8 port);
12021202
int mlx5_query_mad_ifc_smp_attr_node_info(struct ib_device *ibdev,

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4745,12 +4745,12 @@ int mlx5_ib_alloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata)
47454745
return mlx5_cmd_xrcd_alloc(dev->mdev, &xrcd->xrcdn, 0);
47464746
}
47474747

4748-
void mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata)
4748+
int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd, struct ib_udata *udata)
47494749
{
47504750
struct mlx5_ib_dev *dev = to_mdev(xrcd->device);
47514751
u32 xrcdn = to_mxrcd(xrcd)->xrcdn;
47524752

4753-
mlx5_cmd_xrcd_dealloc(dev->mdev, xrcdn, 0);
4753+
return mlx5_cmd_xrcd_dealloc(dev->mdev, xrcdn, 0);
47544754
}
47554755

47564756
static void mlx5_ib_wq_event(struct mlx5_core_qp *core_qp, int type)

include/rdma/ib_verbs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2452,7 +2452,7 @@ struct ib_device_ops {
24522452
int (*attach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid);
24532453
int (*detach_mcast)(struct ib_qp *qp, union ib_gid *gid, u16 lid);
24542454
int (*alloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
2455-
void (*dealloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
2455+
int (*dealloc_xrcd)(struct ib_xrcd *xrcd, struct ib_udata *udata);
24562456
struct ib_flow *(*create_flow)(struct ib_qp *qp,
24572457
struct ib_flow_attr *flow_attr,
24582458
struct ib_udata *udata);

0 commit comments

Comments
 (0)