linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next] RDMA/qedr: Add kernel capability flags for dpm enabled mode
@ 2019-11-20 13:20 Michal Kalderon
  2019-11-20 16:53 ` Jason Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Kalderon @ 2019-11-20 13:20 UTC (permalink / raw)
  To: michal.kalderon, ariel.elior, dledford, jgg; +Cc: linux-rdma

HW/FW support two types of latency enhancement features.
Until now user-space implemented only edpm (enhanced dpm).
We add kernel capability flags to differentiate between current
FW in kernel that supports both ldpm and edpm.
Since edpm is not yet supported for iWARP we add different flags
for iWARP + RoCE.
We also fix bad practice of defining sizes in rdma-core and pass
initialization to kernel, for forward compatibility.

The capability flags are added for backward-forward compatibility
between kernel and rdma-core for qedr.

Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
---
rdma-core changes in pr #622 https://github.com/linux-rdma/rdma-core/pull/622
---
 drivers/infiniband/hw/qedr/verbs.c | 13 ++++++++++++-
 include/uapi/rdma/qedr-abi.h       | 18 ++++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 8096b8fcab4e..54cce8969594 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -312,7 +312,18 @@ int qedr_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
 	}
 	ctx->db_mmap_entry = &entry->rdma_entry;
 
-	uresp.dpm_enabled = dev->user_dpm_enabled;
+	if (!dev->user_dpm_enabled)
+		uresp.dpm_flags = 0;
+	else if (rdma_protocol_iwarp(&dev->ibdev, 1))
+		uresp.dpm_flags = QEDR_DPM_TYPE_IWARP_LEGACY;
+	else
+		uresp.dpm_flags = QEDR_DPM_TYPE_ROCE_ENHANCED |
+				  QEDR_DPM_TYPE_ROCE_LEGACY;
+
+	uresp.dpm_flags |= QEDR_DPM_SIZES_SET;
+	uresp.ldpm_limit_size = QEDR_LDPM_MAX_SIZE;
+	uresp.edpm_trans_size = QEDR_EDPM_TRANS_SIZE;
+
 	uresp.wids_enabled = 1;
 	uresp.wid_count = oparams.wid_count;
 	uresp.db_pa = rdma_user_mmap_get_offset(ctx->db_mmap_entry);
diff --git a/include/uapi/rdma/qedr-abi.h b/include/uapi/rdma/qedr-abi.h
index c022ee26089b..a0b83c9d4498 100644
--- a/include/uapi/rdma/qedr-abi.h
+++ b/include/uapi/rdma/qedr-abi.h
@@ -48,6 +48,18 @@ struct qedr_alloc_ucontext_req {
 	__u32 reserved;
 };
 
+#define QEDR_LDPM_MAX_SIZE	(8192)
+#define QEDR_EDPM_TRANS_SIZE	(64)
+
+enum qedr_rdma_dpm_type {
+	QEDR_DPM_TYPE_NONE		= 0,
+	QEDR_DPM_TYPE_ROCE_ENHANCED	= 1 << 0,
+	QEDR_DPM_TYPE_ROCE_LEGACY	= 1 << 1,
+	QEDR_DPM_TYPE_IWARP_LEGACY	= 1 << 2,
+	QEDR_DPM_TYPE_RESERVED		= 1 << 3,
+	QEDR_DPM_SIZES_SET		= 1 << 4,
+};
+
 struct qedr_alloc_ucontext_resp {
 	__aligned_u64 db_pa;
 	__u32 db_size;
@@ -59,10 +71,12 @@ struct qedr_alloc_ucontext_resp {
 	__u32 sges_per_recv_wr;
 	__u32 sges_per_srq_wr;
 	__u32 max_cqes;
-	__u8 dpm_enabled;
+	__u8 dpm_flags;
 	__u8 wids_enabled;
 	__u16 wid_count;
-	__u32 reserved;
+	__u16 ldpm_limit_size;
+	__u8 edpm_trans_size;
+	__u8 reserved;
 };
 
 struct qedr_alloc_pd_ureq {
-- 
2.14.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH rdma-next] RDMA/qedr: Add kernel capability flags for dpm enabled mode
  2019-11-20 13:20 [PATCH rdma-next] RDMA/qedr: Add kernel capability flags for dpm enabled mode Michal Kalderon
@ 2019-11-20 16:53 ` Jason Gunthorpe
  2019-11-21  8:12   ` [EXT] " Michal Kalderon
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2019-11-20 16:53 UTC (permalink / raw)
  To: Michal Kalderon; +Cc: ariel.elior, dledford, linux-rdma

On Wed, Nov 20, 2019 at 03:20:09PM +0200, Michal Kalderon wrote:
> diff --git a/include/uapi/rdma/qedr-abi.h b/include/uapi/rdma/qedr-abi.h
> index c022ee26089b..a0b83c9d4498 100644
> +++ b/include/uapi/rdma/qedr-abi.h
> @@ -48,6 +48,18 @@ struct qedr_alloc_ucontext_req {
>  	__u32 reserved;
>  };
>  
> +#define QEDR_LDPM_MAX_SIZE	(8192)
> +#define QEDR_EDPM_TRANS_SIZE	(64)
> +
> +enum qedr_rdma_dpm_type {
> +	QEDR_DPM_TYPE_NONE		= 0,
> +	QEDR_DPM_TYPE_ROCE_ENHANCED	= 1 << 0,
> +	QEDR_DPM_TYPE_ROCE_LEGACY	= 1 << 1,
> +	QEDR_DPM_TYPE_IWARP_LEGACY	= 1 << 2,
> +	QEDR_DPM_TYPE_RESERVED		= 1 << 3,
> +	QEDR_DPM_SIZES_SET		= 1 << 4,
> +};
> +
>  struct qedr_alloc_ucontext_resp {
>  	__aligned_u64 db_pa;
>  	__u32 db_size;
> @@ -59,10 +71,12 @@ struct qedr_alloc_ucontext_resp {
>  	__u32 sges_per_recv_wr;
>  	__u32 sges_per_srq_wr;
>  	__u32 max_cqes;
> -	__u8 dpm_enabled;
> +	__u8 dpm_flags;

Is this redefinition backwards compatible with old user space?
That should be described in the commit message

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [EXT] Re: [PATCH rdma-next] RDMA/qedr: Add kernel capability flags for dpm enabled mode
  2019-11-20 16:53 ` Jason Gunthorpe
