public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg-uk2M96/98Pc@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Yishai Hadas
	<yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Subject: [PATCH 8/8] verbs: Remove tests for NULL ops
Date: Mon,  8 Jan 2018 14:26:32 -0700	[thread overview]
Message-ID: <20180108212632.5183-9-jgg@ziepe.ca> (raw)
In-Reply-To: <20180108212632.5183-1-jgg-uk2M96/98Pc@public.gmane.org>

From: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

ops can no longer be null, the correct error return is generated inside
the dummy. This removes some overhead and fixes a missing errno = ENOSYS
in the create_srq path.

We cannot change the tests inlined the header file, since the app might link
to an older verbs.

Signed-off-by: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 libibverbs/device.c |  3 +--
 libibverbs/verbs.c  | 14 +-------------
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/libibverbs/device.c b/libibverbs/device.c
index 491918b1999fb4..e0cb16bae1bcf8 100644
--- a/libibverbs/device.c
+++ b/libibverbs/device.c
@@ -359,8 +359,7 @@ LATEST_SYMVER_FUNC(ibv_get_async_event, 1_1, "IBVERBS_1.1",
 		break;
 	}
 
-	if (context->ops.async_event)
-		context->ops.async_event(event);
+	context->ops.async_event(event);
 
 	return 0;
 }
diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c
index 65d9c1c8ca2fc4..c772335e06d71a 100644
--- a/libibverbs/verbs.c
+++ b/libibverbs/verbs.c
@@ -269,11 +269,6 @@ LATEST_SYMVER_FUNC(ibv_rereg_mr, 1_1, "IBVERBS_1.1",
 		return IBV_REREG_MR_ERR_INPUT;
 	}
 
-	if (!mr->context->ops.rereg_mr) {
-		errno = ENOSYS;
-		return IBV_REREG_MR_ERR_INPUT;
-	}
-
 	if (flags & IBV_REREG_MR_CHANGE_TRANSLATION) {
 		err = ibv_dontfork_range(addr, length);
 		if (err)
@@ -420,9 +415,6 @@ LATEST_SYMVER_FUNC(ibv_resize_cq, 1_1, "IBVERBS_1.1",
 		   int,
 		   struct ibv_cq *cq, int cqe)
 {
-	if (!cq->context->ops.resize_cq)
-		return ENOSYS;
-
 	return cq->context->ops.resize_cq(cq, cqe);
 }
 
@@ -459,8 +451,7 @@ LATEST_SYMVER_FUNC(ibv_get_cq_event, 1_1, "IBVERBS_1.1",
 	*cq         = (struct ibv_cq *) (uintptr_t) ev.cq_handle;
 	*cq_context = (*cq)->cq_context;
 
-	if ((*cq)->context->ops.cq_event)
-		(*cq)->context->ops.cq_event(*cq);
+	(*cq)->context->ops.cq_event(*cq);
 
 	return 0;
 }
@@ -482,9 +473,6 @@ LATEST_SYMVER_FUNC(ibv_create_srq, 1_1, "IBVERBS_1.1",
 {
 	struct ibv_srq *srq;
 
-	if (!pd->context->ops.create_srq)
-		return NULL;
-
 	srq = pd->context->ops.create_srq(pd, srq_init_attr);
 	if (srq) {
 		srq->context          = pd->context;
-- 
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-01-08 21:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 21:26 [PATCH rdma-core 0/8] Revise provider initialization Jason Gunthorpe
     [not found] ` <20180108212632.5183-1-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-08 21:26   ` [PATCH 1/8] verbs: Always allocate a verbs_context Jason Gunthorpe
     [not found]     ` <20180108212632.5183-2-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-10  5:46       ` Devesh Sharma
     [not found]         ` <CANjDDBjCUtdVcQBze0PVjC5EaXj5BGTQ5tcn6VcuG0P7auuxoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-10 17:34           ` Jason Gunthorpe
     [not found]             ` <20180110173427.GE4776-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-11 17:44               ` Devesh Sharma
     [not found]                 ` <CANjDDBgmueZ3fiRJsHEb+p5+H5gX8-7z0NbJShc2bk8yXrh+pg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-11 17:54                   ` Jason Gunthorpe
     [not found]                     ` <20180111175422.GG30208-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2018-01-12 11:08                       ` Devesh Sharma
2018-01-08 21:26   ` [PATCH 2/8] bnxt_re: Convert from init_context to alloc_context Jason Gunthorpe
     [not found]     ` <20180108212632.5183-3-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-10  5:53       ` Devesh Sharma
     [not found]         ` <CANjDDBjwmtO2aOtY5NCObrU_VJVmHjw=fdJOk_VvfZx+8+4Ejw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-10 17:36           ` Jason Gunthorpe
2018-01-08 21:26   ` [PATCH 3/8] mlx4: " Jason Gunthorpe
2018-01-08 21:26   ` [PATCH 4/8] mlx5: " Jason Gunthorpe
2018-01-08 21:26   ` [PATCH 5/8] verbs: Remove init_context/uninit_context Jason Gunthorpe
     [not found]     ` <20180108212632.5183-6-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-10  5:59       ` Devesh Sharma
2018-01-08 21:26   ` [PATCH 6/8] verbs: Provide a default implementation for every verbs op Jason Gunthorpe
2018-01-08 21:26   ` [PATCH 7/8] verbs: Convert all providers to use verbs_set_ops Jason Gunthorpe
2018-01-08 21:26   ` Jason Gunthorpe [this message]
2018-01-10 22:05   ` [PATCH rdma-core 0/8] Revise provider initialization Steve Wise
2018-01-10 22:06     ` Steve Wise
2018-01-10 22:27     ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180108212632.5183-9-jgg@ziepe.ca \
    --to=jgg-uk2m96/98pc@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox