diff mbox series

[RFC,v2,2/2] IB/usnic: Remove stub functions

Message ID 1546766583-27979-3-git-send-email-galpress@amazon.com (mailing list archive)
State Superseded
Headers show
Series IB device in-kernel API support indication | expand

Commit Message

Gal Pressman Jan. 6, 2019, 9:23 a.m. UTC
Lack of mandatory verbs no longer fail device registration, the device
will be marked as a non-kverbs provider.

Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/hw/usnic/usnic_ib_main.c  |  7 ----
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 53 ----------------------------
 drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 15 --------
 3 files changed, 75 deletions(-)

Comments

Leon Romanovsky Jan. 6, 2019, 11:17 a.m. UTC | #1
On Sun, Jan 06, 2019 at 11:23:03AM +0200, Gal Pressman wrote:
> Lack of mandatory verbs no longer fail device registration, the device
> will be marked as a non-kverbs provider.
>
> Signed-off-by: Gal Pressman <galpress@amazon.com>
> ---
>  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  7 ----
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 53 ----------------------------
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 15 --------
>  3 files changed, 75 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Jason Gunthorpe Jan. 6, 2019, 9:49 p.m. UTC | #2
On Sun, Jan 06, 2019 at 11:23:03AM +0200, Gal Pressman wrote:
> Lack of mandatory verbs no longer fail device registration, the device
> will be marked as a non-kverbs provider.
> 
> Signed-off-by: Gal Pressman <galpress@amazon.com>
> ---
>  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  7 ----
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 53 ----------------------------
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 15 --------
>  3 files changed, 75 deletions(-)

You need to cc the driver maintainers on patches like this. They
should probably ack this..
 
> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> index b2323a52a0dd..cc68f3d757eb 100644
> --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
> +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> @@ -333,32 +333,25 @@ static void usnic_get_dev_fw_str(struct ib_device *device, char *str)
>  static const struct ib_device_ops usnic_dev_ops = {
>  	.alloc_pd = usnic_ib_alloc_pd,
>  	.alloc_ucontext = usnic_ib_alloc_ucontext,
> -	.create_ah = usnic_ib_create_ah,
>  	.create_cq = usnic_ib_create_cq,
>  	.create_qp = usnic_ib_create_qp,
>  	.dealloc_pd = usnic_ib_dealloc_pd,
>  	.dealloc_ucontext = usnic_ib_dealloc_ucontext,
>  	.dereg_mr = usnic_ib_dereg_mr,
> -	.destroy_ah = usnic_ib_destroy_ah,
>  	.destroy_cq = usnic_ib_destroy_cq,
>  	.destroy_qp = usnic_ib_destroy_qp,
>  	.get_dev_fw_str = usnic_get_dev_fw_str,
> -	.get_dma_mr = usnic_ib_get_dma_mr,
>  	.get_link_layer = usnic_ib_port_link_layer,
>  	.get_netdev = usnic_get_netdev,
>  	.get_port_immutable = usnic_port_immutable,
>  	.mmap = usnic_ib_mmap,
>  	.modify_qp = usnic_ib_modify_qp,
> -	.poll_cq = usnic_ib_poll_cq,
> -	.post_recv = usnic_ib_post_recv,
> -	.post_send = usnic_ib_post_send,
>  	.query_device = usnic_ib_query_device,
>  	.query_gid = usnic_ib_query_gid,
>  	.query_pkey = usnic_ib_query_pkey,
>  	.query_port = usnic_ib_query_port,
>  	.query_qp = usnic_ib_query_qp,
>  	.reg_user_mr = usnic_ib_reg_mr,
> -	.req_notify_cq = usnic_ib_req_notify_cq,
>  };

Did you audit that uverbs doesn't crash if these are made NULL,
including ioctl?

Jason
Gal Pressman Jan. 7, 2019, 8:09 a.m. UTC | #3
On 06-Jan-19 23:49, Jason Gunthorpe wrote:
> On Sun, Jan 06, 2019 at 11:23:03AM +0200, Gal Pressman wrote:
>> Lack of mandatory verbs no longer fail device registration, the device
>> will be marked as a non-kverbs provider.
>>
>> Signed-off-by: Gal Pressman <galpress@amazon.com>
>> ---
>>  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  7 ----
>>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 53 ----------------------------
>>  drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 15 --------
>>  3 files changed, 75 deletions(-)
> 
> You need to cc the driver maintainers on patches like this. They
> should probably ack this..

ACK.

