From patchwork Wed Jul 25 20:10:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 10544631 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 49C82157A for ; Wed, 25 Jul 2018 20:11:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 341DB2AB46 for ; Wed, 25 Jul 2018 20:11:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3281A2ABA6; Wed, 25 Jul 2018 20:11:13 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,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 8B5982ABA4 for ; Wed, 25 Jul 2018 20:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729529AbeGYVYZ (ORCPT ); Wed, 25 Jul 2018 17:24:25 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41855 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730219AbeGYVYZ (ORCPT ); Wed, 25 Jul 2018 17:24:25 -0400 Received: by mail-wr1-f68.google.com with SMTP id j5-v6so8517296wrr.8 for ; Wed, 25 Jul 2018 13:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r4OENs9TJdePAcbcVfG38VBRM1NVwlglkJe5bCoUkBc=; b=sJciSQ5l0r1bF5visQ0AxSqM3Dfbu1M9dNMn2+TIsY53g556OfQFcQ7XBRnwybHMaO BqBNbvMsCcASanKRtLl7fZRKd+P4sW++I7HCloHOQiMNZs12mj68tNX6lMtTp6fUg8+A NtHjM3dG0N2zQBqTIBi+VILPPRjfygblGOu2YNbByGf76FB0Wly2hY4YEJJkLYCFy1pN qDucNjN+13BIdaf7ZSGMJC/uQyVE+NxZAADz/qDUzBpZ2FJRy9EFyST2yF0NJaONyPsd b3K5/1Wy9N22o3y8n6yuwF+9sFrc4yDKmQz68oJVDjnvlO9Hlu+y1eBxyL60j8zXj54H KrQg== 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=r4OENs9TJdePAcbcVfG38VBRM1NVwlglkJe5bCoUkBc=; b=hxkmZbHUdyv7FbCSkrSOSBFGJ2hOpBomgO2CZRw2pH2UvFd7OTwSkcYD1Yf8c8vh2m Wmlkl+TZBn51ydNh7Ymx+3k80FGPlzd4qlqxSBTsnMXGniEJG2PdY5QA2dZ+4SUM89RN IFhNd6skbxyWkPJwB1635sgUM+LljZpTn9PyMzjMDe8dCN41dlTzWI6fh01GzZj7eV7p yR+2KneYTRj8007Lslc3XpTFPXkjPnETPsYb2q2VAcXkNsP5I+Pd80o5eLC5oCjyy7PE LnLjvyZBMhhfG4DxI5F+esGOGRAI9YeCUJyzxTh7f/wbES0VF7Lb4jpAPG39ImgBUzYM H29A== X-Gm-Message-State: AOUpUlFPfvkRHWR5Z5kHVG3H5FNqSg1Vwn28AvV56vS4eBs6Gfgh3SZE CPztVbDzt9VeUbP+fNewbtZrx1D4 X-Google-Smtp-Source: AAOMgpcf9bb6uvEgTPCdaerkNiZFn08tMmMuhQP6BE+XvJeWIqp38rEq37zhPWs/YImZTQ1SRNRujQ== X-Received: by 2002:adf:f64c:: with SMTP id x12-v6mr14543881wrp.97.1532549470184; Wed, 25 Jul 2018 13:11:10 -0700 (PDT) Received: from localhost.localdomain (bzq-109-64-56-95.red.bezeqint.net. [109.64.56.95]) by smtp.gmail.com with ESMTPSA id d26-v6sm3708629wmb.15.2018.07.25.13.11.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jul 2018 13:11:09 -0700 (PDT) From: Kamal Heib To: Doug Ledford , Jason Gunthorpe , Leon Romanovsky , Shiraz Saleem Cc: linux-rdma@vger.kernel.org, Kamal Heib Subject: [PATCH rdma-next v3 1/3] RDMA/core: Remove mandatory verbs check Date: Wed, 25 Jul 2018 23:10:43 +0300 Message-Id: <20180725201045.26995-2-kamalheib1@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180725201045.26995-1-kamalheib1@gmail.com> References: <20180725201045.26995-1-kamalheib1@gmail.com> 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 Removing the check for mandatory verbs because not all providers are implementing them. Signed-off-by: Kamal Heib --- drivers/infiniband/core/device.c | 45 ---------------------------------------- 1 file changed, 45 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index b8144f194777..c6fd0ec344b7 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -93,46 +93,6 @@ static struct notifier_block ibdev_lsm_nb = { .notifier_call = ib_security_change, }; -static int ib_device_check_mandatory(struct ib_device *device) -{ -#define IB_MANDATORY_FUNC(x) { offsetof(struct ib_device, x), #x } - static const struct { - size_t offset; - char *name; - } mandatory_table[] = { - IB_MANDATORY_FUNC(query_device), - IB_MANDATORY_FUNC(query_port), - IB_MANDATORY_FUNC(query_pkey), - IB_MANDATORY_FUNC(alloc_pd), - IB_MANDATORY_FUNC(dealloc_pd), - IB_MANDATORY_FUNC(create_ah), - IB_MANDATORY_FUNC(destroy_ah), - IB_MANDATORY_FUNC(create_qp), - IB_MANDATORY_FUNC(modify_qp), - IB_MANDATORY_FUNC(destroy_qp), - IB_MANDATORY_FUNC(post_send), - IB_MANDATORY_FUNC(post_recv), - IB_MANDATORY_FUNC(create_cq), - IB_MANDATORY_FUNC(destroy_cq), - IB_MANDATORY_FUNC(poll_cq), - IB_MANDATORY_FUNC(req_notify_cq), - IB_MANDATORY_FUNC(get_dma_mr), - IB_MANDATORY_FUNC(dereg_mr), - IB_MANDATORY_FUNC(get_port_immutable) - }; - int i; - - for (i = 0; i < ARRAY_SIZE(mandatory_table); ++i) { - if (!*(void **) ((void *) device + mandatory_table[i].offset)) { - pr_warn("Device %s is missing mandatory function %s\n", - device->name, mandatory_table[i].name); - return -EINVAL; - } - } - - return 0; -} - static struct ib_device *__ib_device_get_by_index(u32 index) { struct ib_device *device; @@ -502,11 +462,6 @@ int ib_register_device(struct ib_device *device, goto out; } - if (ib_device_check_mandatory(device)) { - ret = -EINVAL; - goto out; - } - ret = read_port_immutable(device); if (ret) { pr_warn("Couldn't create per port immutable data %s\n",