Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type
@ 2026-01-09 12:37 Konstantin Taranov
  2026-01-09 23:56 ` Long Li
  2026-01-12  7:52 ` Leon Romanovsky
  0 siblings, 2 replies; 6+ messages in thread
From: Konstantin Taranov @ 2026-01-09 12:37 UTC (permalink / raw)
  To: kotaranov, shirazsaleem, longli, jgg, leon; +Cc: linux-rdma, linux-kernel

From: Konstantin Taranov <kotaranov@microsoft.com>

Get CQ type from the used gdma device. The MANA_IB_CREATE_RNIC_CQ
flag is ignored. It was used in older kernel versions where
the mana_ib was shared between ethernet and rnic.

Fixes: d4293f96ce0b ("RDMA/mana_ib: unify mana_ib functions to support any gdma device")
Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
---
 drivers/infiniband/hw/mana/cq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/mana/cq.c b/drivers/infiniband/hw/mana/cq.c
index 1becc8779..2dce1b677 100644
--- a/drivers/infiniband/hw/mana/cq.c
+++ b/drivers/infiniband/hw/mana/cq.c
@@ -24,6 +24,7 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 
 	cq->comp_vector = attr->comp_vector % ibdev->num_comp_vectors;
 	cq->cq_handle = INVALID_MANA_HANDLE;
+	is_rnic_cq = mana_ib_is_rnic(mdev);
 
 	if (udata) {
 		if (udata->inlen < offsetof(struct mana_ib_create_cq, flags))
@@ -35,8 +36,6 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 			return err;
 		}
 
