From: Gal Pressman <galpress@amazon.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Doug Ledford <dledford@redhat.com>
Cc: <linux-rdma@vger.kernel.org>,
Selvin Xavier <selvin.xavier@broadcom.com>,
Devesh Sharma <devesh.sharma@broadcom.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
Potnuri Bharat Teja <bharat@chelsio.com>,
Lijun Ou <oulijun@huawei.com>, Weihang Li <liweihang@huawei.com>,
Faisal Latif <faisal.latif@intel.com>,
Shiraz Saleem <shiraz.saleem@intel.com>,
Yishai Hadas <yishaih@mellanox.com>,
"Leon Romanovsky" <leon@kernel.org>,
Michal Kalderon <mkalderon@marvell.com>,
"Ariel Elior" <aelior@marvell.com>,
Adit Ranadive <aditr@vmware.com>,
"VMware PV-Drivers" <pv-drivers@vmware.com>,
Dennis Dalessandro <dennis.dalessandro@intel.com>,
Mike Marciniszyn <mike.marciniszyn@intel.com>,
Zhu Yanjun <yanjunz@mellanox.com>,
"Bernard Metzler" <bmt@zurich.ibm.com>,
Gal Pressman <galpress@amazon.com>
Subject: [PATCH for-next 2/3] RDMA/core: Remove ib_alloc_mr_user function
Date: Mon, 6 Jul 2020 15:03:42 +0300 [thread overview]
Message-ID: <20200706120343.10816-3-galpress@amazon.com> (raw)
In-Reply-To: <20200706120343.10816-1-galpress@amazon.com>
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(-)
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,
--
2.27.0
next prev parent reply other threads:[~2020-07-06 12:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 12:03 [PATCH for-next 0/3] Allocate MR cleanups Gal Pressman
2020-07-06 12:03 ` [PATCH for-next 1/3] RDMA/core: Check for error instead of success in alloc MR function Gal Pressman
2020-07-06 12:32 ` Leon Romanovsky
2020-07-06 12:03 ` Gal Pressman [this message]
2020-07-06 12:35 ` [PATCH for-next 2/3] RDMA/core: Remove ib_alloc_mr_user function Leon Romanovsky
2020-07-06 12:03 ` [PATCH for-next 3/3] RDMA: Remove the udata parameter from alloc_mr callback Gal Pressman
2020-07-06 12:36 ` Leon Romanovsky
2020-07-06 22:26 ` [PATCH for-next 0/3] Allocate MR cleanups Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200706120343.10816-3-galpress@amazon.com \
--to=galpress@amazon.com \
--cc=aditr@vmware.com \
--cc=aelior@marvell.com \
--cc=bharat@chelsio.com \
--cc=bmt@zurich.ibm.com \
--cc=dennis.dalessandro@intel.com \
--cc=devesh.sharma@broadcom.com \
--cc=dledford@redhat.com \
--cc=faisal.latif@intel.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=liweihang@huawei.com \
--cc=mike.marciniszyn@intel.com \
--cc=mkalderon@marvell.com \
--cc=oulijun@huawei.com \
--cc=pv-drivers@vmware.com \
--cc=selvin.xavier@broadcom.com \
--cc=shiraz.saleem@intel.com \
--cc=somnath.kotur@broadcom.com \
--cc=sriharsha.basavapatna@broadcom.com \
--cc=yanjunz@mellanox.com \
--cc=yishaih@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).