diff mbox series

[for-next,2/3] RDMA/core: Remove ib_alloc_mr_user function

Message ID 20200706120343.10816-3-galpress@amazon.com (mailing list archive)
State Mainlined
Commit b64b74b1d51cce8c9496b6a071c1d59786c2144d
Delegated to: Jason Gunthorpe
Headers show
Series Allocate MR cleanups | expand

Commit Message

Gal Pressman July 6, 2020, 12:03 p.m. UTC
Allocating an MR flow can only be initiated by kernel users, and not
from userspace. As a result, the udata parameter is always being passed
as NULL. Rename ib_alloc_mr_user function to ib_alloc_mr and remove the
udata parameter.

Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/core/verbs.c | 11 +++++------
 include/rdma/ib_verbs.h         | 10 ++--------
 2 files changed, 7 insertions(+), 14 deletions(-)

Comments

Leon Romanovsky July 6, 2020, 12:35 p.m. UTC | #1
On Mon, Jul 06, 2020 at 03:03:42PM +0300, Gal Pressman wrote:
> Allocating an MR flow can only be initiated by kernel users, and not
> from userspace. As a result, the udata parameter is always being passed
> as NULL. Rename ib_alloc_mr_user function to ib_alloc_mr and remove the
> udata parameter.
>
> Signed-off-by: Gal Pressman <galpress@amazon.com>
> ---
>  drivers/infiniband/core/verbs.c | 11 +++++------
>  include/rdma/ib_verbs.h         | 10 ++--------
>  2 files changed, 7 insertions(+), 14 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
diff mbox series

Patch

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 759de1372c59..5242155ced47 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -2104,11 +2104,10 @@  int ib_dereg_mr_user(struct ib_mr *mr, struct ib_udata *udata)
 EXPORT_SYMBOL(ib_dereg_mr_user);
 
 /**
- * ib_alloc_mr_user() - Allocates a memory region
+ * ib_alloc_mr() - Allocates a memory region
  * @pd:            protection domain associated with the region
  * @mr_type:       memory region type
  * @max_num_sg:    maximum sg entries available for registration.
- * @udata:	   user data or null for kernel objects
  *
  * Notes:
  * Memory registeration page/sg lists must not exceed max_num_sg.
@@ -2116,8 +2115,8 @@  EXPORT_SYMBOL(ib_dereg_mr_user);
  * max_num_sg * used_page_size.
  *
  */
-struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type,
-			       u32 max_num_sg, struct ib_udata *udata)
+struct ib_mr *ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
+			  u32 max_num_sg)
 {
 	struct ib_mr *mr;
 
@@ -2132,7 +2131,7 @@  struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type,
 		goto out;
 	}
 
-	mr = pd->device->ops.alloc_mr(pd, mr_type, max_num_sg, udata);
+	mr = pd->device->ops.alloc_mr(pd, mr_type, max_num_sg, NULL);
 	if (IS_ERR(mr))
 		goto out;
 
@@ -2151,7 +2150,7 @@  struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type,
 	trace_mr_alloc(pd, mr_type, max_num_sg, mr);
 	return mr;
 }
-EXPORT_SYMBOL(ib_alloc_mr_user);
+EXPORT_SYMBOL(ib_alloc_mr);
 
 /**
  * ib_alloc_mr_integrity() - Allocates an integrity memory region
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 1e902a8f1713..3b53fdc975f6 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -4268,14 +4268,8 @@  static inline int ib_dereg_mr(struct ib_mr *mr)
 	return ib_dereg_mr_user(mr, NULL);
 }
 
-struct ib_mr *ib_alloc_mr_user(struct ib_pd *pd, enum ib_mr_type mr_type,
-			       u32 max_num_sg, struct ib_udata *udata);
-
-static inline struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
-					enum ib_mr_type mr_type, u32 max_num_sg)
-{
-	return ib_alloc_mr_user(pd, mr_type, max_num_sg, NULL);
-}
+struct ib_mr *ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
+			  u32 max_num_sg);
 
 struct ib_mr *ib_alloc_mr_integrity(struct ib_pd *pd,
 				    u32 max_num_data_sg,