-		is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);
-
 		if ((!is_rnic_cq && attr->cqe > mdev->adapter_caps.max_qp_wr) ||
 		    attr->cqe > U32_MAX / COMP_ENTRY_SIZE) {
 			ibdev_dbg(ibdev, "CQE %d exceeding limit\n", attr->cqe);
@@ -55,7 +54,6 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 							  ibucontext);
 		doorbell = mana_ucontext->doorbell;
 	} else {
-		is_rnic_cq = true;
 		buf_size = MANA_PAGE_ALIGN(roundup_pow_of_two(attr->cqe * COMP_ENTRY_SIZE));
 		cq->cqe = buf_size / COMP_ENTRY_SIZE;
 		err = mana_ib_create_kernel_queue(mdev, buf_size, GDMA_CQ, &cq->queue);
-- 
2.43.0


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

* RE: [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type
  2026-01-09 12:37 [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type Konstantin Taranov
@ 2026-01-09 23:56 ` Long Li
  2026-01-12  7:52 ` Leon Romanovsky
  1 sibling, 0 replies; 6+ messages in thread
From: Long Li @ 2026-01-09 23:56 UTC (permalink / raw)
  To: Konstantin Taranov, Konstantin Taranov, Shiraz Saleem,
	jgg@ziepe.ca, leon@kernel.org
  Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org

> Subject: [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the
> device type
> 
> From: Konstantin Taranov <kotaranov@microsoft.com>
> 
> Get CQ type from the used gdma device. The MANA_IB_CREATE_RNIC_CQ flag
> is ignored. It was used in older kernel versions where the mana_ib was shared
> between ethernet and rnic.
> 
> Fixes: d4293f96ce0b ("RDMA/mana_ib: unify mana_ib functions to support
> any gdma device")
> Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>

Reviewed-by: Long Li <longli@microsoft.com>

> ---
>  drivers/infiniband/hw/mana/cq.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mana/cq.c
> b/drivers/infiniband/hw/mana/cq.c index 1becc8779..2dce1b677 100644
> --- a/drivers/infiniband/hw/mana/cq.c
> +++ b/drivers/infiniband/hw/mana/cq.c
> @@ -24,6 +24,7 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct
> ib_cq_init_attr *attr,
> 
>  	cq->comp_vector = attr->comp_vector % ibdev->num_comp_vectors;
>  	cq->cq_handle = INVALID_MANA_HANDLE;
> +	is_rnic_cq = mana_ib_is_rnic(mdev);
> 
>  	if (udata) {
>  		if (udata->inlen < offsetof(struct mana_ib_create_cq, flags))
> @@ -35,8 +36,6 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct
> ib_cq_init_attr *attr,
>  			return err;
>  		}
> 
> -		is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);
> -
>  		if ((!is_rnic_cq && attr->cqe > mdev-
> >adapter_caps.max_qp_wr) ||
>  		    attr->cqe > U32_MAX / COMP_ENTRY_SIZE) {
>  			ibdev_dbg(ibdev, "CQE %d exceeding limit\n", attr-
> >cqe); @@ -55,7 +54,6 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const
> struct ib_cq_init_attr *attr,
>  							  ibucontext);
>  		doorbell = mana_ucontext->doorbell;
>  	} else {
> -		is_rnic_cq = true;
>  		buf_size = MANA_PAGE_ALIGN(roundup_pow_of_two(attr-
> >cqe * COMP_ENTRY_SIZE));
>  		cq->cqe = buf_size / COMP_ENTRY_SIZE;
>  		err = mana_ib_create_kernel_queue(mdev, buf_size,
> GDMA_CQ, &cq->queue);
> --
> 2.43.0


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

* Re: [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type
  2026-01-09 12:37 [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type Konstantin Taranov
  2026-01-09 23:56 ` Long Li
@ 2026-01-12  7:52 ` Leon Romanovsky
  2026-01-13 12:27   ` [EXTERNAL] " Konstantin Taranov
  1 sibling, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2026-01-12  7:52 UTC (permalink / raw)
  To: Konstantin Taranov
  Cc: kotaranov, shirazsaleem, longli, jgg, linux-rdma, linux-kernel

On Fri, Jan 09, 2026 at 04:37:30AM -0800, Konstantin Taranov wrote:
> From: Konstantin Taranov <kotaranov@microsoft.com>
> 
> Get CQ type from the used gdma device. The MANA_IB_CREATE_RNIC_CQ
> flag is ignored. It was used in older kernel versions where
> the mana_ib was shared between ethernet and rnic.
> 
> Fixes: d4293f96ce0b ("RDMA/mana_ib: unify mana_ib functions to support any gdma device")
> Signed-off-by: Konstantin Taranov <kotaranov@microsoft.com>
> ---
>  drivers/infiniband/hw/mana/cq.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mana/cq.c b/drivers/infiniband/hw/mana/cq.c
> index 1becc8779..2dce1b677 100644
> --- a/drivers/infiniband/hw/mana/cq.c
> +++ b/drivers/infiniband/hw/mana/cq.c
> @@ -24,6 +24,7 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
>  
>  	cq->comp_vector = attr->comp_vector % ibdev->num_comp_vectors;
>  	cq->cq_handle = INVALID_MANA_HANDLE;
> +	is_rnic_cq = mana_ib_is_rnic(mdev);
>  
>  	if (udata) {
>  		if (udata->inlen < offsetof(struct mana_ib_create_cq, flags))
> @@ -35,8 +36,6 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
>  			return err;
>  		}
>  
> -		is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);

You need to add code which prohibits future use of this BIT(0) in ucmd.flags for backward compatibility
and maybe delete MANA_IB_CREATE_RNIC_CQ from UAPI too.

Thanks

> -
>  		if ((!is_rnic_cq && attr->cqe > mdev->adapter_caps.max_qp_wr) ||
>  		    attr->cqe > U32_MAX / COMP_ENTRY_SIZE) {
>  			ibdev_dbg(ibdev, "CQE %d exceeding limit\n", attr->cqe);
> @@ -55,7 +54,6 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
>  							  ibucontext);
>  		doorbell = mana_ucontext->doorbell;
>  	} else {
> -		is_rnic_cq = true;
>  		buf_size = MANA_PAGE_ALIGN(roundup_pow_of_two(attr->cqe * COMP_ENTRY_SIZE));
>  		cq->cqe = buf_size / COMP_ENTRY_SIZE;
>  		err = mana_ib_create_kernel_queue(mdev, buf_size, GDMA_CQ, &cq->queue);
> -- 
> 2.43.0
> 

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

* RE: [EXTERNAL] Re: [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type
  2026-01-12  7:52 ` Leon Romanovsky
@ 2026-01-13 12:27   ` Konstantin Taranov
  2026-01-13 14:07     ` Leon Romanovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Konstantin Taranov @ 2026-01-13 12:27 UTC (permalink / raw)
  To: Leon Romanovsky, Konstantin Taranov
  Cc: Shiraz Saleem, Long Li, jgg@ziepe.ca, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org

> >
> > -		is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);
> 
> You need to add code which prohibits future use of this BIT(0) in ucmd.flags
> for backward compatibility and maybe delete MANA_IB_CREATE_RNIC_CQ
> from UAPI too.
> 
> Thanks
> 

Hi Leon. I thought that my proposed change is backward and forward compatible.
If I add code that prohibits this flag, then the older rdma-core will fail to create CQ,
as it sets this flag. Add rdma-core should set the flag to support older kernels.

So, the current solution is as follows:
rdma-core always sends the flag. The kernels without this patch still use this flag.
Newer kernels just ignore the flag and create the CQ according to the client.
It is not fully possible to retire this flag now, as we want to be backwards compatible and
support older kernels and older rdma-core.
Or did you mean something else? Or do I miss something?

Thanks

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

* Re: [EXTERNAL] Re: [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type
  2026-01-13 12:27   ` [EXTERNAL] " Konstantin Taranov
@ 2026-01-13 14:07     ` Leon Romanovsky
  2026-01-13 14:40       ` Konstantin Taranov
  0 siblings, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2026-01-13 14:07 UTC (permalink / raw)
  To: Konstantin Taranov
  Cc: Konstantin Taranov, Shiraz Saleem, Long Li, jgg@ziepe.ca,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org

On Tue, Jan 13, 2026 at 12:27:57PM +0000, Konstantin Taranov wrote:
> > >
> > > -		is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);
> > 
> > You need to add code which prohibits future use of this BIT(0) in ucmd.flags
> > for backward compatibility and maybe delete MANA_IB_CREATE_RNIC_CQ
> > from UAPI too.
> > 
> > Thanks
> > 
> 
> Hi Leon. I thought that my proposed change is backward and forward compatible.
> If I add code that prohibits this flag, then the older rdma-core will fail to create CQ,
> as it sets this flag. Add rdma-core should set the flag to support older kernels.
> 
> So, the current solution is as follows:
> rdma-core always sends the flag. The kernels without this patch still use this flag.
> Newer kernels just ignore the flag and create the CQ according to the client.
> It is not fully possible to retire this flag now, as we want to be backwards compatible and
> support older kernels and older rdma-core.
> Or did you mean something else? Or do I miss something?

There needs to be a way to document in the code that this bit is reserved and
must not be used.

Thanks

> 
> Thanks

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

* RE: [EXTERNAL] Re: [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type
  2026-01-13 14:07     ` Leon Romanovsky
@ 2026-01-13 14:40       ` Konstantin Taranov
  0 siblings, 0 replies; 6+ messages in thread
From: Konstantin Taranov @ 2026-01-13 14:40 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Konstantin Taranov, Shiraz Saleem, Long Li, jgg@ziepe.ca,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org

> On Tue, Jan 13, 2026 at 12:27:57PM +0000, Konstantin Taranov wrote:
> > > >
> > > > -		is_rnic_cq = !!(ucmd.flags & MANA_IB_CREATE_RNIC_CQ);
> > >
> > > You need to add code which prohibits future use of this BIT(0) in
> > > ucmd.flags for backward compatibility and maybe delete
> > > MANA_IB_CREATE_RNIC_CQ from UAPI too.
> > >
> > > Thanks
> > >
> >
> > Hi Leon. I thought that my proposed change is backward and forward
> compatible.
> > If I add code that prohibits this flag, then the older rdma-core will
> > fail to create CQ, as it sets this flag. Add rdma-core should set the flag to
> support older kernels.
> >
> > So, the current solution is as follows:
> > rdma-core always sends the flag. The kernels without this patch still use
> this flag.
> > Newer kernels just ignore the flag and create the CQ according to the client.
> > It is not fully possible to retire this flag now, as we want to be
> > backwards compatible and support older kernels and older rdma-core.
> > Or did you mean something else? Or do I miss something?
> 
> There needs to be a way to document in the code that this bit is reserved
> and must not be used.

Got it! I will add comments to the code that the bit is reserved and should
not be reused.

Thanks

> 
> Thanks
> 
> >
> > Thanks

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

end of thread, other threads:[~2026-01-13 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09 12:37 [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type Konstantin Taranov
2026-01-09 23:56 ` Long Li
2026-01-12  7:52 ` Leon Romanovsky
2026-01-13 12:27   ` [EXTERNAL] " Konstantin Taranov
2026-01-13 14:07     ` Leon Romanovsky
2026-01-13 14:40       ` Konstantin Taranov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox