From patchwork Tue Jul 14 18:34:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11663349 X-Patchwork-Delegate: jgg@ziepe.ca 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 2FA8F13B1 for ; Tue, 14 Jul 2020 18:34:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1800D21835 for ; Tue, 14 Jul 2020 18:34:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XLMIg4L0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729056AbgGNSei (ORCPT ); Tue, 14 Jul 2020 14:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbgGNSei (ORCPT ); Tue, 14 Jul 2020 14:34:38 -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 BF27BC061755 for ; Tue, 14 Jul 2020 11:34:37 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id k6so23984041wrn.3 for ; Tue, 14 Jul 2020 11:34:37 -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=vvGkLwWeuJtAW6VGduH8+m4dkLZrSU0VWJlGtY5Rjdo=; b=XLMIg4L0kf+P7Xzh+G03+uqineK514OfchMxCkRlLJGREcdeV0lSXXsSi4A3UqJTlf 7di4mzE/JA4yI+EtcrE/M4AYOiHNYIT5Pu8GBqeHL5e3CxzTet5N/U4YtH1jcnCPMTRz Ip9AlJH9gbDErTku9qai0+YrVqJ7EqYxvf9WcvRUw1b5CTQE8k01RZgZLhhlsKDhS6cY HyTxb8wPWHT7GC5F8AMpUfaC7Rd0BmvqyZhGPYtFG4w+T10JVbZn5XcoTue63AANHxXD LltqNjIfltcf49neXSY98/UMGOasDYPzTmPywviUK8pDg3yQYn8pOOQA9GeD97/svCxY zNeQ== 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=vvGkLwWeuJtAW6VGduH8+m4dkLZrSU0VWJlGtY5Rjdo=; b=pg9wypdtLbdQQVPI7w4EfHO8icmzO1w5GSTctkb/EFu5QXPlycoqf9KPs2OQrtN1HT 2ZFNxpe1YgX7O81PsW58MeQeTT6Qd2zO1bHGg6qdIqwnl0cC+vhgtSzafHnqrh+iJuSy ewY7xqf3JZgf5nbJ7Qa0IRD9g5YPNhs50G8IJEihpLrr5DFwRYDJGkbm1QRXW4QQOjrp rqBFwR9FLVbKyfS4iwu7BHFiK4GilKZV/NTRsK6LVzRTp/ibSdR4b9OKT9uu/3aO2zbP sLQIV0Szv9O3sn7nzax8DegvkACJR3IPmPAOetBtjpjGOMn7MpI9LygyGu3BHfW6V4Px +Nsw== X-Gm-Message-State: AOAM532LYdKTGXrypqDCK148/92pvPii5xXC+UBuZY/mU1S/Qw4vjgEx P+Qdw63MJZKUU3MO010zyV+7VEH+JF4= X-Google-Smtp-Source: ABdhPJzzoB13rQgqDbNCLj3Vyd1v8vYO99CAsRaR1gKSgF34cG6H3ZauJpMzHr88BbYdc6S0J5qRyg== X-Received: by 2002:a5d:6107:: with SMTP id v7mr7239570wrt.174.1594751676317; Tue, 14 Jul 2020 11:34:36 -0700 (PDT) Received: from kheib-workstation.redhat.com ([37.142.6.100]) by smtp.gmail.com with ESMTPSA id 190sm5728982wmb.15.2020.07.14.11.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 11:34:35 -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 v1 1/7] RDMA/core: Expose pkeys sysfs files only if pkey_tbl_len is set Date: Tue, 14 Jul 2020 21:34:08 +0300 Message-Id: <20200714183414.61069-2-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714183414.61069-1-kamalheib1@gmail.com> References: <20200714183414.61069-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..38507e5529ba 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,16 @@ 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->pkey_group); + p->pkey_group = NULL; } kfree(p); @@ -1118,17 +1123,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 +1164,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 +1340,8 @@ 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); 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 18:34:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11663351 X-Patchwork-Delegate: jgg@ziepe.ca 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 EEC3F13B6 for ; Tue, 14 Jul 2020 18:34:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5E5521835 for ; Tue, 14 Jul 2020 18:34:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q5SYHakP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729091AbgGNSek (ORCPT ); Tue, 14 Jul 2020 14:34:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbgGNSej (ORCPT ); Tue, 14 Jul 2020 14:34:39 -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 83F2EC061755 for ; Tue, 14 Jul 2020 11:34:39 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id b6so23987394wrs.11 for ; Tue, 14 Jul 2020 11:34:39 -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=q5SYHakPgoW937h4DMo9t7FSkZMAg4Xy5/v6GK3/EUIHvzlHYuviDLL4hOG/JE2/Qb +UsYn/npY8QjzeKXovcjJYkPHHiiyQN+YXPuabeXgU4Un67mk/G9KgqD9s7mpbaqhk78 /h6AFG1ooy7LkJILtanQCVIUtyNld0kKT4lJ9xwB+KNxex8yGNIlB8lEeOFf9pv8GOXF 5zoZv1wE4lUfsfv6CPOeDUaGGzpCYhrxgf3aJG+z/ElIhVAy0ksJuyupjtE3WTv127MA 6tx8bRgqNdKEKCUwhjXcRw76DIv/DBSdAC/XGlRiIiepl2azpkWX1Rkg5GkYIoaL+F5E juqg== 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=UEcqsb6bW2oduFkseNRAuZBv2LLSGM4hUL5dPQQ2ZCboJHWuZXsFNvEoh71FYQ3l28 g8QLQI47/jSBUrzC5AZ+XSv5fTkn902R4q+B3gAPoViz7olVbGW0vIB73s3UbOBc9RuO RAJuqOVRKpjB3D09X71fgNsI1nqcTgZW6YV2GMxbmuDlmmPzEa+Z58W9sRVo8BupAPO5 12UFwoxJRLjnC1YtoGGQjLP6q3sbg6uB9DLKeLvxNrxW/6mg+bnNhoLHRjxw9oFvr+pt em7yTdxZgyRPFXAsOZvkK4AnU17jGB2L7hQhfToD9GMXXsWvHm3aeC8htILkLXp09ofy md4Q== X-Gm-Message-State: AOAM530xJO/5cKbzacNkLMXs54S9rL5YTgZJpWueVWu+71PsOIqLRMA1 R7DFkdKEuZLsBHDBfxa9S5JEFODi2cA= X-Google-Smtp-Source: ABdhPJybQ4SgQu1ky7nNUYT5cq8HnPD/2a8OsyEndUXgP16bPMeZ9328tYNpzacIr5Bots7FNsHKSA== X-Received: by 2002:a5d:40ca:: with SMTP id b10mr7969642wrq.56.1594751678040; Tue, 14 Jul 2020 11:34:38 -0700 (PDT) Received: from kheib-workstation.redhat.com ([37.142.6.100]) by smtp.gmail.com with ESMTPSA id 190sm5728982wmb.15.2020.07.14.11.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 11:34:37 -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 v1 2/7] RDMA/core: Allocate the pkey cache only if the pkey_tbl_len is set Date: Tue, 14 Jul 2020 21:34:09 +0300 Message-Id: <20200714183414.61069-3-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714183414.61069-1-kamalheib1@gmail.com> References: <20200714183414.61069-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 18:34:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11663353 X-Patchwork-Delegate: jgg@ziepe.ca 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 7737B13B6 for ; Tue, 14 Jul 2020 18:34:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F12020890 for ; Tue, 14 Jul 2020 18:34:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="t6Iqj31q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729248AbgGNSel (ORCPT ); Tue, 14 Jul 2020 14:34:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbgGNSel (ORCPT ); Tue, 14 Jul 2020 14:34:41 -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 2AA4EC061755 for ; Tue, 14 Jul 2020 11:34:41 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id f7so24001247wrw.1 for ; Tue, 14 Jul 2020 11:34:41 -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=t6Iqj31q2gjjpZWrdL4+62TaSB4YdtjIDSvBxzxK+zPBPTcNxl7n9c0y7/l97vS2KH Daearp3M08CpHFUHSIAxF4q7ywkW6kLPFn747r2n0uxpyd8MZdMg2ljAWG7J2JH1g6D1 BQnHBkzH9Df30ATta8rfbcV97OWPU6GJMU50Xx/lOO7XeQ06JtSK81friBIdWjHh7F8I rdoNecrI7h11fQBNkZfAKDEE6ce0+d3FTLfaEiZvsK857p6hkdXyCgia6pLzhPPyjsY8 s1XOZoJi2FeEKlLLA3Pf9TserXWsUC9tuWx8AXQACSPWMWqqZ1zDmeFIceD46JelK/cq 6fzw== 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=H+NnZUVp8AcCPOYojRrxkFT1hJ5s27RXxaKDW6evkU83qzC9psmrnCNelfjEokTWkb I1Lw9FjskKvgS4HW2kX+yHX8RA/Nzac4lmBW8icTv6IiftlU7xx4RLAGvS6MakAOPh67 F7pNQayCMK0N0et8pHM/XEXg54YUy8szAcaaElmgQ5dRQHEf0zosLdUhTmRcKd1WruJ9 9l+7hWTKo8uqsxOcLs3uOTmXVCsyr/Fys4fhi3/Coknba8rjnWmhEDS/pxRpMEcKkb9K T4f1UXJ75r2+U7yXhfqr0l5YKUqhMVE/6pqC6Z8pjHaJy7EbkJfj0GuDPbugrpV7Hei5 Zh8g== X-Gm-Message-State: AOAM5311Zg7mNkI2HrPm8b82v9waiX7xa1wMe2IKJfG9pPk0cV22l3uV 7e08KYKgfj9d0E1Bd0cSYUWNFfvRZUs= X-Google-Smtp-Source: ABdhPJygPUx+mzgtQFM6bczHNy0A+xK+1ePwmMa9mXqLw0QsReTWQACN4NyQoSeQ/bJjc4Ctcfh+8Q== X-Received: by 2002:adf:e6c1:: with SMTP id y1mr7858334wrm.116.1594751679763; Tue, 14 Jul 2020 11:34:39 -0700 (PDT) Received: from kheib-workstation.redhat.com ([37.142.6.100]) by smtp.gmail.com with ESMTPSA id 190sm5728982wmb.15.2020.07.14.11.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 11:34:39 -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 v1 3/7] RDMA/core: Remove query_pkey from the mandatory ops Date: Tue, 14 Jul 2020 21:34:10 +0300 Message-Id: <20200714183414.61069-4-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714183414.61069-1-kamalheib1@gmail.com> References: <20200714183414.61069-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 18:34:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11663431 X-Patchwork-Delegate: jgg@ziepe.ca 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 4BB6713B6 for ; Tue, 14 Jul 2020 19:36:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31A6622AAE for ; Tue, 14 Jul 2020 19:36:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GDsvb0Sn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729397AbgGNTgP (ORCPT ); Tue, 14 Jul 2020 15:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728768AbgGNTgP (ORCPT ); Tue, 14 Jul 2020 15:36:15 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E497CC061755 for ; Tue, 14 Jul 2020 12:36:14 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id g10so2173799wmc.1 for ; Tue, 14 Jul 2020 12:36:14 -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=GDsvb0Sns0yslIjkyrD+GopNAbDG9fJi90G9U/ytN8SsVJ3C8zDmpQ97myDxX5NstP yhIXq+kB8ljA7lLI46pwCJR2mkeScHZqPHDiy+4l6fotFGVrQVa7eskKeUSku94Nd3J/ YG6M698ELg7IeiwbRGbhzolUUicSeBQsOdKFX8W9egaE1uzDbDSavxwUoxGDTpPKDacc 0w/gEk3u4t6rtNK+ByY1l/EkkLZFjT/N3nHAS0sQ4TvUUbSGh3a3pWclS+jBF5rNImHn bpiAujfJpgs6F3zOruISDGNoycUb7n1ZhwzEFrSO2ijACJQABLak52cdDNIFdFVyL4+R sHkQ== 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=GyjQkXaUqcWKAm6lyQbvSCv9CitJQmWaXirTyjy8WMggXc+Cqgw9+QzFLYxhmpnEYB ILH2CTMWD2KOyXFV2RMshynEdee8D+swq13fFVgD30iYTcPxn8yDRtY7ZM2uYh7x5tcA pFsTFgu4GxtNWp5O5IzJCCLsqtcMGDNfU69G+QAAClo54udrG/PH53Znaa4qABpgbeU9 Ck+JOkL+DocrwHrPuapNsouDR9GN/gYhEI80mc9AaTZtuQ45QPAPvmOQyHUCKjNQuWxi erfhgwtj9lGPQJn6uVCLyvlrONjba92wG3KmCxUtOfmz0aNmJZyjBU7NHMNdWbZvjJpW rsog== X-Gm-Message-State: AOAM532j7ZxO25StsNfS//G56pbhoSXH0lq+XX0GarbRfL48bTu6IwbT L1IMRfnePpR0CJOd9rrE/MJ1wnK39EQ= X-Google-Smtp-Source: ABdhPJx21p9siKC0/+nDl+3Exqye+PQNXRLo8vsSwxZmNrBPal0IWViaQFnxazo5x9KeCWetIdQfIA== X-Received: by 2002:a1c:5a41:: with SMTP id o62mr5275197wmb.16.1594751681422; Tue, 14 Jul 2020 11:34:41 -0700 (PDT) Received: from kheib-workstation.redhat.com ([37.142.6.100]) by smtp.gmail.com with ESMTPSA id 190sm5728982wmb.15.2020.07.14.11.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 11:34:40 -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 v1 4/7] RDMA/siw: Remove the query_pkey callback Date: Tue, 14 Jul 2020 21:34:11 +0300 Message-Id: <20200714183414.61069-5-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714183414.61069-1-kamalheib1@gmail.com> References: <20200714183414.61069-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 Acked-by: Bernard Metzler --- 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 18:34:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11663427 X-Patchwork-Delegate: jgg@ziepe.ca 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 AFF38913 for ; Tue, 14 Jul 2020 19:32:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97B6022B30 for ; Tue, 14 Jul 2020 19:32:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FM9nN5YR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729047AbgGNTcH (ORCPT ); Tue, 14 Jul 2020 15:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728768AbgGNTcH (ORCPT ); Tue, 14 Jul 2020 15:32:07 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D8F2C061755 for ; Tue, 14 Jul 2020 12:32:07 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id a6so2168196wmm.0 for ; Tue, 14 Jul 2020 12:32:06 -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=FM9nN5YRTO16nE2d6U7h5hNXtdh8uS/nrwyiPXIyS9APA4NpJQE5LtCZuP+5MSCvk8 FANPmtXdUQtkbCdZpfF5v4GluMAMM1G0+wkGPsGM/B/s6DDzYA2OtyLhZNLiYSTj+R0Q sQeS4s/wygvRIe+xS/MHI5I4z4H2FTEfTSisarPSsYIeUdxrd+akUe5OBXplCA4bN8uU Mt6nNH+xyL4LSBrkBF+IT5j6Gp5K9C9Iu8X5eZr09Gz3GO+d7TzaYxyceOkfRRBzopOj iZxw7n9sgU5qs4ou+jhppMQ0uiav34cC0Z47pyn/vAO5Nmp/WAvahdNN4jU0BFT/qA6/ Lfuw== 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=TwB+Fdm7B++RDcwnmTZUw9Yy5wlaYZ+EQFzpq8EsWk2+2taKXcfdiEhiS9ByfyQJZC d/ms1WKC2MgPpHgEAoOp1HD05vYTqgCdZ5bfZSf91uf1+hZFS/ijXPX2Daod9XCNdDWQ H2LdeVKs/E7bxsfYPjA2e6dHEG414GIKetC4nfU/tcJUwpDiNmT2sF5/xdmzqDgGzINV pEHULQ+cqI0mM4Irz7kZEUewYSxuTwg0gAuurdIHi8NLyKYe0HSPyKAn8dXRdOc1qVew RXiCEcJ3cN9MYhq1T/O3rfVNLMgT8jizOYPUmknsTVV3N/yGGdge3ZkX74r5N2Ny7842 foTQ== X-Gm-Message-State: AOAM532ylXwPhlz4+g/zdcKZExAySL2M0mUJdVik2Dxs2McwnlM3xWAe uMKrMxGLZRGqHxPvpL6Gzd39GXB0VQ0= X-Google-Smtp-Source: ABdhPJzCEaiztsweMdla4nWQrXNHiC81XRDvrbnMuhKkcAmpq+P7dzxMQUoIVRJ4GHr4Gu1ZcFpp2w== X-Received: by 2002:a7b:ce14:: with SMTP id m20mr5500323wmc.129.1594751683108; Tue, 14 Jul 2020 11:34:43 -0700 (PDT) Received: from kheib-workstation.redhat.com ([37.142.6.100]) by smtp.gmail.com with ESMTPSA id 190sm5728982wmb.15.2020.07.14.11.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 11:34:42 -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 v1 5/7] RDMA/cxgb4: Remove the query_pkey callback Date: Tue, 14 Jul 2020 21:34:12 +0300 Message-Id: <20200714183414.61069-6-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714183414.61069-1-kamalheib1@gmail.com> References: <20200714183414.61069-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 18:34:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11663429 X-Patchwork-Delegate: jgg@ziepe.ca 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 7A9431392 for ; Tue, 14 Jul 2020 19:35:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6097B22AB9 for ; Tue, 14 Jul 2020 19:35:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Nl3Q9x/O" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729362AbgGNTfs (ORCPT ); Tue, 14 Jul 2020 15:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728768AbgGNTfs (ORCPT ); Tue, 14 Jul 2020 15:35:48 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E76AC061755 for ; Tue, 14 Jul 2020 12:35:48 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id o2so8929945wmh.2 for ; Tue, 14 Jul 2020 12:35:48 -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=Nl3Q9x/OMqKWrKY0RLFo/Z0KE82qIagjpPEjAaTF6GR1wC0g9WxZtyXjA3c39zu7iH t5xonN7LsK7e+lxlltYuIgJBJpU6JbXI7YBVRjerdLsvv2+2EQJXDPk/fbVz1g+8NHYD gD6vecC0ABz2Kzf/m0ZqwIvij8r7DWlyHR7g91K3m/l94Nz7MmQu1eI9s9C0ESijNvD8 F01YzAij+cVut820h/z3OBxmfhNY9ULumpp2obVv7ZHxyP31eHtDYJnBpPz0kvnpzQP0 ByR4AoejDTWrJ3Pvrz7QIoW17wKvj5G6OvfpkeTiFANx1DY1VVC0YoXsUa3FQe7pMhmG IrHg== 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=k8BgZqOqujQG5XbpOm/TrU77efiFXbget3hux+Qr4I+Kqo1GvGIqJFOFxImSXSPYfN 1W7EA73ACiJTgw7LChEyRpJkz2fCzW8MvWzJ+AUecChSS5rWEOs9iJK2ST/Oo+/DWxbM 9zl2BQ3Dg9bQdOGDy1aOVi6wxutreaLrrMoZcbSObceyon3Tki4n42KUkQKERwSy5yTW NSJPOGnH+Mg3qYr6XKy9QiQi0SjvSSoVJvfpRR9fHlhuowf3HNY4SEQnJU6TRnan6Y2I do/Nn+/Bh8bsosdoXLtGN8lW7RttqPaWKrnfLX1BVhsuY0Qx266ua/8kTrrfzb94ddBm TqLQ== X-Gm-Message-State: AOAM531ute6IQDa7vQfOGmXIMwKZ3c/9ek5pFXC8PrMYaPsrwYZuDCGi IyNQkK5E21ZoMHTmGv61bzDkAcd3tuA= X-Google-Smtp-Source: ABdhPJwUgd7x/ZH1pJmVIKLMufmthU8vrOfXxZ5Bp7/5NEG1yOnR0yS2x7vb+NRxxJa0a67USqKZeQ== X-Received: by 2002:a1c:e910:: with SMTP id q16mr5191791wmc.188.1594751684799; Tue, 14 Jul 2020 11:34:44 -0700 (PDT) Received: from kheib-workstation.redhat.com ([37.142.6.100]) by smtp.gmail.com with ESMTPSA id 190sm5728982wmb.15.2020.07.14.11.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 11:34:44 -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 v1 6/7] RDMA/i40iw: Remove the query_pkey callback Date: Tue, 14 Jul 2020 21:34:13 +0300 Message-Id: <20200714183414.61069-7-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714183414.61069-1-kamalheib1@gmail.com> References: <20200714183414.61069-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 18:34:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11663355 X-Patchwork-Delegate: jgg@ziepe.ca 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 A068B13B1 for ; Tue, 14 Jul 2020 18:34:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8725120890 for ; Tue, 14 Jul 2020 18:34:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="em/9xBX6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729257AbgGNSet (ORCPT ); Tue, 14 Jul 2020 14:34:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbgGNSes (ORCPT ); Tue, 14 Jul 2020 14:34:48 -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 4012DC061755 for ; Tue, 14 Jul 2020 11:34:48 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id z13so23978007wrw.5 for ; Tue, 14 Jul 2020 11:34:48 -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=p3yzgToC0gntlXge9ApCI/vT94bnlN6utlTzUkNXB2s=; b=em/9xBX69eZbRc+KcjacIriJ4jPD1T6rjxlPoa31E51Xz7i5hRbt5JT8H73saCeW2V Ouatp7e/7UDOAblANk+j8Y4O954CoFSfSE7PkfBlQ35ea1JUE2sp+zlbB8r3wsTIMvW0 rRIjkCVjSNJfxMg6SwP0JqITdoCwW0DpMtoUD5rINpEBumRPdKAQ5KFXBRwq3Wrb138N 91eQ0xxJSGNjEYD56MCN7ytvWLr7tWKi93YQalA5U1JBE2YvSf2tWWNUhJsp9a8w03z3 g26CMwko+fvTegGCH/Ljnz8M1N8u1HjA1OekXqUltLrXsJGwAiaBS8iayQfN1YvT3b9N HvtQ== 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=p3yzgToC0gntlXge9ApCI/vT94bnlN6utlTzUkNXB2s=; b=NuhPNz/N3zkgJmlOPszmqdLna/O9/wxa6+RqK+V4emrRksN3+0L6g5zpiWUZZMt0SK 2j7zgXztv1X3UPnMPrzSFHkev3w73YN57qYQKE3CM7qhAFtwpT/JcpOrBzfXDVbgH1/F qtFb+qjJcK6fgK68e14UpsBWiMnHtOa7EGBa++pcRmic3OZJFeiJVDkevHfOS5hYI583 XYob1gOS3TM6KEx2xlnwjrmexzexoQX181yMA+y2Ubi+Cuc7e3EIfb2E4yRFbU/QEtp/ 8uoO5SpsVzsINEslNJhUMrPJInhWUxhICUll00j5L6WZQ49QkSbO5tSDeA71t6GGlncv sM9Q== X-Gm-Message-State: AOAM532RcWAh2MiSv91GBmpsbnE4FrbMpxr7656p0CvkQEzvouppSHhu dtLLUOO+Zi5i5fRupcThRtLdL/DJxBU= X-Google-Smtp-Source: ABdhPJwPqjcgkHj5aRdXFWN4wPVeqMBf5lsgMOd76GGeDdm5jIzHjMSU/WOeToWsSM9GPcpbtVXZkw== X-Received: by 2002:a5d:6749:: with SMTP id l9mr7200112wrw.63.1594751686776; Tue, 14 Jul 2020 11:34:46 -0700 (PDT) Received: from kheib-workstation.redhat.com ([37.142.6.100]) by smtp.gmail.com with ESMTPSA id 190sm5728982wmb.15.2020.07.14.11.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2020 11:34:46 -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 , Michal Kalderon Subject: [PATCH for-next v1 7/7] RDMA/qedr: Remove the query_pkey callback Date: Tue, 14 Jul 2020 21:34:14 +0300 Message-Id: <20200714183414.61069-8-kamalheib1@gmail.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200714183414.61069-1-kamalheib1@gmail.com> References: <20200714183414.61069-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;