From patchwork Mon Sep 23 10:41:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11156601 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 E7C7517D4 for ; Mon, 23 Sep 2019 10:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6D0520835 for ; Mon, 23 Sep 2019 10:42:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GAxgdkaF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407220AbfIWKmP (ORCPT ); Mon, 23 Sep 2019 06:42:15 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39347 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729763AbfIWKmO (ORCPT ); Mon, 23 Sep 2019 06:42:14 -0400 Received: by mail-wr1-f67.google.com with SMTP id r3so13352412wrj.6 for ; Mon, 23 Sep 2019 03:42:13 -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=x9qZBJNnGOCRqEqEbxRrGaxjH2A/vCG2kzdnacqtBRo=; b=GAxgdkaFqjsNZyAakxIzatH6onrj5tyMMi9K8ZJncDMz+s0atySTa1YWMpDJ9L/UFO 3oJ/8/y41qQRzEufxAlqVphKjorhxsgDByuI0BSuy4aoLDEOp1DSXJqLTy4WvkVAo9Ko 9lDuEzC5iPBD46whI9ywK3Ugj2Rg++tGTqv2w/a+61C/YnnYkGvMAXp5UAPEie3UxcCo mRvGVhWovMRYyTVk/PC33x7Z6xDgvKy/ohJ8fWXLL3ztuaMDZpEo+KCHdCfMfUndkk3p xiOjS+XIqb7qB3PN47azzY7OEq0goIx7c+S75wre7WVXJY1zkwqFNtkKETf0Zt1VGZ2y /jyA== 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=x9qZBJNnGOCRqEqEbxRrGaxjH2A/vCG2kzdnacqtBRo=; b=lPesNUxz9k0I5yJiQv39HCk1jICKZe/Yq/4ApGoNTrume79T/4fflfoqxTtZXi6IP8 kgLY1+EH8AWuMG3W2PTWNLAXmC6/fO2UJae83xK+vm574CtkdLwFUcZSJEE4E7vFzXvp xiEyZXY0N+cqnvD9kob/gz2oCMH6DDD+QhTxTq0xYU90ggrkHYx29piKeUrzPuU+lc9C QFOa3ConwSZRpdF26pO+wm0xAp9RPrOAAiRY9rfYEA+cCYP7HCEMiJvuuxudxC4meD0a 3AVeh+isXWHBdN0DDau1aJYlrHpa2C/bcfeIrOzXU9/DI0kGOvJlBGZ+W/QyjNzwXpFY GspQ== X-Gm-Message-State: APjAAAXPTGFmM7mpo0Q8boVppNNRLDKPKgGX5vFwUcpRTHjBTmMag6HU gAGgtjUooTkq29EcbNMP4ouFXk8X X-Google-Smtp-Source: APXvYqz+w1J4gO6aze1YRUtZKap6LGPSiWfO0TxdLIU2ZunHeWuEG/SLgP6Bn5xTijfhNMRd1EJ9Rw== X-Received: by 2002:adf:efcb:: with SMTP id i11mr8272873wrp.69.1569235332479; Mon, 23 Sep 2019 03:42:12 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-181-41-92.red.bezeqint.net. [79.181.41.92]) by smtp.gmail.com with ESMTPSA id u22sm18508427wru.72.2019.09.23.03.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:42:12 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Selvin Xavier , Moni Shoua , Kamal Heib Subject: [PATCH for-next 1/3] RDMA/core: Fix return code when modify_device isn't supported Date: Mon, 23 Sep 2019 13:41:56 +0300 Message-Id: <20190923104158.5331-2-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923104158.5331-1-kamalheib1@gmail.com> References: <20190923104158.5331-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 proper return code is "-EOPNOTSUPP" when modify_device callback is not supported. Signed-off-by: Kamal Heib --- drivers/infiniband/core/device.c | 2 +- drivers/infiniband/core/sysfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 99c4a55545cf..a667636f74bf 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2365,7 +2365,7 @@ int ib_modify_device(struct ib_device *device, struct ib_device_modify *device_modify) { if (!device->ops.modify_device) - return -ENOSYS; + return -EOPNOTSUPP; return device->ops.modify_device(device, device_modify_mask, device_modify); diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 7a50cedcef1f..92c932c067cb 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -1268,7 +1268,7 @@ static ssize_t node_desc_store(struct device *device, int ret; if (!dev->ops.modify_device) - return -EIO; + return -EOPNOTSUPP; memcpy(desc.node_desc, buf, min_t(int, count, IB_DEVICE_NODE_DESC_MAX)); ret = ib_modify_device(dev, IB_DEVICE_MODIFY_NODE_DESC, &desc); From patchwork Mon Sep 23 10:41:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11156603 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 DB27713BD for ; Mon, 23 Sep 2019 10:42:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9EBA20867 for ; Mon, 23 Sep 2019 10:42:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="afQaDIJy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436676AbfIWKmQ (ORCPT ); Mon, 23 Sep 2019 06:42:16 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46761 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407110AbfIWKmQ (ORCPT ); Mon, 23 Sep 2019 06:42:16 -0400 Received: by mail-wr1-f67.google.com with SMTP id o18so13311297wrv.13 for ; Mon, 23 Sep 2019 03:42: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=Cz1LJdzWH/OvFVqiHLE6dIfJX3wb7zA3QsLXTXfoV6Q=; b=afQaDIJy8BnDcvLiZI6vNYIqtGQfBC4n+Nlmz1KCnsRdZOusBicXqDtFduEB8zu1hw b3T0j3px87Rf61+QvQtExGD4N2Rftnl9Fb5RudnOvWO4UMF1yElTZoKlJy4it2pXzASd OlZdepVjbSr/UOvq+HU17nG0TfsOq6g8IeLE/cLZthTACEOm20LpB/gmGGm3idd+tD36 +G+2R0xUbX0+UNVQqyEHIFa9NzY8PIy0REJ56RGGFac/7Bl4TXFSJLgmtRLy9mlh0HXV LwaJlkUJNNKyFrkUwzZnMC3gP5uTNF92ZqC16UcnlNwqFSwjJgoY8ngc2qYXRV4IPqpj dQyw== 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=Cz1LJdzWH/OvFVqiHLE6dIfJX3wb7zA3QsLXTXfoV6Q=; b=Be+pYU2bBvZ6WF8ifgJeuzoLTuuEaAYkSq3b96nZIjrrwa0eLcVRVjEWU7TyUxSk5n nxCbEdIYtDTaQsNQZkuSFDSrSmLFhGzcp4H5FOpbKJf9bpFimo6wzRfYoQfQ5SpJ2aD/ WQ4pRmInBNLnbK2c98ZZrlH1xqYorKlRpN2waXEh6jsTNiQalHmvjWvnoqrbXebQws63 xPINbLzMhng/4VO55JsT9zTBTIDAa3GvBgLrKcBFy0cwDXlOd3hlxEP0E18xBjU1WSF9 sNG0V0VKdwkkHGoMhEDb8XLnkVZvdJ7zfkXhz0lxpa2Jh0drvkJ/drZNZ1qUyoInv6TF N/hw== X-Gm-Message-State: APjAAAUZ58AIzSynHc+qR10w6WnKhb+MsQgxICZ2jzAMcH8mBwsPFuC/ 8jYeC9Cza4ADfVCzunAbIJjDJBte X-Google-Smtp-Source: APXvYqxDtnJAxUQ54t88uwkFecvDf0qAzf8Ft9bQlO/UFMWwOgjTzUATVMCjvEudEAm994gLUs6zKg== X-Received: by 2002:a5d:4e89:: with SMTP id e9mr20047666wru.48.1569235333823; Mon, 23 Sep 2019 03:42:13 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-181-41-92.red.bezeqint.net. [79.181.41.92]) by smtp.gmail.com with ESMTPSA id u22sm18508427wru.72.2019.09.23.03.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:42:13 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Selvin Xavier , Moni Shoua , Kamal Heib Subject: [PATCH for-next 2/3] RDMA/bnxt_re: Remove unsupported modify_device callback Date: Mon, 23 Sep 2019 13:41:57 +0300 Message-Id: <20190923104158.5331-3-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923104158.5331-1-kamalheib1@gmail.com> References: <20190923104158.5331-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 There is no need to return always zero for function which is not supported. Signed-off-by: Kamal Heib --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 18 ------------------ drivers/infiniband/hw/bnxt_re/ib_verbs.h | 3 --- drivers/infiniband/hw/bnxt_re/main.c | 1 - 3 files changed, 22 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index b4149dc9e824..8afd7d93cfe4 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -191,24 +191,6 @@ int bnxt_re_query_device(struct ib_device *ibdev, return 0; } -int bnxt_re_modify_device(struct ib_device *ibdev, - int device_modify_mask, - struct ib_device_modify *device_modify) -{ - switch (device_modify_mask) { - case IB_DEVICE_MODIFY_SYS_IMAGE_GUID: - /* Modify the GUID requires the modification of the GID table */ - /* GUID should be made as READ-ONLY */ - break; - case IB_DEVICE_MODIFY_NODE_DESC: - /* Node Desc should be made as READ-ONLY */ - break; - default: - break; - } - return 0; -} - /* Port */ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, struct ib_port_attr *port_attr) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.h b/drivers/infiniband/hw/bnxt_re/ib_verbs.h index 31662b1ee35a..23d972da5652 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.h +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.h @@ -145,9 +145,6 @@ struct bnxt_re_ucontext { int bnxt_re_query_device(struct ib_device *ibdev, struct ib_device_attr *ib_attr, struct ib_udata *udata); -int bnxt_re_modify_device(struct ib_device *ibdev, - int device_modify_mask, - struct ib_device_modify *device_modify); int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, struct ib_port_attr *port_attr); int bnxt_re_get_port_immutable(struct ib_device *ibdev, u8 port_num, diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 30a54f8aa42c..7b914bdd7c13 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -625,7 +625,6 @@ static const struct ib_device_ops bnxt_re_dev_ops = { .map_mr_sg = bnxt_re_map_mr_sg, .mmap = bnxt_re_mmap, .modify_ah = bnxt_re_modify_ah, - .modify_device = bnxt_re_modify_device, .modify_qp = bnxt_re_modify_qp, .modify_srq = bnxt_re_modify_srq, .poll_cq = bnxt_re_poll_cq, From patchwork Mon Sep 23 10:41:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Heib X-Patchwork-Id: 11156605 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 8D7471747 for ; Mon, 23 Sep 2019 10:42:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D1E720867 for ; Mon, 23 Sep 2019 10:42:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QPxdsbTN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436742AbfIWKmQ (ORCPT ); Mon, 23 Sep 2019 06:42:16 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33183 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436612AbfIWKmQ (ORCPT ); Mon, 23 Sep 2019 06:42:16 -0400 Received: by mail-wr1-f65.google.com with SMTP id b9so13390991wrs.0 for ; Mon, 23 Sep 2019 03:42:16 -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=Bie9KL9yJERoJZj4EjoE8MYg8DxrJf4PDDoi7h/yI5Y=; b=QPxdsbTNP7EdrQJX9EfFIUg6w/5lvGBF/OBov1/OwaClTNBrMNVvoX13Ml2f7fCfoy A387vnIEScjUnKLvLErICN0PXG3wnNC0elwISc7MfMlSXDOFkvO7jMA75sJQbwZC1LFs apCC7QzIJTdK5kfRVrvcAu8Qs7RTs6AQ+72FMkLNvxlHR5/fiMfP2LT3hYWDLQDI0ppH PrcIB9pCiyXQZaiwubnZu9eHqh5O8DCPHqpoY5I1qV/aBOz0dKtO6M7tUu38AtbYbNkc nrYoDRhL/nmc/QN/g2YFlheDOTwx8ZgqSxMRLmzFrZXnkkurIykomdsNpYspLzPBMKcQ nwAg== 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=Bie9KL9yJERoJZj4EjoE8MYg8DxrJf4PDDoi7h/yI5Y=; b=AxW55fopYfLwkFnLtVXlVyMew5SPQhlP3NirN4POBTfJdVSCQ8tdE/6uri/mP5DP0l haNJVXhUaW8DNFtoKE+2C/lAgLkR451nEqdxWEvQuG2vgE5/xtKq7Wggt8pAmMpBmbYx kjlIfBb1Krl7qAvWiqzaGI+phrRHuxSPKveHQZ6w6yEzJNnLmU4BKRi/Ij4m7w1a/yB4 VzJGYjMjPOLH3bynA8kU1YQXgUbA1nerQtFg6GC7n+PHsmPKCYnZlUiQ8Y+bq9eySwex mnxMop9bFqpdBz+RH1Sxir2VpFV6Kz0LGQ3XoyxxxJe3gtI/RjYKl8rOOumHv92KyQiq 1q/Q== X-Gm-Message-State: APjAAAWRFOKkEomNKE/YjIl2ALqBAZxakY2LqzxjX6BtHDu9P0z7kT29 JD86v9DdTj2j1bdlARd1bOqJ4OXn X-Google-Smtp-Source: APXvYqwTZUkEZnbmUtFSRAbfaxqJc0l/kgRhvcR8jnbyQLiwFPPyxpHMRStzeGiU0PDitoNrBxad0Q== X-Received: by 2002:adf:cf02:: with SMTP id o2mr9235413wrj.380.1569235335219; Mon, 23 Sep 2019 03:42:15 -0700 (PDT) Received: from kheib-workstation.redhat.com (bzq-79-181-41-92.red.bezeqint.net. [79.181.41.92]) by smtp.gmail.com with ESMTPSA id u22sm18508427wru.72.2019.09.23.03.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:42:14 -0700 (PDT) From: Kamal Heib To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Selvin Xavier , Moni Shoua , Kamal Heib Subject: [PATCH for-next 3/3] RDMA/rxe: Verify modify_device mask Date: Mon, 23 Sep 2019 13:41:58 +0300 Message-Id: <20190923104158.5331-4-kamalheib1@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923104158.5331-1-kamalheib1@gmail.com> References: <20190923104158.5331-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 Verify that the passed mask to rxe_modify_device() is supported. Signed-off-by: Kamal Heib --- drivers/infiniband/sw/rxe/rxe_verbs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 623129f27f5a..fa47bdcc7f54 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -106,6 +106,10 @@ static int rxe_modify_device(struct ib_device *dev, { struct rxe_dev *rxe = to_rdev(dev); + if (mask & ~(IB_DEVICE_MODIFY_SYS_IMAGE_GUID | + IB_DEVICE_MODIFY_NODE_DESC)) + return -EOPNOTSUPP; + if (mask & IB_DEVICE_MODIFY_SYS_IMAGE_GUID) rxe->attr.sys_image_guid = cpu_to_be64(attr->sys_image_guid);