* [PATCH rdma-next 1/1] RDMA/mana_ib: return PD number to the user
@ 2026-02-04 13:58 Konstantin Taranov
2026-02-04 14:28 ` Jason Gunthorpe
0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Taranov @ 2026-02-04 13:58 UTC (permalink / raw)
To: kotaranov, shirazsaleem, longli, jgg, leon; +Cc: linux-rdma, linux-kernel
From: Konstantin Taranov <kotaranov@microsoft.com>
Implement returning to userspace applications PDNs of created PDs.
Allow users to request short PDNs which are 16 bits.
Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
---
drivers/infiniband/hw/mana/main.c | 19 ++++++++++++++++++-
include/net/mana/gdma.h | 4 ++--
include/uapi/rdma/mana-abi.h | 14 ++++++++++++++
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c
index fac159f71..7ee4493cb 100644
--- a/drivers/infiniband/hw/mana/main.c
+++ b/drivers/infiniband/hw/mana/main.c
@@ -69,9 +69,11 @@ int mana_ib_cfg_vport(struct mana_ib_dev *dev, u32 port, struct mana_ib_pd *pd,
int mana_ib_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
{
struct mana_ib_pd *pd = container_of(ibpd, struct mana_ib_pd, ibpd);
+ struct mana_ib_alloc_pd_resp cmd_resp = {};
struct ib_device *ibdev = ibpd->device;
struct gdma_create_pd_resp resp = {};
struct gdma_create_pd_req req = {};
+ struct mana_ib_alloc_pd ucmd = {};
enum gdma_pd_flags flags = 0;
struct mana_ib_dev *dev;
struct gdma_context *gc;
@@ -83,8 +85,15 @@ int mana_ib_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
mana_gd_init_req_hdr(&req.hdr, GDMA_CREATE_PD, sizeof(req),
sizeof(resp));
- if (!udata)
+ if (!udata) {
flags |= GDMA_PD_FLAG_ALLOW_GPA_MR;
+ } else {
+ err = ib_copy_from_udata(&ucmd, udata, min(sizeof(ucmd), udata->inlen));
+ if (err)
+ return err;
+ if (ucmd.flags & MANA_IB_PD_SHORT_PDN)
+ flags |= GDMA_PD_FLAG_SHORT_PDN;
+ }
req.flags = flags;
err = mana_gd_send_request(gc, sizeof(req), &req,
@@ -107,6 +116,14 @@ int mana_ib_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
mutex_init(&pd->vport_mutex);
pd->vport_use_count = 0;
+
+ if (udata) {
+ cmd_resp.pdn = resp.pd_id;
+ err = ib_copy_to_udata(udata, &cmd_resp, min(sizeof(cmd_resp), udata->outlen));
+ if (err)
+ return err;
+ }
+
return 0;
}
diff --git a/include/net/mana/gdma.h b/include/net/mana/gdma.h
index 8649eb789..cebb9b2bd 100644
--- a/include/net/mana/gdma.h
+++ b/include/net/mana/gdma.h
@@ -824,8 +824,8 @@ struct gdma_destroy_dma_region_req {
}; /* HW DATA */
enum gdma_pd_flags {
- GDMA_PD_FLAG_INVALID = 0,
- GDMA_PD_FLAG_ALLOW_GPA_MR = 1,
+ GDMA_PD_FLAG_ALLOW_GPA_MR = BIT(0),
+ GDMA_PD_FLAG_SHORT_PDN = BIT(2),
};
struct gdma_create_pd_req {
diff --git a/include/uapi/rdma/mana-abi.h b/include/uapi/rdma/mana-abi.h
index a75bf32b8..88b24ae50 100644
--- a/include/uapi/rdma/mana-abi.h
+++ b/include/uapi/rdma/mana-abi.h
@@ -87,4 +87,18 @@ struct mana_ib_create_qp_rss_resp {
struct rss_resp_entry entries[64];
};
+enum mana_ib_create_pd_flags {
+ MANA_IB_PD_SHORT_PDN = 1 << 0,
+};
+
+struct mana_ib_alloc_pd {
+ __u32 flags;
+ __u32 reserved;
+};
+
+struct mana_ib_alloc_pd_resp {
+ __u32 pdn;
+ __u32 reserved;
+};
+
#endif
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH rdma-next 1/1] RDMA/mana_ib: return PD number to the user
2026-02-04 13:58 [PATCH rdma-next 1/1] RDMA/mana_ib: return PD number to the user Konstantin Taranov
@ 2026-02-04 14:28 ` Jason Gunthorpe
2026-02-04 17:46 ` Leon Romanovsky
0 siblings, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2026-02-04 14:28 UTC (permalink / raw)
To: Konstantin Taranov
Cc: kotaranov, shirazsaleem, longli, leon, linux-rdma, linux-kernel
On Wed, Feb 04, 2026 at 05:58:13AM -0800, Konstantin Taranov wrote:
> From: Konstantin Taranov <kotaranov@microsoft.com>
>
> Implement returning to userspace applications PDNs of created PDs.
> Allow users to request short PDNs which are 16 bits.
Why does userspace ever need to see a PDN? Please justify that in the
commit message
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rdma-next 1/1] RDMA/mana_ib: return PD number to the user
2026-02-04 14:28 ` Jason Gunthorpe
@ 2026-02-04 17:46 ` Leon Romanovsky
2026-02-05 12:03 ` Konstantin Taranov
0 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2026-02-04 17:46 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Konstantin Taranov, kotaranov, shirazsaleem, longli, linux-rdma,
linux-kernel
On Wed, Feb 04, 2026 at 10:28:27AM -0400, Jason Gunthorpe wrote:
> On Wed, Feb 04, 2026 at 05:58:13AM -0800, Konstantin Taranov wrote:
> > From: Konstantin Taranov <kotaranov@microsoft.com>
> >
> > Implement returning to userspace applications PDNs of created PDs.
> > Allow users to request short PDNs which are 16 bits.
>
> Why does userspace ever need to see a PDN? Please justify that in the
> commit message
Probably for the debug and we have restrack for it.
Thanks
>
> Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rdma-next 1/1] RDMA/mana_ib: return PD number to the user
2026-02-04 17:46 ` Leon Romanovsky
@ 2026-02-05 12:03 ` Konstantin Taranov
2026-02-06 14:55 ` Jason Gunthorpe
0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Taranov @ 2026-02-05 12:03 UTC (permalink / raw)
To: Leon Romanovsky, Jason Gunthorpe
Cc: Konstantin Taranov, Shiraz Saleem, Long Li,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
>
> On Wed, Feb 04, 2026 at 10:28:27AM -0400, Jason Gunthorpe wrote:
> > On Wed, Feb 04, 2026 at 05:58:13AM -0800, Konstantin Taranov wrote:
> > > From: Konstantin Taranov <kotaranov@microsoft.com>
> > >
> > > Implement returning to userspace applications PDNs of created PDs.
> > > Allow users to request short PDNs which are 16 bits.
> >
> > Why does userspace ever need to see a PDN? Please justify that in the
> > commit message
>
> Probably for the debug and we have restrack for it.
>
Sure, I will add the explanation in v2. Overall, it is for applications working on top of the rdma-core (e.g., mana DPDK).
The use-case is similar to what mlx4 and mthca have for address vectors in rdma-core for isolation.
As the whole process of working with WQs and CQs is implemented in that applications (e.g., mana DPDK), they need to know
PDN to build a correct request. What is more, the HW folks put a limit of 16 bits to the PDN field, requiring a flag to ensure
that we get a PDN that fits into the field.
I hope that it justifies the change as most ib providers have pdn in the user-space.
- Konstantin
> Thanks
>
> >
> > Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rdma-next 1/1] RDMA/mana_ib: return PD number to the user
2026-02-05 12:03 ` Konstantin Taranov
@ 2026-02-06 14:55 ` Jason Gunthorpe
0 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2026-02-06 14:55 UTC (permalink / raw)
To: Konstantin Taranov
Cc: Leon Romanovsky, Konstantin Taranov, Shiraz Saleem, Long Li,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
On Thu, Feb 05, 2026 at 12:03:18PM +0000, Konstantin Taranov wrote:
> >
> > On Wed, Feb 04, 2026 at 10:28:27AM -0400, Jason Gunthorpe wrote:
> > > On Wed, Feb 04, 2026 at 05:58:13AM -0800, Konstantin Taranov wrote:
> > > > From: Konstantin Taranov <kotaranov@microsoft.com>
> > > >
> > > > Implement returning to userspace applications PDNs of created PDs.
> > > > Allow users to request short PDNs which are 16 bits.
> > >
> > > Why does userspace ever need to see a PDN? Please justify that in the
> > > commit message
> >
> > Probably for the debug and we have restrack for it.
> >
>
> Sure, I will add the explanation in v2. Overall, it is for
> applications working on top of the rdma-core (e.g., mana DPDK). The
> use-case is similar to what mlx4 and mthca have for address vectors
> in rdma-core for isolation. As the whole process of working with
> WQs and CQs is implemented in that applications (e.g., mana DPDK),
> they need to know PDN to build a correct request. What is more, the
> HW folks put a limit of 16 bits to the PDN field, requiring a flag
> to ensure that we get a PDN that fits into the field.
>
> I hope that it justifies the change as most ib providers have pdn in
> the user-space.
But they don't put it in a WQE and don't check in HW it is exactly the same as
the PDN the WQ already has.
You have PDs in AHs and other related objects which make sense, but a
WQ only has one PD, it is illogical to pass in a PDN in a WQE, because
it can never take on a different value.
If it can take on a different value then your HW's security model is
broken.
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-06 14:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04 13:58 [PATCH rdma-next 1/1] RDMA/mana_ib: return PD number to the user Konstantin Taranov
2026-02-04 14:28 ` Jason Gunthorpe
2026-02-04 17:46 ` Leon Romanovsky
2026-02-05 12:03 ` Konstantin Taranov
2026-02-06 14:55 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox