From patchwork Mon Jan 8 21:26:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10150599 X-Patchwork-Delegate: leon@leon.nu Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC53D60210 for ; Mon, 8 Jan 2018 21:26:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9DD727D29 for ; Mon, 8 Jan 2018 21:26:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEB662823E; Mon, 8 Jan 2018 21:26:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79A8727D29 for ; Mon, 8 Jan 2018 21:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755566AbeAHV0t (ORCPT ); Mon, 8 Jan 2018 16:26:49 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38388 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753338AbeAHV0q (ORCPT ); Mon, 8 Jan 2018 16:26:46 -0500 Received: by mail-wr0-f194.google.com with SMTP id 60so3138356wrl.5 for ; Mon, 08 Jan 2018 13:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lSXl70L03kN3KzYFRNbn3En/6QUfIAO5kR/pGNSifwU=; b=gIsxKbg54JFQBSyCb0V+uf/+NGnZKi2xZUekQpI4gfEX6VrFPZqaNPZc+LKkdq2xZe 8qQpAVIfvK3gqcn/df7vy8sjHr+sbSB0n/eCD2HH4moqzk615FB9AvBS6i20CHHJLpZs kxewuEnKf9tFRwyJqRiqzOG/eg479997ou9qyNTYY7xzosrAsvYq0fSrFQR7rZGi2rwx UYrhsDFVas1GM3GiDR+t+B96ifm4aufIj/sjC+Iy5rU+SmjE+NtkmAqgTljIHQD2/nkj vtYqyHbKFk5YiZ+538X8lYrhVnh8v9QVM5bzu+2dseMMfp5ICOMyR2fuYbonBXawepyq H4PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lSXl70L03kN3KzYFRNbn3En/6QUfIAO5kR/pGNSifwU=; b=m8FIyFD4jekfuAtk8vfAYko4PwKQ+2EPgazVSthDMzFU8TvXmVmkkskmNcQDHEsj9X +BeJ2322ChjrLcgKsgFYGnhoyxIddJry25/Uo+2hJCLqvNdFcPDaaqQWAw9dFet85sr5 Mf07pHinVdoWX0gagpvWTwfiCfwK9FWicY9GGBcE80jJr70l1wi22xMR83qap4W2TZh6 cOTF5o7GWtbLSYN4xuqP4JZNkn6cs3EIEI+b45hTPjibrK9nARdSExsChN+8iy8icm9F nqJFP/lhxUx2XKYKVztmc2m4eaX/IsvF3Pk+cJ/RS/RiQTcPb/ZCTIRUANJrEFuHRqiS 00Ng== X-Gm-Message-State: AKGB3mKMYVCX4oHTTktA6DFVnRN2YGjE8u4mIKA5ewntXmMEsNN5BOr2 mzXwH0A2PS23wLhqz1wwlkTIm+JPPeE= X-Google-Smtp-Source: ACJfBouDqsva3JdqQeKBhtPs5ZYlrEZ4Jhx6TSQ7VOVAKTRlwzdME4pzkxNI97tjXFuRwFjAkDWiqw== X-Received: by 10.223.201.129 with SMTP id f1mr10560648wrh.274.1515446804819; Mon, 08 Jan 2018 13:26:44 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id j125sm13880216wmd.24.2018.01.08.13.26.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 13:26:42 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eYewK-0001P3-22; Mon, 08 Jan 2018 14:26:40 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Doug Ledford , Yishai Hadas Subject: [PATCH 8/8] verbs: Remove tests for NULL ops Date: Mon, 8 Jan 2018 14:26:32 -0700 Message-Id: <20180108212632.5183-9-jgg@ziepe.ca> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108212632.5183-1-jgg@ziepe.ca> References: <20180108212632.5183-1-jgg@ziepe.ca> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe 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 --- 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;