Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1319053pxk; Fri, 18 Sep 2020 09:17:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB0pmsVYMMBY1UvY6zpuhnCQmdO9MPqww+CYqZQc5dUvTU9wlR/thu56gMiCw0ZtaDEjC7 X-Received: by 2002:a05:6402:180a:: with SMTP id g10mr38813190edy.18.1600445850934; Fri, 18 Sep 2020 09:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600445850; cv=none; d=google.com; s=arc-20160816; b=bXnbYegGBdWBS7tCo9TnZuuskpTTwdZCBVVwxuOECckdWfyM+tjCeJugRhB9d2HUOa HAhsRpFSZ8rnp+a48Fgddtwsb2joRGT0QpCUv0Hi4Vbwpgb3g3UsYTPfKcZjuK+SdjeJ Z6S0R0SAQ62plSU8WapBbIQ46QiYaPMZxZrby3V1L36f4bkFjcC6lgV5G2RK/ejVbv/h s7EseRrNNLpt7zXjnjDCg/V+SIzlzaTQcM2oMAYs8uXKLJI4nyXllPTzJl85YTk2zqBW TWLf5crBOcRX3ipkDNBvqGhVRCNtwmf72fMKOQ/38iE2XxbTASI9UjGZ4bNf2tU1w17o JFHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=qLc494ecoYT6hsAR0kytIJscJRYT/FGOfBbkCHv0v1Q=; b=xbR4MVcQYjToQpWKRSej3bahf1Kt0KyBWMq/HNdoE+dafXFJHHNA4W5L5urCr/xm7+ JSLi1TFuCeMExe/o88RUqoJDgcSN3PzOAkyoXwL59zmsaux6LozfWBkIbQyiEOJLgzkE MKONuN7a3zGqG74gQZhfV/GAaL5Qc3/qvA1J+TQrNbDWAp7ZZapLBbhvMozt6m0vT6NB GwHNP/kNG5zOjNkqnDgy+nCz8CSlBeUpkkJr5dXBdf5X/3jnIEaoMztgRkDTs6FWP/Xq Hw16R4jaWjZecBiK1lwb4NHwMXEMJJ7Aq1WfsKd2LGwHyrPeOCem0OkXdcHClCfa6/RN dg8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si2398105edi.558.2020.09.18.09.17.08; Fri, 18 Sep 2020 09:17:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgIRQPY (ORCPT + 99 others); Fri, 18 Sep 2020 12:15:24 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:55249 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726379AbgIRQN5 (ORCPT ); Fri, 18 Sep 2020 12:13:57 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 18 Sep 2020 19:07:11 +0300 Received: from dev-l-vrt-135.mtl.labs.mlnx (dev-l-vrt-135.mtl.labs.mlnx [10.234.135.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 08IG7BiF025159; Fri, 18 Sep 2020 19:07:11 +0300 Received: from dev-l-vrt-135.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-135.mtl.labs.mlnx (8.15.2/8.15.2/Debian-10) with ESMTP id 08IG7BUB031169; Fri, 18 Sep 2020 19:07:11 +0300 Received: (from moshe@localhost) by dev-l-vrt-135.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id 08IG7Bje031168; Fri, 18 Sep 2020 19:07:11 +0300 From: Moshe Shemesh To: "David S. Miller" , Jakub Kicinski , Jiri Pirko Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net-next RFC v5 11/15] devlink: Add enable_remote_dev_reset generic parameter Date: Fri, 18 Sep 2020 19:06:47 +0300 Message-Id: <1600445211-31078-12-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1600445211-31078-1-git-send-email-moshe@mellanox.com> References: <1600445211-31078-1-git-send-email-moshe@mellanox.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The enable_remote_dev_reset devlink param flags that the host admin allows device resets that can be initiated by other hosts. This parameter is useful for setups where a device is shared by different hosts, such as multi-host setup. Once the user set this parameter to false, the driver should NACK any attempt to reset the device while the driver is loaded. Signed-off-by: Moshe Shemesh Reviewed-by: Jiri Pirko --- Documentation/networking/devlink/devlink-params.rst | 6 ++++++ include/net/devlink.h | 4 ++++ net/core/devlink.c | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/Documentation/networking/devlink/devlink-params.rst b/Documentation/networking/devlink/devlink-params.rst index d075fd090b3d..54c9f107c4b0 100644 --- a/Documentation/networking/devlink/devlink-params.rst +++ b/Documentation/networking/devlink/devlink-params.rst @@ -108,3 +108,9 @@ own name. * - ``region_snapshot_enable`` - Boolean - Enable capture of ``devlink-region`` snapshots. + * - ``enable_remote_dev_reset`` + - Boolean + - Enable device reset by remote host. When cleared, the device driver + will NACK any attempt of other host to reset the device. This parameter + is useful for setups where a device is shared by different hosts, such + as multi-host setup. diff --git a/include/net/devlink.h b/include/net/devlink.h index f09f55a47d09..8ab5ac5c365f 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -445,6 +445,7 @@ enum devlink_param_generic_id { DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY, DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE, DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE, + DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET, /* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX, @@ -482,6 +483,9 @@ enum devlink_param_generic_id { #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME "enable_roce" #define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE DEVLINK_PARAM_TYPE_BOOL +#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_NAME "enable_remote_dev_reset" +#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL + #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \ { \ .id = DEVLINK_PARAM_GENERIC_ID_##_id, \ diff --git a/net/core/devlink.c b/net/core/devlink.c index 71aeda259e6a..565fa786d01f 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -3458,6 +3458,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME, .type = DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET, + .name = DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_NAME, + .type = DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_TYPE, + }, }; static int devlink_param_generic_verify(const struct devlink_param *param) -- 2.17.1