From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH for-next v5 3/6] RDMA/rxe: Create AH index and return to user space
Date: Tue, 5 Oct 2021 20:58:12 -0500 [thread overview]
Message-ID: <20211006015815.28350-4-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20211006015815.28350-1-rpearsonhpe@gmail.com>
Make changes to rdma_user_rxe.h to allow indexing AH objects, passing
the index in UD send WRs to the driver and returning the index to the rxe
provider.
Modify rxe_create_ah() to add an index to AH when created and if
called from a new user provider return it to user space. If called
from an old provider mark the AH as not having a useful index.
Modify rxe_destroy_ah to drop the index before deleting the object.
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
drivers/infiniband/sw/rxe/rxe_verbs.c | 31 ++++++++++++++++++++++++++-
drivers/infiniband/sw/rxe/rxe_verbs.h | 2 ++
include/uapi/rdma/rdma_user_rxe.h | 8 ++++++-
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index c09e1c25ce66..8854ace63acd 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -158,9 +158,19 @@ static int rxe_create_ah(struct ib_ah *ibah,
struct ib_udata *udata)
{
- int err;
struct rxe_dev *rxe = to_rdev(ibah->device);
struct rxe_ah *ah = to_rah(ibah);
+ struct rxe_create_ah_resp __user *uresp = NULL;
+ int err;
+
+ if (udata) {
+ /* test if new user provider */
+ if (udata->outlen >= sizeof(*uresp))
+ uresp = udata->outbuf;
+ ah->is_user = true;
+ } else {
+ ah->is_user = false;
+ }
err = rxe_av_chk_attr(rxe, init_attr->ah_attr);
if (err)
@@ -170,6 +180,24 @@ static int rxe_create_ah(struct ib_ah *ibah,
if (err)
return err;
+ /* create index > 0 */
+ rxe_add_index(ah);
+ ah->ah_num = ah->pelem.index;
+
+ if (uresp) {
+ /* only if new user provider */
+ err = copy_to_user(&uresp->ah_num, &ah->ah_num,
+ sizeof(uresp->ah_num));
+ if (err) {
+ rxe_drop_index(ah);
+ rxe_drop_ref(ah);
+ return -EFAULT;
+ }
+ } else if (ah->is_user) {
+ /* only if old user provider */
+ ah->ah_num = 0;
+ }
+
rxe_init_av(init_attr->ah_attr, &ah->av);
return 0;
}
@@ -202,6 +230,7 @@ static int rxe_destroy_ah(struct ib_ah *ibah, u32 flags)
{
struct rxe_ah *ah = to_rah(ibah);
+ rxe_drop_index(ah);
rxe_drop_ref(ah);
return 0;
}
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index c807639435eb..9cd203f1fa22 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -48,6 +48,8 @@ struct rxe_ah {
struct rxe_pool_entry pelem;
struct rxe_pd *pd;
struct rxe_av av;
+ bool is_user;
+ int ah_num;
};
struct rxe_cqe {
diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h
index 2f1ebbe96434..dc9f7a5e203a 100644
--- a/include/uapi/rdma/rdma_user_rxe.h
+++ b/include/uapi/rdma/rdma_user_rxe.h
@@ -99,7 +99,8 @@ struct rxe_send_wr {
__u32 remote_qkey;
__u16 pkey_index;
__u16 reserved;
- __u32 pad[5];
+ __u32 ah_num;
+ __u32 pad[4];
struct rxe_av av;
} ud;
struct {
@@ -170,6 +171,11 @@ struct rxe_recv_wqe {
struct rxe_dma_info dma;
};
+struct rxe_create_ah_resp {
+ __u32 ah_num;
+ __u32 reserved;
+};
+
struct rxe_create_cq_resp {
struct mminfo mi;
};
--
2.30.2
next prev parent reply other threads:[~2021-10-06 1:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 1:58 [PATCH for-next v5 0/6] Replace AV by AH in UD sends Bob Pearson
2021-10-06 1:58 ` [PATCH for-next v5 1/6] RDMA/rxe: Move AV from rxe_send_wqe to rxe_send_wr Bob Pearson
2021-10-06 1:58 ` [PATCH for-next v5 2/6] RDMA/rxe: Change AH objects to indexed Bob Pearson
2021-10-06 1:58 ` Bob Pearson [this message]
2021-10-06 1:58 ` [PATCH for-next v5 4/6] RDMA/rxe: Replace ah->pd by ah->ibah.pd Bob Pearson
2021-10-06 1:58 ` [PATCH for-next v5 5/6] RDMA/rxe: Lookup kernel AH from ah index in UD WQEs Bob Pearson
2021-10-06 11:55 ` Zhu Yanjun
2021-10-06 14:42 ` Pearson, Robert B
2021-10-07 3:12 ` Zhu Yanjun
2021-10-06 1:58 ` [PATCH for-next v5 6/6] RDMA/rxe: Convert kernel UD post send to use ah_num Bob Pearson
2021-10-06 19:37 ` [PATCH for-next v5 0/6] Replace AV by AH in UD sends Jason Gunthorpe
[not found] ` <8fb347bb-81b2-2ba6-a97c-16a5db86541d@gmail.com>
[not found] ` <20211006224906.GE2744544@nvidia.com>
[not found] ` <086698cc-9e50-49be-aea8-7a4426f2e502@gmail.com>
[not found] ` <20211007190543.GM2744544@nvidia.com>
2021-10-07 19:51 ` Bob Pearson
2021-10-07 19:57 ` Jason Gunthorpe
2021-10-07 20:40 ` Shoaib Rao
2021-10-07 22:00 ` Bob Pearson
2021-10-07 22:53 ` Shoaib Rao
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=20211006015815.28350-4-rpearsonhpe@gmail.com \
--to=rpearsonhpe@gmail.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=zyjzyj2000@gmail.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