lkml.org 
[lkml]   [2022]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH for-next 1/9] RDMA/core: get rid of create_user_ah
Date
The two members create_user_ah and create_ah in struct ib_device_ops
are very similar. we can use create_ah for all case. so get rid of
create_user_ah.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
drivers/infiniband/core/device.c | 1 -
drivers/infiniband/core/uverbs_cmd.c | 2 +-
drivers/infiniband/core/verbs.c | 7 ++-----
include/rdma/ib_verbs.h | 2 --
4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index a311df07b1bd..9a473d855b3a 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2617,7 +2617,6 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
SET_DEVICE_OP(dev_ops, create_qp);
SET_DEVICE_OP(dev_ops, create_rwq_ind_table);
SET_DEVICE_OP(dev_ops, create_srq);
- SET_DEVICE_OP(dev_ops, create_user_ah);
SET_DEVICE_OP(dev_ops, create_wq);
SET_DEVICE_OP(dev_ops, dealloc_dm);
SET_DEVICE_OP(dev_ops, dealloc_driver);
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 4437f834c0a7..fb0733e233f9 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3724,7 +3724,7 @@ const struct uapi_definition uverbs_def_write_intf[] = {
IB_USER_VERBS_CMD_DESTROY_AH,
ib_uverbs_destroy_ah,
UAPI_DEF_WRITE_I(struct ib_uverbs_destroy_ah)),
- UAPI_DEF_OBJ_NEEDS_FN(create_user_ah),
+ UAPI_DEF_OBJ_NEEDS_FN(create_ah),
UAPI_DEF_OBJ_NEEDS_FN(destroy_ah)),

DECLARE_UVERBS_OBJECT(
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index bc9a83f1ca2d..5471f13a2443 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -510,7 +510,7 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,

might_sleep_if(flags & RDMA_CREATE_AH_SLEEPABLE);

- if (!udata && !device->ops.create_ah)
+ if (!device->ops.create_ah)
return ERR_PTR(-EOPNOTSUPP);

ah = rdma_zalloc_drv_obj_gfp(
@@ -527,10 +527,7 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
init_attr.flags = flags;
init_attr.xmit_slave = xmit_slave;

- if (udata)
- ret = device->ops.create_user_ah(ah, &init_attr, udata);
- else
- ret = device->ops.create_ah(ah, &init_attr, NULL);
+ ret = device->ops.create_ah(ah, &init_attr, udata);
if (ret) {
kfree(ah);
return ERR_PTR(ret);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 69d883f7fb41..8e4ded24494c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2428,8 +2428,6 @@ struct ib_device_ops {
int (*dealloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
int (*create_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr,
struct ib_udata *udata);
- int (*create_user_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr,
- struct ib_udata *udata);
int (*modify_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
int (*query_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
int (*destroy_ah)(struct ib_ah *ah, u32 flags);
--
2.25.1
\
 
 \ /
  Last update: 2022-03-08 15:37    [W:0.023 / U:1.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site