From patchwork Tue Jul 14 08:10:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11661919 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE1081392 for ; Tue, 14 Jul 2020 08:10:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D415F217D8 for ; Tue, 14 Jul 2020 08:10:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uDDXMVLD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725884AbgGNIKx (ORCPT ); Tue, 14 Jul 2020 04:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNIKw (ORCPT ); Tue, 14 Jul 2020 04:10:52 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D552C061755 for ; Tue, 14 Jul 2020 01:10:52 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id q5so20215572wru.6 for ; Tue, 14 Jul 2020 01:10:52 -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 :mime-version:content-transfer-encoding; bh=P3FeplwX7HmH0XJSqMZAz23/5QljzWQMWm3qFcvrstI=; b=uDDXMVLDNK1uB9y9f8/AC5+PHDgAyKfmge1uUxueceMf/zF+HZ+CHAcmSxlL5T2ghu NLkbHKqFvKqB1ui4nUtTOQ9KSen201g0IIEh7VRfKd6bF/fWIDuqcrQ8Jjf8pY7I3zqc rONZdDsYh6yYOJySMfgdVnyH0BsDM2a/7dsKQu4+zKqd7aSyFogiTROdrbNgDdZD6q5U PIfUH8Fsw/dStM+cc5XGrqsJTculN7IYi8izjzBBiagCPn7VHkwnNNo78gQeyMMaYIIa uQ/xYHlExL2y/9jrEbLXjpmIWN5SaGDZcYLNDJEXkOQCLKbUqIrDhlHfDG89TGAgQRHz s6Fg== 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:mime-version:content-transfer-encoding; bh=P3FeplwX7HmH0XJSqMZAz23/5QljzWQMWm3qFcvrstI=; b=EHfyIxXlFvCdrOvY32y8UNdd1PMQ4y7d5qe3GPK2pyNGQLamW978zESl6pXbfYxZIU K7RKKXCxnZ1TDUkmvzoMCevUAE4p2nY/C/NNMEH35FQSiut/QJDDuHD+7BQF7ntrUuOi PJxQAoKftGexNPMd+ZPYgk7dvMYozt9MB9SeEGc0P0VAwPUPyvImva/edur/Jp9HpXaX m2elc8GK6qsoXMqn4XyuoZztrs8hkq48sSptwrYl/cRN7TogIal/WWHazUopPkq1Aa4g wo9EhR/dDxW43m9t8cGCp7T1jd4kD5sqVIuPYZZAhkAf2i5tT2fnAhOxzM6buzq3Q5H0 nb9g== X-Gm-Message-State: AOAM530dhAVQRST7jWbgP4fDpTbIs/HwkSEtqqOA2aMlAX+i7OMPY6gl PWG72IT3E7kXLqhQ5vQ1QtpGByRa6lg= X-Google-Smtp-Source: ABdhPJzz6zJcAtY7e3XlJn/GjtXVJ3nEgovEJN8tUqeWrL/tPpaQG7eLzNSj1PdhU+gXKwzzbKMcRA== X-Received: by 2002:adf:97d6:: with SMTP id t22mr3597069wrb.385.1594714250727; Tue, 14 Jul 2020 01:10:50 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-176-63-152.red.bezeqint.net. [79.176.63.152]) by smtp.gmail.com with ESMTPSA id f197sm3403891wme.33.2020.07.14.01.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 01:10:50 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Michal Kalderon , Potnuri Bharat Teja , Shiraz Saleem , Bernard Metzler , Kamal Heib Subject: [PATCH for-next 1/7] RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set Date: Tue, 14 Jul 2020 11:10:32 +0300 Message-Id: <20200714081038.13131-2-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714081038.13131-1-kamalheib1@gmail.com> References: <20200714081038.13131-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Expose the pkeys sysfs files only if the pkey_tbl_len is set by the providers. Signed-off-by: Kamal Heib --- drivers/infiniband/core/sysfs.c | 64 ++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index defe9cd4c5ee..a7bca62a622e 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -58,7 +58,7 @@ struct ib_port { struct ib_device *ibdev; struct gid_attr_group *gid_attr_group; struct attribute_group gid_group; - struct attribute_group pkey_group; + struct attribute_group *pkey_group; struct attribute_group *pma_table; struct attribute_group *hw_stats_ag; struct rdma_hw_stats *hw_stats; @@ -681,11 +681,13 @@ static void ib_port_release(struct kobject *kobj) kfree(p->gid_group.attrs); } - if (p->pkey_group.attrs) { - for (i = 0; (a = p->pkey_group.attrs[i]); ++i) - kfree(a); + if (p->pkey_group) { + if (p->pkey_group->attrs) { + for (i = 0; (a = p->pkey_group->attrs[i]); ++i) + kfree(a); - kfree(p->pkey_group.attrs); + kfree(p->pkey_group->attrs); + } } kfree(p); @@ -1118,17 +1120,26 @@ static int add_port(struct ib_core_device *coredev, int port_num) if (ret) goto err_free_gid_type; - p->pkey_group.name = "pkeys"; - p->pkey_group.attrs = alloc_group_attrs(show_port_pkey, - attr.pkey_tbl_len); - if (!p->pkey_group.attrs) { - ret = -ENOMEM; - goto err_remove_gid_type; + if (attr.pkey_tbl_len) { + p->pkey_group = kzalloc(sizeof(*p->pkey_group), GFP_KERNEL); + if (!p->pkey_group) { + ret = -ENOMEM; + goto err_remove_gid_type; + } + + p->pkey_group->name = "pkeys"; + p->pkey_group->attrs = alloc_group_attrs(show_port_pkey, + attr.pkey_tbl_len); + if (!p->pkey_group->attrs) { + ret = -ENOMEM; + goto err_free_pkey_group; + } + + ret = sysfs_create_group(&p->kobj, p->pkey_group); + if (ret) + goto err_free_pkey; } - ret = sysfs_create_group(&p->kobj, &p->pkey_group); - if (ret) - goto err_free_pkey; if (device->ops.init_port && is_full_dev) { ret = device->ops.init_port(device, port_num, &p->kobj); @@ -1150,14 +1161,23 @@ static int add_port(struct ib_core_device *coredev, int port_num) return 0; err_remove_pkey: - sysfs_remove_group(&p->kobj, &p->pkey_group); + if (p->pkey_group) + sysfs_remove_group(&p->kobj, p->pkey_group); err_free_pkey: - for (i = 0; i < attr.pkey_tbl_len; ++i) - kfree(p->pkey_group.attrs[i]); + if (p->pkey_group) { + for (i = 0; i < attr.pkey_tbl_len; ++i) + kfree(p->pkey_group->attrs[i]); + + kfree(p->pkey_group->attrs); + p->pkey_group->attrs = NULL; + } - kfree(p->pkey_group.attrs); - p->pkey_group.attrs = NULL; +err_free_pkey_group: + if (p->pkey_group) { + kfree(p->pkey_group); + p->pkey_group = NULL; + } err_remove_gid_type: sysfs_remove_group(&p->gid_attr_group->kobj, @@ -1317,7 +1337,11 @@ void ib_free_port_attrs(struct ib_core_device *coredev) if (port->pma_table) sysfs_remove_group(p, port->pma_table); - sysfs_remove_group(p, &port->pkey_group); + if (port->pkey_group) { + sysfs_remove_group(p, port->pkey_group); + kfree(port->pkey_group); + port->pkey_group = NULL; + } sysfs_remove_group(p, &port->gid_group); sysfs_remove_group(&port->gid_attr_group->kobj, &port->gid_attr_group->ndev); From patchwork Tue Jul 14 08:10:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11661921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 740DD1392 for ; Tue, 14 Jul 2020 08:10:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A8D0217D9 for ; Tue, 14 Jul 2020 08:10:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sd/rCvNL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726354AbgGNIKy (ORCPT ); Tue, 14 Jul 2020 04:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNIKy (ORCPT ); Tue, 14 Jul 2020 04:10:54 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7516C061755 for ; Tue, 14 Jul 2020 01:10:53 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id z13so20202427wrw.5 for ; Tue, 14 Jul 2020 01:10:53 -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 :mime-version:content-transfer-encoding; bh=+xwtCoElLLo1FXG9Vaq9b+0G1RX76SWaOSLyZ61U0N8=; b=Sd/rCvNL6pVFWm8IQ3x0vQdaH1mC26BdrhTOddvPsl9mbokGp937/vFqzcqwU/HFUW 7vyG0QxtcKU4Xie62Xu9wsf3OEZm8Ah1f28RiMu60KPX5+4GtD9kynqYPeTGSrk8MzzQ QpEyK6YegghCyJyYhnfHzTsisECgtwCzZ++RfCSOi+smg12GClnBpHDRoavrQbbP3DFf PAdiAM/4vhW3Y0iwBg/9mTAfJ6x1AT80w1W42NHSy2qjxcwGzojGB57eE8mDWVo7GCO4 CVhzNMSp9vPTTR4ro/dWtws4IerSOZB80iY/p9dAx4kUMq7YoAH10Cfw+d9RGi4YT1jL OAXg== 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:mime-version:content-transfer-encoding; bh=+xwtCoElLLo1FXG9Vaq9b+0G1RX76SWaOSLyZ61U0N8=; b=PT5TgueArS4LWoi5t0t6VmCfR9m5GnrQtbW4s9ltWHHjZkgIPdUNo5C0KHAahiMhKJ f2hDUIdaGyUgyySTRUlGfVOV3kyhKGh+dk6P8tt0rcHVNoFc2GCtwK5YCIRBnZZi8ZvX N3q/vZijsFbN+o5RrLWCCy5iTZDcdH35C0sRu4Nbkf04nZHkoEUQ7mjqrYtGjVpeuN02 27/uOKJl/yu+WsXF9YsFQ7+7Fd0VoKRbzFcuzczYUcOiUxaX7AoPr0K8TtNqCZ1+a1M4 S4Z9jbjfacWdW7quQ3neeMq0LWYNKSqh5fu9ibdk0CmtuaIUN5OQnNeCejtCqWmEG0Ow H/Ow== X-Gm-Message-State: AOAM530IlcAfdG9NtMomCqw39GXArIXgK1V2wFKO9bJ6yDJWe5Hngcco JN8yraAqUr/uAjsW7DQTMOecSjtAtiU= X-Google-Smtp-Source: ABdhPJxbHzE1tCeKFEpxBNHGRExVr8MMDX2BxfZLhVbU1jh7i6iCFDM+8ldaNmrDKKgW8DzteBqClg== X-Received: by 2002:a05:6000:12c5:: with SMTP id l5mr4050340wrx.219.1594714252355; Tue, 14 Jul 2020 01:10:52 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-176-63-152.red.bezeqint.net. [79.176.63.152]) by smtp.gmail.com with ESMTPSA id f197sm3403891wme.33.2020.07.14.01.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 01:10:51 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Michal Kalderon , Potnuri Bharat Teja , Shiraz Saleem , Bernard Metzler , Kamal Heib Subject: [PATCH for-next 2/7] RDMA/core: Allocate the pkey cache only if the pkey_tbl_len is set Date: Tue, 14 Jul 2020 11:10:33 +0300 Message-Id: <20200714081038.13131-3-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714081038.13131-1-kamalheib1@gmail.com> References: <20200714081038.13131-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Allocate the pkey cache only if the pkey_tbl_len is set by the provider, also add checks to avoid accessing the pkey cache when it not initialized. Signed-off-by: Kamal Heib --- drivers/infiniband/core/cache.c | 45 +++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index a670209bbce6..ffad73bb40ff 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1054,7 +1054,7 @@ int ib_get_cached_pkey(struct ib_device *device, cache = device->port_data[port_num].cache.pkey; - if (index < 0 || index >= cache->table_len) + if (!cache || index < 0 || index >= cache->table_len) ret = -EINVAL; else *pkey = cache->table[index]; @@ -1099,6 +1099,10 @@ int ib_find_cached_pkey(struct ib_device *device, read_lock_irqsave(&device->cache_lock, flags); cache = device->port_data[port_num].cache.pkey; + if (!cache) { + ret = -EINVAL; + goto err; + } *index = -1; @@ -1117,6 +1121,7 @@ int ib_find_cached_pkey(struct ib_device *device, ret = 0; } +err: read_unlock_irqrestore(&device->cache_lock, flags); return ret; @@ -1139,6 +1144,10 @@ int ib_find_exact_cached_pkey(struct ib_device *device, read_lock_irqsave(&device->cache_lock, flags); cache = device->port_data[port_num].cache.pkey; + if (!cache) { + ret = -EINVAL; + goto err; + } *index = -1; @@ -1149,6 +1158,7 @@ int ib_find_exact_cached_pkey(struct ib_device *device, break; } +err: read_unlock_irqrestore(&device->cache_lock, flags); return ret; @@ -1425,23 +1435,26 @@ ib_cache_update(struct ib_device *device, u8 port, bool enforce_security) goto err; } - pkey_cache = kmalloc(struct_size(pkey_cache, table, - tprops->pkey_tbl_len), - GFP_KERNEL); - if (!pkey_cache) { - ret = -ENOMEM; - goto err; - } + if (tprops->pkey_tbl_len) { + pkey_cache = kmalloc(struct_size(pkey_cache, table, + tprops->pkey_tbl_len), + GFP_KERNEL); + if (!pkey_cache) { + ret = -ENOMEM; + goto err; + } - pkey_cache->table_len = tprops->pkey_tbl_len; + pkey_cache->table_len = tprops->pkey_tbl_len; - for (i = 0; i < pkey_cache->table_len; ++i) { - ret = ib_query_pkey(device, port, i, pkey_cache->table + i); - if (ret) { - dev_warn(&device->dev, - "ib_query_pkey failed (%d) for index %d\n", - ret, i); - goto err; + for (i = 0; i < pkey_cache->table_len; ++i) { + ret = ib_query_pkey(device, port, i, + pkey_cache->table + i); + if (ret) { + dev_warn(&device->dev, + "ib_query_pkey failed (%d) for index %d\n", + ret, i); + goto err; + } } } From patchwork Tue Jul 14 08:10:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11661923 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C36F13A4 for ; Tue, 14 Jul 2020 08:10:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33F52217D9 for ; Tue, 14 Jul 2020 08:10:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C1ugTTVL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbgGNIK4 (ORCPT ); Tue, 14 Jul 2020 04:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNIKz (ORCPT ); Tue, 14 Jul 2020 04:10:55 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3184CC061755 for ; Tue, 14 Jul 2020 01:10:55 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id a6so20190403wrm.4 for ; Tue, 14 Jul 2020 01:10:55 -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 :mime-version:content-transfer-encoding; bh=L0zVNNuC9gPKJDZ51KIhZtCKujT98xSSIIXlx1rNfiA=; b=C1ugTTVLHogPttpzrDpybgqgVwvXeM+/eMYd/Vef7+WU0JCWV3HebsA9qh2TxIW2gR Or6L5jSmTGej1z/AJfenPkKIUAIU9r+abxW4zRJB49cGd2Tk0BC/upMgX1KMWwV70/4V FLRSu6A5EK3mdmhjXmUFbxSYQ5/zKVQFnhiz9hgkrdU/5qqpGAURW/bt+BKR8wp7JZnv Lr4WXT6RGoh9HcOkGgVn1q2vzIThYt4+va6aGTl6BkuBMYUN6EhxjX5OZOcnLspBEZUq dJVMJBXdFjRQSVQ0SFfi9LcMTNlkbv8Qz+UMmkKtEOAKqNHk8HOmvTR/UQ88iN1R5ZNq 4IQg== 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:mime-version:content-transfer-encoding; bh=L0zVNNuC9gPKJDZ51KIhZtCKujT98xSSIIXlx1rNfiA=; b=m0xmij2GLEJrYtzQun8tcLb4LESSRgDFYvItUCH/MfL9qq1j2ahlh8Vcgj+ZDu7l1i f+rGziAuOFmuGXVFi2Js9vmK4K+E7TRl968XTDyzNL8bAquPNoK+oCk/FIEz302ELRgc UGqwTF3NUbDh9jJ6nglrZJVaywnZZgriOO/tTOIzpUzZhOYywubPm6CnQbCL7FEg95ZH dJHp3xzjGaMdsQwDn+M01uzgB+6xGmftGAdqrybLfAC5/NIC12n8Jhma5Ad752VWARa1 QMWf2702YsvbK31i/0uuMtzMoYwtjSCYsKUWNorp1mFBsexbs6bFv03+ftG7uyamLd/L ku/Q== X-Gm-Message-State: AOAM530QTSPXwEzIgi09VNOiRw6M/VvpZr2F8dcwm/mK/zNGgiQVPbjx 9bPwgXJtPU+6rWsMIwx6p8p/QI28/1A= X-Google-Smtp-Source: ABdhPJwyFYzKPTqd37+a466d1UwzmAgSz+IFL58nUYg5Q0XlM9ukEO4MnQHxcCTECQp7aenx9PJ7dA== X-Received: by 2002:a5d:688d:: with SMTP id h13mr3621864wru.303.1594714253797; Tue, 14 Jul 2020 01:10:53 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-176-63-152.red.bezeqint.net. [79.176.63.152]) by smtp.gmail.com with ESMTPSA id f197sm3403891wme.33.2020.07.14.01.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 01:10:53 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Michal Kalderon , Potnuri Bharat Teja , Shiraz Saleem , Bernard Metzler , Kamal Heib Subject: [PATCH for-next 3/7] RDMA/core: Remove query_pkey from the mandatory ops Date: Tue, 14 Jul 2020 11:10:34 +0300 Message-Id: <20200714081038.13131-4-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714081038.13131-1-kamalheib1@gmail.com> References: <20200714081038.13131-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org The query_pkey() isn't mandatory for the iwarp providers, so remove this requirement from the RDMA core. Signed-off-by: Kamal Heib --- drivers/infiniband/core/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index b2d617e599a1..d293b826acbc 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -272,7 +272,6 @@ static void ib_device_check_mandatory(struct ib_device *device) } 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_qp), @@ -2362,6 +2361,9 @@ int ib_query_pkey(struct ib_device *device, if (!rdma_is_port_valid(device, port_num)) return -EINVAL; + if (!device->ops.query_pkey) + return -EOPNOTSUPP; + return device->ops.query_pkey(device, port_num, index, pkey); } EXPORT_SYMBOL(ib_query_pkey); From patchwork Tue Jul 14 08:10:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11661925 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91DD013A4 for ; Tue, 14 Jul 2020 08:10:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 768BA217D9 for ; Tue, 14 Jul 2020 08:10:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rsiq3S2F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726729AbgGNIK5 (ORCPT ); Tue, 14 Jul 2020 04:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNIK5 (ORCPT ); Tue, 14 Jul 2020 04:10:57 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA8AC061755 for ; Tue, 14 Jul 2020 01:10:56 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id z2so20210138wrp.2 for ; Tue, 14 Jul 2020 01:10:56 -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 :mime-version:content-transfer-encoding; bh=mYq0lLfoChjF6fyT3Yv4jD48nMVUJnRN3eRJAiDbrDU=; b=Rsiq3S2FdD9dm5JFrBTzvG6HgTqKBSucSpBnavArEEko+Pwxlw6NgAOnOoJqYJzfej Fy32NcyirLP9GRLDJR8Apjg1hJ6VsGY3UvkXzvZXz1r/1t6bSrmJ86aV2qZ2jdmyxazK cvOP7WH9HnRZucJO18i9C2l/Q8hpiP1Mfn6WGGFGL1Ek0Fy3OzF/bJjchp5+ThMqlQZE 3UQeN33FTxpW8lc2XlQt41TU0wE8hAmFByd9KSKsNBhES8Yq7DMdQCk5Z2AJkAzQ9sAX /OG4g2ODu4xzC13238EYIz9sSZVz//n0bI17KTGxcgtuZET3FlOKtM2Xj7oB6pDZAsmF 7w7g== 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:mime-version:content-transfer-encoding; bh=mYq0lLfoChjF6fyT3Yv4jD48nMVUJnRN3eRJAiDbrDU=; b=Vayunuxa9QALgfEmDogOIz+MXzJnQYD+dqyy0DvYz23SWaJFbuLC3zKAhZTMv/jBhe g6UGw6bKY/903hSAQV0RbKUmb7iJM/6Mp9Bq+QvA/L84Z+lfYecmVfeeqfP9kIHQ2/Dy RsX1vbG1nQEPtBYB/K30q+2/3LpH6K1WtsfZNEicfLGyAi2ySUNh5ZqqZkVzz915gIO5 MfuXnYp7ezM0S8oSKsoS7MOndTQgbYaz/Te+0QqhJmlcaHjOjbdLjzZEBL+nY63O0d1v U96M4mjYnrqSNJyCuTQ0BnjNE4KO8rfROoRHkHyOSCO1YEqFrLNXVCmMgHwwgeV4Mf3a Y9gQ== X-Gm-Message-State: AOAM532TDZoiPdb0soUtgnnNFtMfysXXR+xeSWd9Vg3LvzsGKBnJWRdR 0ZI4ehWkNh30eVfExURLreuXq9m11CE= X-Google-Smtp-Source: ABdhPJwYLCHcgKRrhXxe7XCotYuOqu+d/onZ55Bf6mrHf2IFSbEVwD1PsIUpH2+8+jNNNliT3NuxkQ== X-Received: by 2002:adf:c986:: with SMTP id f6mr3825097wrh.168.1594714255112; Tue, 14 Jul 2020 01:10:55 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-176-63-152.red.bezeqint.net. [79.176.63.152]) by smtp.gmail.com with ESMTPSA id f197sm3403891wme.33.2020.07.14.01.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 01:10:54 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Michal Kalderon , Potnuri Bharat Teja , Shiraz Saleem , Bernard Metzler , Kamal Heib Subject: [PATCH for-next 4/7] RDMA/siw: Remove the query_pkey callback Date: Tue, 14 Jul 2020 11:10:35 +0300 Message-Id: <20200714081038.13131-5-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714081038.13131-1-kamalheib1@gmail.com> References: <20200714081038.13131-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Now that the query_pkey() isn't mandatory by the RDMA core for iwarp providers, this callback can be removed. Signed-off-by: Kamal Heib --- drivers/infiniband/sw/siw/siw_main.c | 1 - drivers/infiniband/sw/siw/siw_verbs.c | 9 --------- drivers/infiniband/sw/siw/siw_verbs.h | 1 - 3 files changed, 11 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c index a0b8cc643c5c..18c08259157f 100644 --- a/drivers/infiniband/sw/siw/siw_main.c +++ b/drivers/infiniband/sw/siw/siw_main.c @@ -288,7 +288,6 @@ static const struct ib_device_ops siw_device_ops = { .post_srq_recv = siw_post_srq_recv, .query_device = siw_query_device, .query_gid = siw_query_gid, - .query_pkey = siw_query_pkey, .query_port = siw_query_port, .query_qp = siw_query_qp, .query_srq = siw_query_srq, diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c index 0d509f7a10a6..adafa1b8bebe 100644 --- a/drivers/infiniband/sw/siw/siw_verbs.c +++ b/drivers/infiniband/sw/siw/siw_verbs.c @@ -176,7 +176,6 @@ int siw_query_port(struct ib_device *base_dev, u8 port, attr->active_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu); attr->phys_state = sdev->state == IB_PORT_ACTIVE ? IB_PORT_PHYS_STATE_LINK_UP : IB_PORT_PHYS_STATE_DISABLED; - attr->pkey_tbl_len = 1; attr->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_DEVICE_MGMT_SUP; attr->state = sdev->state; /* @@ -204,20 +203,12 @@ int siw_get_port_immutable(struct ib_device *base_dev, u8 port, if (rv) return rv; - port_immutable->pkey_tbl_len = attr.pkey_tbl_len; port_immutable->gid_tbl_len = attr.gid_tbl_len; port_immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; return 0; } -int siw_query_pkey(struct ib_device *base_dev, u8 port, u16 idx, u16 *pkey) -{ - /* Report the default pkey */ - *pkey = 0xffff; - return 0; -} - int siw_query_gid(struct ib_device *base_dev, u8 port, int idx, union ib_gid *gid) { diff --git a/drivers/infiniband/sw/siw/siw_verbs.h b/drivers/infiniband/sw/siw/siw_verbs.h index 9335c48c01de..d9572275a6b6 100644 --- a/drivers/infiniband/sw/siw/siw_verbs.h +++ b/drivers/infiniband/sw/siw/siw_verbs.h @@ -46,7 +46,6 @@ int siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr, struct ib_udata *udata); int siw_query_port(struct ib_device *base_dev, u8 port, struct ib_port_attr *attr); -int siw_query_pkey(struct ib_device *base_dev, u8 port, u16 idx, u16 *pkey); int siw_query_gid(struct ib_device *base_dev, u8 port, int idx, union ib_gid *gid); int siw_alloc_pd(struct ib_pd *base_pd, struct ib_udata *udata); From patchwork Tue Jul 14 08:10:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11661927 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 923DF1392 for ; Tue, 14 Jul 2020 08:10:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CD2D217D9 for ; Tue, 14 Jul 2020 08:10:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nAkmBH3J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726809AbgGNIK7 (ORCPT ); Tue, 14 Jul 2020 04:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNIK6 (ORCPT ); Tue, 14 Jul 2020 04:10:58 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEC24C061755 for ; Tue, 14 Jul 2020 01:10:57 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id q5so20215863wru.6 for ; Tue, 14 Jul 2020 01:10:57 -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 :mime-version:content-transfer-encoding; bh=VnEpEj7Wi5IT2YAweja/qAq4cg9UzJREPeiQX23JUak=; b=nAkmBH3JvswHMUWaM211OT/rvfvVhLL/FiXjr1kSpC8fsumK7aA4uprExmik7c22u3 goTIVD4z9818KlbB/tV/BskT60YYOiyuTJqJUHZcmfP1h2LlXMeuZyxzCtAAzFlUS8I8 89AjsnbAykuaZmjDuzzskpS9gnQHm/8xpCFxmrOzReuNX9xTWW/hVE/S3zqIb9Msqoyn j+N9CTmevZe10jZtunH3oPsErp7gYs5kEDk1PnTXqq83PwEHPGG8JOijKq9jUjAI+NUH 6U6IoPQR2eIJdGi667kZFqQg/uEX6ficw16bo4ANZgXy4poTwXAbqXvR5EhuECDc5eKt ML/w== 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:mime-version:content-transfer-encoding; bh=VnEpEj7Wi5IT2YAweja/qAq4cg9UzJREPeiQX23JUak=; b=eiKvaDQXtqGXrPCuOxYSZ7Ts9eVKz5gj+1l+5fOkvtziqZW8r+cVWYSi1gs1dHNokk iqQ/nZFwUJLH3SeHEnoHfGYkmO30YfUp2xE3z0giZISURRU3OItQJIcA3Ayz+ViknyXL twkIQ/yrqWzJuUyeFwOdySxq+WRGWHcJ11SjOBBXpwQdiItD+g/KkCrBhvUFIeFKVM0d phmMr0Zu5/9Fp5yk4Ss56g2cnvoM+0VI2g7ago71r/BeFShq1WuuqXmB1ACMm493akmb mZ1XGOyzNrPkty8CAaFYBuSuhDEX4TCgsBxrH5mwdbhSGe2sfmaGbAw7p+iW5eGcJVXE 7h7w== X-Gm-Message-State: AOAM5308s7p+9gygqL6fpqc/u1yzJ1gI5sEyQFy6U7pablbYB0Yy1Xk2 DsFCEiiN3NAsEfgp02Zog/rvr1RtI4Y= X-Google-Smtp-Source: ABdhPJzlKi8XHH61ooiysLHqpec2vJWztXbda/1FtD01+P4JISMWC1mFGSVNyNO07LZ3b6Boac2kSw== X-Received: by 2002:a5d:4682:: with SMTP id u2mr3651017wrq.407.1594714256454; Tue, 14 Jul 2020 01:10:56 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-176-63-152.red.bezeqint.net. [79.176.63.152]) by smtp.gmail.com with ESMTPSA id f197sm3403891wme.33.2020.07.14.01.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 01:10:56 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Michal Kalderon , Potnuri Bharat Teja , Shiraz Saleem , Bernard Metzler , Kamal Heib Subject: [PATCH for-next 5/7] RDMA/cxgb4: Remove the query_pkey callback Date: Tue, 14 Jul 2020 11:10:36 +0300 Message-Id: <20200714081038.13131-6-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714081038.13131-1-kamalheib1@gmail.com> References: <20200714081038.13131-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Now that the query_pkey() isn't mandatory by the RDMA core for iwarp providers, this callback can be removed. Signed-off-by: Kamal Heib --- drivers/infiniband/hw/cxgb4/provider.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index 1d3ff59e4060..6c579d2d3997 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -236,14 +236,6 @@ static int c4iw_allocate_pd(struct ib_pd *pd, struct ib_udata *udata) return 0; } -static int c4iw_query_pkey(struct ib_device *ibdev, u8 port, u16 index, - u16 *pkey) -{ - pr_debug("ibdev %p\n", ibdev); - *pkey = 0; - return 0; -} - static int c4iw_query_gid(struct ib_device *ibdev, u8 port, int index, union ib_gid *gid) { @@ -317,7 +309,6 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port, IB_PORT_DEVICE_MGMT_SUP | IB_PORT_VENDOR_CLASS_SUP | IB_PORT_BOOT_MGMT_SUP; props->gid_tbl_len = 1; - props->pkey_tbl_len = 1; props->max_msg_sz = -1; return ret; @@ -439,7 +430,6 @@ static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num, if (err) return err; - immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; return 0; @@ -503,7 +493,6 @@ static const struct ib_device_ops c4iw_dev_ops = { .post_srq_recv = c4iw_post_srq_recv, .query_device = c4iw_query_device, .query_gid = c4iw_query_gid, - .query_pkey = c4iw_query_pkey, .query_port = c4iw_query_port, .query_qp = c4iw_ib_query_qp, .reg_user_mr = c4iw_reg_user_mr, From patchwork Tue Jul 14 08:10:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11661929 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DED5F1392 for ; Tue, 14 Jul 2020 08:11:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4BD6217D9 for ; Tue, 14 Jul 2020 08:11:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V1PYzISA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726817AbgGNILA (ORCPT ); Tue, 14 Jul 2020 04:11:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNIK7 (ORCPT ); Tue, 14 Jul 2020 04:10:59 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45875C061755 for ; Tue, 14 Jul 2020 01:10:59 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id q5so20215933wru.6 for ; Tue, 14 Jul 2020 01:10:59 -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 :mime-version:content-transfer-encoding; bh=F52xxdHJpk+aUYTGQsIRXXmLKYtmUocjdywU/DRMnjo=; b=V1PYzISAfY/rGKv6vMIse7LK0WCVUYrN0+1Z4Nn9uaFUeDFsIrpFL7i753mxeJ0uyd Cz70UAqdw1uPYUwk2NFM51kBnJLJZs2F1uvj4KmuT9Wo7HF0Csl0t2ZVCT0z6/SzI2pS 9ZsEdfKHVXcZFX5F18REYHduJlrJYynZ4tyY9MXKPlEqmWGp6KPluAPlCDfSrcnwnxZE bem0MYAOGQeyM0UToJK/tfNHfaFcAn1eUb17oeOUMCqgJAOeCXk8b2PrWQyQX2NS9fA1 YzMdXXqFFTQQzBCg1AX+/2lQd7sTlNJGFa2fcqm0Zl2Sahs0mer5ueEBuxFH69Mdm+U7 nb0g== 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:mime-version:content-transfer-encoding; bh=F52xxdHJpk+aUYTGQsIRXXmLKYtmUocjdywU/DRMnjo=; b=eN+L0V/Sx8AwIF/1EGp2mGshjkxQo6R4Qvv4Wm6jSDxmA5jBu2hE8aJpmRE9j/fGvH UV164HYe8e1znsE/52fF6pQIYbHGSjUWJhOez7/ZQMrsV9TkPUmGvoW2FHPhbGhg1niq vmzYilCutXVtEIIJNgqtZ8bG3JvqMfgIoKjh72tM+ayPC/ZtWZbENb09xzQQPeDJTCyk XvRuGl+QnlXBHIN9MYwm3Sux6KEVjRuxpWY1iBRmRsL4o2IeNd1flsDBL6p3UfHd4q/u 086FH3uRjAN0As8LwRffWU7GCRzUtFhM5deGLg+ra8XTQ4KMn5ExGqsSOB6cLIQJz8gd Gx8w== X-Gm-Message-State: AOAM530BNhhaelcJfeoZkQe9VeMEjyTvwoDr6qoWy45dTxwJkl8vEsNn kYVKXRJmYG6dM+C5IybC9LadFaceZnA= X-Google-Smtp-Source: ABdhPJyoocTC3TM7SrHPaiYzGz1o//mTiFLISQ1fZisIpFXuKbWjsWIMToReQ6DYJB8+RPqfV/kv2w== X-Received: by 2002:a5d:69c8:: with SMTP id s8mr3658768wrw.405.1594714257838; Tue, 14 Jul 2020 01:10:57 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-176-63-152.red.bezeqint.net. [79.176.63.152]) by smtp.gmail.com with ESMTPSA id f197sm3403891wme.33.2020.07.14.01.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 01:10:57 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Michal Kalderon , Potnuri Bharat Teja , Shiraz Saleem , Bernard Metzler , Kamal Heib Subject: [PATCH for-next 6/7] RDMA/i40iw: Remove the query_pkey callback Date: Tue, 14 Jul 2020 11:10:37 +0300 Message-Id: <20200714081038.13131-7-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714081038.13131-1-kamalheib1@gmail.com> References: <20200714081038.13131-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Now that the query_pkey() isn't mandatory by the RDMA core for iwarp providers, this callback can be removed. Signed-off-by: Kamal Heib --- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index f9ef3ac2f4cd..6957e4f3404b 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -101,7 +101,6 @@ static int i40iw_query_port(struct ib_device *ibdev, props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_REINIT_SUP | IB_PORT_VENDOR_CLASS_SUP | IB_PORT_BOOT_MGMT_SUP; props->gid_tbl_len = 1; - props->pkey_tbl_len = 1; props->active_width = IB_WIDTH_4X; props->active_speed = 1; props->max_msg_sz = I40IW_MAX_OUTBOUND_MESSAGE_SIZE; @@ -2459,7 +2458,6 @@ static int i40iw_port_immutable(struct ib_device *ibdev, u8 port_num, if (err) return err; - immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len; return 0; @@ -2615,22 +2613,6 @@ static int i40iw_query_gid(struct ib_device *ibdev, return 0; } -/** - * i40iw_query_pkey - Query partition key - * @ibdev: device pointer from stack - * @port: port number - * @index: index of pkey - * @pkey: pointer to store the pkey - */ -static int i40iw_query_pkey(struct ib_device *ibdev, - u8 port, - u16 index, - u16 *pkey) -{ - *pkey = 0; - return 0; -} - static const struct ib_device_ops i40iw_dev_ops = { .owner = THIS_MODULE, .driver_id = RDMA_DRIVER_I40IW, @@ -2670,7 +2652,6 @@ static const struct ib_device_ops i40iw_dev_ops = { .post_send = i40iw_post_send, .query_device = i40iw_query_device, .query_gid = i40iw_query_gid, - .query_pkey = i40iw_query_pkey, .query_port = i40iw_query_port, .query_qp = i40iw_query_qp, .reg_user_mr = i40iw_reg_user_mr, From patchwork Tue Jul 14 08:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11661931 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D51113B6 for ; Tue, 14 Jul 2020 08:11:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43EC6217D9 for ; Tue, 14 Jul 2020 08:11:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MdjsX1x7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbgGNILB (ORCPT ); Tue, 14 Jul 2020 04:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgGNILB (ORCPT ); Tue, 14 Jul 2020 04:11:01 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1F56C061755 for ; Tue, 14 Jul 2020 01:11:00 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id z2so20210328wrp.2 for ; Tue, 14 Jul 2020 01:11:00 -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 :mime-version:content-transfer-encoding; bh=VaUnzA+VnyAFjx4M4tqIGYLdyaDf1nvOkia8P/7QAX4=; b=MdjsX1x7MTwv5wq1CiEWVJeJ6IbkHSZeq4HdOBckVi6MvZDb+OEuF1PfZqlWaGgI+M 02YmYtfPDnZou4DpN1AEe0E7Xoi2vgo6c1hff7/QDKQxJMLHYvxVg+207Ym15KjfniUO kdrNxZI4MSSOZnKQ7Dx+Fq+1ISfNevjKocjOtDhbg5hbMBTQE3KK+MpzUNA5Adh8sqf3 FLzzpUKl2VTd3K7kuFw23K8/XXS9+xwYcJ3OKW12VoPEqvc/d2YHWt4e6yE84J/kMqLa pvNX2ryyz3lszl8hSARaa94AvXl1KIdw5YPGMMNdwLABL8CjD+R9vSNsqNoi63Luv+kG StHA== 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:mime-version:content-transfer-encoding; bh=VaUnzA+VnyAFjx4M4tqIGYLdyaDf1nvOkia8P/7QAX4=; b=F2wOTUd4K/+5FuwDPZ03Va8mRvrNGaZh6Y//B1UutcYaDVzr5ixz/37qWbApSYmNuq 9wt1g0BJr7OCNiEvrSHfvIJyWfTsp1zWqNlNpVtKMNcpf/47P7Vxxk9cfZ3TkWFHFFXX a37+Sxwyip0gvq0p/8OFNQRg6IwkKYBFtfpTTiJE3MQF0wbWXTe7rp0CkXjPjoTDLwoE HNnbOEEQrgWMlH2LTWmXHjyBZ0eT2KzEztcw/x105ugaPP7XhBFTuJsUYoisFS0e22sQ frJlxjpK+EzwSVt9HjopI++opsfV4pb5LkOusm5brXklCFfOEkXrtpOzds1X+Dh0XN98 V89g== X-Gm-Message-State: AOAM532y6PrEll0CmZi9Wg6WYSEtSQ4/e5AdG2jyTtD8X/68bG3uDNjA JQRMsxIX2hY92ACFDEM31Q0va3F3V2U= X-Google-Smtp-Source: ABdhPJyQkCk4efjh0sQ3vxIL7ibk4e3gJFItXfMFk4MH45F2K6G7DiMORQIIuEM+xVX3m4axE4w3xQ== X-Received: by 2002:a5d:4051:: with SMTP id w17mr3587010wrp.183.1594714259234; Tue, 14 Jul 2020 01:10:59 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-176-63-152.red.bezeqint.net. [79.176.63.152]) by smtp.gmail.com with ESMTPSA id f197sm3403891wme.33.2020.07.14.01.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 01:10:58 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Michal Kalderon , Potnuri Bharat Teja , Shiraz Saleem , Bernard Metzler , Kamal Heib Subject: [PATCH for-next 7/7] RDMA/qedr: Remove the query_pkey callback Date: Tue, 14 Jul 2020 11:10:38 +0300 Message-Id: <20200714081038.13131-8-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714081038.13131-1-kamalheib1@gmail.com> References: <20200714081038.13131-1-kamalheib1@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Now that the query_pkey() isn't mandatory by the RDMA core for iwarp providers, this callback can be removed from the common ops and moved to the RoCE only ops within the qedr driver. Signed-off-by: Kamal Heib Acked-by: Michal KalderonĀ  --- drivers/infiniband/hw/qedr/main.c | 3 +-- drivers/infiniband/hw/qedr/verbs.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c index ccaedfd53e49..c9eeed25c662 100644 --- a/drivers/infiniband/hw/qedr/main.c +++ b/drivers/infiniband/hw/qedr/main.c @@ -110,7 +110,6 @@ static int qedr_iw_port_immutable(struct ib_device *ibdev, u8 port_num, if (err) return err; - immutable->pkey_tbl_len = 1; immutable->gid_tbl_len = 1; immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; immutable->max_mad_size = 0; @@ -179,6 +178,7 @@ static int qedr_iw_register_device(struct qedr_dev *dev) static const struct ib_device_ops qedr_roce_dev_ops = { .get_port_immutable = qedr_roce_port_immutable, + .query_pkey = qedr_query_pkey, }; static void qedr_roce_register_device(struct qedr_dev *dev) @@ -221,7 +221,6 @@ static const struct ib_device_ops qedr_dev_ops = { .post_srq_recv = qedr_post_srq_recv, .process_mad = qedr_process_mad, .query_device = qedr_query_device, - .query_pkey = qedr_query_pkey, .query_port = qedr_query_port, .query_qp = qedr_query_qp, .query_srq = qedr_query_srq, diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index 3d7d5617818f..63eb935a1596 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -239,7 +239,6 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr) attr->ip_gids = true; if (rdma_protocol_iwarp(&dev->ibdev, 1)) { attr->gid_tbl_len = 1; - attr->pkey_tbl_len = 1; } else { attr->gid_tbl_len = QEDR_MAX_SGID; attr->pkey_tbl_len = QEDR_ROCE_PKEY_TABLE_LEN;