@ 2019-11-21  8:12   ` Michal Kalderon
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Kalderon @ 2019-11-21  8:12 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Ariel Elior, dledford, linux-rdma

> From: Jason Gunthorpe <jgg@ziepe.ca>
> Sent: Wednesday, November 20, 2019 6:53 PM
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Wed, Nov 20, 2019 at 03:20:09PM +0200, Michal Kalderon wrote:
> > diff --git a/include/uapi/rdma/qedr-abi.h
> > b/include/uapi/rdma/qedr-abi.h index c022ee26089b..a0b83c9d4498
> 100644
> > +++ b/include/uapi/rdma/qedr-abi.h
> > @@ -48,6 +48,18 @@ struct qedr_alloc_ucontext_req {
> >  	__u32 reserved;
> >  };
> >
> > +#define QEDR_LDPM_MAX_SIZE	(8192)
> > +#define QEDR_EDPM_TRANS_SIZE	(64)
> > +
> > +enum qedr_rdma_dpm_type {
> > +	QEDR_DPM_TYPE_NONE		= 0,
> > +	QEDR_DPM_TYPE_ROCE_ENHANCED	= 1 << 0,
> > +	QEDR_DPM_TYPE_ROCE_LEGACY	= 1 << 1,
> > +	QEDR_DPM_TYPE_IWARP_LEGACY	= 1 << 2,
> > +	QEDR_DPM_TYPE_RESERVED		= 1 << 3,
> > +	QEDR_DPM_SIZES_SET		= 1 << 4,
> > +};
> > +
> >  struct qedr_alloc_ucontext_resp {
> >  	__aligned_u64 db_pa;
> >  	__u32 db_size;
> > @@ -59,10 +71,12 @@ struct qedr_alloc_ucontext_resp {
> >  	__u32 sges_per_recv_wr;
> >  	__u32 sges_per_srq_wr;
> >  	__u32 max_cqes;
> > -	__u8 dpm_enabled;
> > +	__u8 dpm_flags;
> 
> Is this redefinition backwards compatible with old user space?
> That should be described in the commit message
>
Yes it is, I'll add to the commit message, thanks,
 
> Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-21  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 13:20 [PATCH rdma-next] RDMA/qedr: Add kernel capability flags for dpm enabled mode Michal Kalderon
2019-11-20 16:53 ` Jason Gunthorpe
2019-11-21  8:12   ` [EXT] " Michal Kalderon

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).