>  
>> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
>> index b2323a52a0dd..cc68f3d757eb 100644
>> --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
>> +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
>> @@ -333,32 +333,25 @@ static void usnic_get_dev_fw_str(struct ib_device *device, char *str)
>>  static const struct ib_device_ops usnic_dev_ops = {
>>  	.alloc_pd = usnic_ib_alloc_pd,
>>  	.alloc_ucontext = usnic_ib_alloc_ucontext,
>> -	.create_ah = usnic_ib_create_ah,
>>  	.create_cq = usnic_ib_create_cq,
>>  	.create_qp = usnic_ib_create_qp,
>>  	.dealloc_pd = usnic_ib_dealloc_pd,
>>  	.dealloc_ucontext = usnic_ib_dealloc_ucontext,
>>  	.dereg_mr = usnic_ib_dereg_mr,
>> -	.destroy_ah = usnic_ib_destroy_ah,
>>  	.destroy_cq = usnic_ib_destroy_cq,
>>  	.destroy_qp = usnic_ib_destroy_qp,
>>  	.get_dev_fw_str = usnic_get_dev_fw_str,
>> -	.get_dma_mr = usnic_ib_get_dma_mr,
>>  	.get_link_layer = usnic_ib_port_link_layer,
>>  	.get_netdev = usnic_get_netdev,
>>  	.get_port_immutable = usnic_port_immutable,
>>  	.mmap = usnic_ib_mmap,
>>  	.modify_qp = usnic_ib_modify_qp,
>> -	.poll_cq = usnic_ib_poll_cq,
>> -	.post_recv = usnic_ib_post_recv,
>> -	.post_send = usnic_ib_post_send,
>>  	.query_device = usnic_ib_query_device,
>>  	.query_gid = usnic_ib_query_gid,
>>  	.query_pkey = usnic_ib_query_pkey,
>>  	.query_port = usnic_ib_query_port,
>>  	.query_qp = usnic_ib_query_qp,
>>  	.reg_user_mr = usnic_ib_reg_mr,
>> -	.req_notify_cq = usnic_ib_req_notify_cq,
>>  };
> 
> Did you audit that uverbs doesn't crash if these are made NULL,
> including ioctl?

Mistakenly assumed that uverbs checks for NULL, will fix.
Leon Romanovsky Jan. 7, 2019, 8:14 a.m. UTC | #4
On Mon, Jan 07, 2019 at 10:09:02AM +0200, Gal Pressman wrote:
> On 06-Jan-19 23:49, Jason Gunthorpe wrote:
> > On Sun, Jan 06, 2019 at 11:23:03AM +0200, Gal Pressman wrote:
> >> Lack of mandatory verbs no longer fail device registration, the device
> >> will be marked as a non-kverbs provider.
> >>
> >> Signed-off-by: Gal Pressman <galpress@amazon.com>
> >> ---
> >>  drivers/infiniband/hw/usnic/usnic_ib_main.c  |  7 ----
> >>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 53 ----------------------------
> >>  drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 15 --------
> >>  3 files changed, 75 deletions(-)
> >
> > You need to cc the driver maintainers on patches like this. They
> > should probably ack this..
>
> ACK.
>
> >
> >> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> >> index b2323a52a0dd..cc68f3d757eb 100644
> >> --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
> >> +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
> >> @@ -333,32 +333,25 @@ static void usnic_get_dev_fw_str(struct ib_device *device, char *str)
> >>  static const struct ib_device_ops usnic_dev_ops = {
> >>  	.alloc_pd = usnic_ib_alloc_pd,
> >>  	.alloc_ucontext = usnic_ib_alloc_ucontext,
> >> -	.create_ah = usnic_ib_create_ah,
> >>  	.create_cq = usnic_ib_create_cq,
> >>  	.create_qp = usnic_ib_create_qp,
> >>  	.dealloc_pd = usnic_ib_dealloc_pd,
> >>  	.dealloc_ucontext = usnic_ib_dealloc_ucontext,
> >>  	.dereg_mr = usnic_ib_dereg_mr,
> >> -	.destroy_ah = usnic_ib_destroy_ah,
> >>  	.destroy_cq = usnic_ib_destroy_cq,
> >>  	.destroy_qp = usnic_ib_destroy_qp,
> >>  	.get_dev_fw_str = usnic_get_dev_fw_str,
> >> -	.get_dma_mr = usnic_ib_get_dma_mr,
> >>  	.get_link_layer = usnic_ib_port_link_layer,
> >>  	.get_netdev = usnic_get_netdev,
> >>  	.get_port_immutable = usnic_port_immutable,
> >>  	.mmap = usnic_ib_mmap,
> >>  	.modify_qp = usnic_ib_modify_qp,
> >> -	.poll_cq = usnic_ib_poll_cq,
> >> -	.post_recv = usnic_ib_post_recv,
> >> -	.post_send = usnic_ib_post_send,
> >>  	.query_device = usnic_ib_query_device,
> >>  	.query_gid = usnic_ib_query_gid,
> >>  	.query_pkey = usnic_ib_query_pkey,
> >>  	.query_port = usnic_ib_query_port,
> >>  	.query_qp = usnic_ib_query_qp,
> >>  	.reg_user_mr = usnic_ib_reg_mr,
> >> -	.req_notify_cq = usnic_ib_req_notify_cq,
> >>  };
> >
> > Did you audit that uverbs doesn't crash if these are made NULL,
> > including ioctl?
>
> Mistakenly assumed that uverbs checks for NULL, will fix.

