RDMA/mana_ib: take CQ type from the device type
Subsystems (2)
PATCH 1/1 RDMA/mana_ib: take CQ type from the device type
From: Konstantin Taranov <[email protected]>
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.
--- drivers/infiniband/hw/mana/cq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/mana/cq.c +1 -3
@@ -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);
Signature · 1 line
2.43.0
Quoted 5 lines
Subject: [PATCH rdma-next 1/1] RDMA/mana_ib: take CQ type from the device type
From: Konstantin Taranov <[email protected]>
Quoted 7 lines
Get CQ type from the used gdma device. The
MANA_IB_CREATE_RNIC_CQflag is ignored. It was used in older kernel versions where themana_ibwas shared between ethernet and rnic.Fixes d4293f96ce0b ("RDMA/mana_ib: unify mana_ib functions to supportany gdma device")
Signed-off-by Konstantin Taranov <[email protected]>
Quoted 41 lines
--- drivers/infiniband/hw/mana/cq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/infiniband/hw/mana/cq.cindex1becc8779..2dce1b677100644drivers/infiniband/hw/mana/cq.c +1
-0@@ -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) {drivers/infiniband/hw/mana/cq.c +0
-2if (udata->inlen < offsetof(struct mana_ib_create_cq , flags))@@ -35,8 +36,6 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const structib_cq_init_attr *attr, return err; } - is_rnic_cq = !!(ucmd.flags &MANA_IB_CREATE_RNIC_CQ ); - if ((!is_rnic_cq && attr->cqe > mdev-Quoted 1 line
adapter_caps.max_qp_wr) ||
drivers/infiniband/hw/mana/cq.c +0
-0attr->cqe > U32_MAX / COMP_ENTRY_SIZE) { ibdev_dbg(ibdev, "CQE %d exceeding limit\n", attr-Quoted 1 line
cqe); @@ -55,7 +54,6 @@ int mana_ib_create_cq(struct
ib_cq*ibcq, conststruct
ib_cq_init_attr*attr,drivers/infiniband/hw/mana/cq.c +0
-1ibucontext); doorbell = mana_ucontext->doorbell; }else { - is_rnic_cq = true; buf_size = MANA_PAGE_ALIGN(roundup_pow_of_two(attr-Quoted 1 line
cqe *
COMP_ENTRY_SIZE));drivers/infiniband/hw/mana/cq.c +0
-0cq->cqe = buf_size /COMP_ENTRY_SIZE ; err = mana_ib_create_kernel_queue(mdev, buf_size,
GDMA_CQ,&cq->queue);
--
2.43.0
Quoted 25 lines · Konstantin Taranov
From: Konstantin Taranov <[email protected]>
Get CQ type from the used gdma device. The
MANA_IB_CREATE_RNIC_CQflag is ignored. It was used in older kernel versions where themana_ibwas shared between ethernet and rnic.Fixes d4293f96ce0b ("RDMA/mana_ib: unify mana_ib functions to support any gdma device")Signed-off-by Konstantin Taranov <[email protected]>--- drivers/infiniband/hw/mana/cq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/infiniband/hw/mana/cq.c +1
-0@@ -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))
drivers/infiniband/hw/mana/cq.c int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, · line 38
Quoted 4 lines
drivers/infiniband/hw/mana/cq.c +0
-1@@ -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
Quoted 15 lines
drivers/infiniband/hw/mana/cq.c +0
-2-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);Signature · 1 line
2.43.0
Konstantin Taranov
maintainerQuoted 9 lines
drivers/infiniband/hw/mana/cq.c int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, · line 38
Quoted 2 lines
drivers/infiniband/hw/mana/cq.c +0
-1- 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_CQfrom 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
Quoted 14 lines · Konstantin Taranov
Quoted 9 lines
drivers/infiniband/hw/mana/cq.c int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, · line 38
Quoted 2 lines
drivers/infiniband/hw/mana/cq.c +0
-1- 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_CQfrom 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.
Quoted 6 lines
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
Quoted 2 lines
Thanks
Konstantin Taranov
maintainerQuoted 19 lines · Konstantin Taranov
Quoted 11 lines
Quoted 9 lines
drivers/infiniband/hw/mana/cq.c int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, · line 38
Quoted 2 lines
drivers/infiniband/hw/mana/cq.c +0
-1- 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_CQfrom UAPI too.Thanks
Hi Leon. I thought that my proposed change is backward and forward
compatible.
Quoted 2 lines
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.
Quoted 3 lines
So, the current solution is as follows:
rdma-core always sends the flag. The kernels without this patch still use
Quoted 8 lines
this flag.
Quoted 4 lines
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
Quoted 5 lines
Thanks
Quoted 2 lines
Thanks