Skip to contentSkip to conversation

create_user_ah introduction fixups

PATCH In review Gal Pressman 4 participants 8 messages Nov 15, 2020 – Nov 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover create_user_ah introduction fixups

The first patch fixes the create_ah NULL check to only happen in case of kernel AH (!udata).
The second patch removes the create_ah callback from EFA as it does not support kverbs.

Thanks,
Gal

Gal Pressman (2):
RDMA/core: Check .create_ah is not NULL only in case it's needed RDMA/efa: Remove .create_ah callback assignment

 drivers/infiniband/core/verbs.c      | 2 +-
 drivers/infiniband/hw/efa/efa_main.c | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/2 RDMA/core: Check .create_ah is not NULL only in case it's needed

Drivers now expose two callbacks for address handle creation, one for uverbs and one for kverbs. The function pointer NULL check in _rdma_create_ah() should only happen if !udata.

A NULL check for .create_user_ah is not needed as it is validated by the uverbs uapi definitions.

Fixes 676a80adba01 ("RDMA: Remove AH from uverbs_cmd_mask")
---
 drivers/infiniband/core/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/verbs.c +1 -1
index ab1e6048685e..33778f8674a1 100644
@@ -516,7 +516,7 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
 
 	might_sleep_if(flags & RDMA_CREATE_AH_SLEEPABLE);
 
-	if (!device->ops.create_ah)
+	if (!udata && !device->ops.create_ah)
 		return ERR_PTR(-EOPNOTSUPP);
 
 	ah = rdma_zalloc_drv_obj_gfp(
Signature · 1 line
2.29.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH for-next 1/2] RDMA/core: Check .create_ah is not NULL only in case it's needed

Quoted 4 lines · Gal Pressman

Drivers now expose two callbacks for address handle creation, one for uverbs and one for kverbs. The function pointer NULL check in _rdma_create_ah() should only happen if !udata.

Quoted 9 lines

A NULL check for .create_user_ah is not needed as it is validated by the uverbs uapi definitions.

Fixes 676a80adba01 ("RDMA: Remove AH from uverbs_cmd_mask")
---
 drivers/infiniband/core/verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

#3 lore raw

Re: [PATCH for-next 1/2] RDMA/core: Check .create_ah is not NULL only in case it's needed

In reply to Gal Pressman
Quoted 8 lines · Gal Pressman

Drivers now expose two callbacks for address handle creation, one for uverbs and one for kverbs. The function pointer NULL check in _rdma_create_ah() should only happen if !udata.

A NULL check for .create_user_ah is not needed as it is validated by the uverbs uapi definitions.

Fixes 676a80adba01 ("RDMA: Remove AH from uverbs_cmd_mask")

Why is this a fixes? It makes sense in the context of the next patch, but it doesn't look like any driver sets ops.create_ah == NULL ?

Jason

#4 lore raw

Re: [PATCH for-next 1/2] RDMA/core: Check .create_ah is not NULL only in case it's needed

Quoted 5 lines · Jason Gunthorpe
Quoted 4 lines · Gal Pressman

Drivers now expose two callbacks for address handle creation, one for uverbs and one for kverbs. The function pointer NULL check in _rdma_create_ah() should only happen if !udata.

Quoted 7 lines
Quoted 4 lines

A NULL check for .create_user_ah is not needed as it is validated by the uverbs uapi definitions.

Fixes 676a80adba01 ("RDMA: Remove AH from uverbs_cmd_mask")

Why is this a fixes? It makes sense in the context of the next patch, but it doesn't look like any driver sets ops.create_ah == NULL ?

I assumed that the NULL check should be changed regardless as it makes more sense to only check the callback if it's used.
You can remove it if you prefer, I just hope the second patch won't be accidentally picked up without this one.

#5 lore raw

PATCH 2/2 RDMA/efa: Remove .create_ah callback assignment

In reply to Gal Pressman

The AH creation flow is now split to two callbacks, based on uverbs/kverbs. EFA only supports uverbs so the .create_ah assignment can be removed.

Fixes 676a80adba01 ("RDMA: Remove AH from uverbs_cmd_mask")
---
 drivers/infiniband/hw/efa/efa_main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/infiniband/hw/efa/efa_main.c +0 -1
index 2b3da85fb43c..cb2f2c647ee5 100644
@@ -245,7 +245,6 @@ static const struct ib_device_ops efa_dev_ops = {
 	.alloc_hw_stats = efa_alloc_hw_stats,
 	.alloc_pd = efa_alloc_pd,
 	.alloc_ucontext = efa_alloc_ucontext,
-	.create_ah = efa_create_ah,
 	.create_cq = efa_create_cq,
 	.create_qp = efa_create_qp,
 	.create_user_ah = efa_create_ah,
Signature · 1 line
2.29.2
Acked-by on v1 2/2
#6 lore raw

Re: [PATCH for-next 2/2] RDMA/efa: Remove .create_ah callback assignment

Quoted 10 lines · Gal Pressman

The AH creation flow is now split to two callbacks, based on uverbs/kverbs. EFA only supports uverbs so the .create_ah assignment can be removed.

Fixes 676a80adba01 ("RDMA: Remove AH from uverbs_cmd_mask")
---
 drivers/infiniband/hw/efa/efa_main.c | 1 -
 1 file changed, 1 deletion(-)

Thanks,

maintainer
#7 lore raw
In reply to Gal Pressman
Quoted 11 lines · Gal Pressman

The first patch fixes the create_ah NULL check to only happen in case of kernel AH (!udata).
The second patch removes the create_ah callback from EFA as it does not support kverbs.

Thanks,
Gal

Gal Pressman (2):
RDMA/core: Check .create_ah is not NULL only in case it's needed RDMA/efa: Remove .create_ah callback assignment

I squashed them together, thanks

Jason