Some of them yes, at least the ones I checked.

>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index b2323a52a0dd..cc68f3d757eb 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -333,32 +333,25 @@  static void usnic_get_dev_fw_str(struct ib_device *device, char *str)
 static const struct ib_device_ops usnic_dev_ops = {
 	.alloc_pd = usnic_ib_alloc_pd,
 	.alloc_ucontext = usnic_ib_alloc_ucontext,
-	.create_ah = usnic_ib_create_ah,
 	.create_cq = usnic_ib_create_cq,
 	.create_qp = usnic_ib_create_qp,
 	.dealloc_pd = usnic_ib_dealloc_pd,
 	.dealloc_ucontext = usnic_ib_dealloc_ucontext,
 	.dereg_mr = usnic_ib_dereg_mr,
-	.destroy_ah = usnic_ib_destroy_ah,
 	.destroy_cq = usnic_ib_destroy_cq,
 	.destroy_qp = usnic_ib_destroy_qp,
 	.get_dev_fw_str = usnic_get_dev_fw_str,
-	.get_dma_mr = usnic_ib_get_dma_mr,
 	.get_link_layer = usnic_ib_port_link_layer,
 	.get_netdev = usnic_get_netdev,
 	.get_port_immutable = usnic_port_immutable,
 	.mmap = usnic_ib_mmap,
 	.modify_qp = usnic_ib_modify_qp,
-	.poll_cq = usnic_ib_poll_cq,
-	.post_recv = usnic_ib_post_recv,
-	.post_send = usnic_ib_post_send,
 	.query_device = usnic_ib_query_device,
 	.query_gid = usnic_ib_query_gid,
 	.query_pkey = usnic_ib_query_pkey,
 	.query_port = usnic_ib_query_port,
 	.query_qp = usnic_ib_query_qp,
 	.reg_user_mr = usnic_ib_reg_mr,
-	.req_notify_cq = usnic_ib_req_notify_cq,
 };
 
 /* Start of PF discovery section */
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 1d4abef17e38..53c9e9b8b5c9 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -760,57 +760,4 @@  int usnic_ib_mmap(struct ib_ucontext *context,
 	return -EINVAL;
 }
 
-/* In ib callbacks section -  Start of stub funcs */
-struct ib_ah *usnic_ib_create_ah(struct ib_pd *pd,
-				 struct rdma_ah_attr *ah_attr,
-				 u32 flags,
-				 struct ib_udata *udata)
-
-{
-	usnic_dbg("\n");
-	return ERR_PTR(-EPERM);
-}
-
-int usnic_ib_destroy_ah(struct ib_ah *ah, u32 flags)
-{
-	usnic_dbg("\n");
-	return -EINVAL;
-}
-
-int usnic_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
-		       const struct ib_send_wr **bad_wr)
-{
-	usnic_dbg("\n");
-	return -EINVAL;
-}
-
-int usnic_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
-		       const struct ib_recv_wr **bad_wr)
-{
-	usnic_dbg("\n");
-	return -EINVAL;
-}
-
-int usnic_ib_poll_cq(struct ib_cq *ibcq, int num_entries,
-				struct ib_wc *wc)
-{
-	usnic_dbg("\n");
-	return -EINVAL;
-}
-
-int usnic_ib_req_notify_cq(struct ib_cq *cq,
-					enum ib_cq_notify_flags flags)
-{
-	usnic_dbg("\n");
-	return -EINVAL;
-}
-
-struct ib_mr *usnic_ib_get_dma_mr(struct ib_pd *pd, int acc)
-{
-	usnic_dbg("\n");
-	return ERR_PTR(-ENOMEM);
-}
-
-
-/* In ib callbacks section - End of stub funcs */
 /* End of ib callbacks section */
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
index e33144261b9a..99a6d81c2bcd 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h
@@ -75,19 +75,4 @@  struct ib_ucontext *usnic_ib_alloc_ucontext(struct ib_device *ibdev,
 int usnic_ib_dealloc_ucontext(struct ib_ucontext *ibcontext);
 int usnic_ib_mmap(struct ib_ucontext *context,
 			struct vm_area_struct *vma);
-struct ib_ah *usnic_ib_create_ah(struct ib_pd *pd,
-				 struct rdma_ah_attr *ah_attr,
-				 u32 flags,
-				 struct ib_udata *udata);
-
-int usnic_ib_destroy_ah(struct ib_ah *ah, u32 flags);
-int usnic_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
-			const struct ib_send_wr **bad_wr);
-int usnic_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
-		       const struct ib_recv_wr **bad_wr);
-int usnic_ib_poll_cq(struct ib_cq *ibcq, int num_entries,
-			struct ib_wc *wc);
-int usnic_ib_req_notify_cq(struct ib_cq *cq,
-				enum ib_cq_notify_flags flags);
-struct ib_mr *usnic_ib_get_dma_mr(struct ib_pd *pd, int acc);
 #endif /* !USNIC_IB_VERBS_H */