From patchwork Tue Jan 8 12:42:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 10751975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C01091399 for ; Tue, 8 Jan 2019 12:42:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAA5F28C47 for ; Tue, 8 Jan 2019 12:42:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C0BF28C4E; Tue, 8 Jan 2019 12:42:26 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4590428C47 for ; Tue, 8 Jan 2019 12:42:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727473AbfAHMm0 (ORCPT ); Tue, 8 Jan 2019 07:42:26 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:63540 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727236AbfAHMmZ (ORCPT ); Tue, 8 Jan 2019 07:42:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1546951344; x=1578487344; h=from:to:cc:subject:date:message-id:mime-version; bh=WobUfJTWQD1yaDpMoKZmAjmHKL4NlGfYVxfP/dbxju8=; b=K0yC2AoyMXrGLz9PLB3HZoVvenmNTSx4XCwsST8tRsyKcLvZlsXfJatn Q8ZIzsGX7F0npIXkyjf9PLDTaLsmofMXA/pOt/NYfjBHFdR+fQWNqcKyQ X+MQJaG1NcmnjhZAzwdqCbNiVwllI0l8TcBwy8Z6LVPIps6fQwrnNj9KT s=; X-IronPort-AV: E=Sophos;i="5.56,253,1539648000"; d="scan'208";a="775241017" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 Jan 2019 12:42:22 +0000 Received: from EX13MTAUWC001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-6e2fc477.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id x08CgLN0013361 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 8 Jan 2019 12:42:21 GMT Received: from EX13D19UWC001.ant.amazon.com (10.43.162.64) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 8 Jan 2019 12:42:21 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13D19UWC001.ant.amazon.com (10.43.162.64) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 8 Jan 2019 12:42:20 +0000 Received: from galpress-VirtualBox.hfa16.amazon.com (10.218.62.29) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 8 Jan 2019 12:42:17 +0000 From: Gal Pressman To: Jason Gunthorpe , Doug Ledford CC: , Alexander Matushevsky , Yossi Leybovich , Dave Goodell , "Brian Barrett" , Leah Shalev , Sean Hefty , Sagi Grimberg , Leon Romanovsky , Gal Pressman Subject: [PATCH rdma-next v3 0/2] IB device in-kernel API support indication Date: Tue, 8 Jan 2019 14:42:11 +0200 Message-ID: <1546951333-8109-1-git-send-email-galpress@amazon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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 Hello all, This patchset marks drivers that do not implement all mandatory verbs for kverbs as non-kverbs providers though a flag in the IB device. Currently, ULPs add the device and fail when trying to make actual use. Instead, in case of missing verbs, mark the device as a non-kverbs provider and allow clients to exit gracefully. This also removes the need for stubs implementation of unsupported verbs, which will no longer fail the device registration but mark the device as non-kverbs provider. A 'no_kverbs_req' flag is added to the ib_clients, which is off by default except for uverbs. This is added in order to identify the uverbs module when registering a new device/client. It can also be done using name comparison but the flag seems better to me. Patch #1 adds the flag to the IB device and marks devices that do not implement all needed kverbs functions. Patch #2 removes all stub functions from usnic. Another pair of eyes going through the different callback usage flows is welcome :), flows that are already protected (uapi METHOD_NEEDS_FN NULL check, kernel verbs only flows) do not check for NULL prior to using callback. This patchset is introduced following the discussion over the EFA driver [1], which initially does not provide in-kernel API support. [1] https://patchwork.kernel.org/cover/10711629/ Changelog: v2->v3 * Remove warning print when mandatory verb is not implemented * Change comment of no_kverbs_req flag * Add NULL checks for callbacks in unprotected flows v1->v2 * Make core code mark devices instead of having each driver advertise its support * Prevent clients device addition in core code instead of inside the clients Thanks, Gal Gal Pressman (2): RDMA: Add indication for in kernel API support to IB device IB/usnic: Remove stub functions drivers/infiniband/core/device.c | 41 +++++++++++++-------- drivers/infiniband/core/uverbs_main.c | 1 + drivers/infiniband/core/verbs.c | 28 +++++++++++++-- drivers/infiniband/hw/mlx5/main.c | 3 ++ 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 -------- include/rdma/ib_verbs.h | 5 +++ 8 files changed, 60 insertions(+), 93 deletions(-)