Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp168680pxu; Tue, 6 Oct 2020 23:04:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygFSklurWjazkFHZXuutlbddE745evRJtnSV8tJmdWvK1DcniIouZKKN5rH2vjSs7X1Kto X-Received: by 2002:aa7:cd90:: with SMTP id x16mr1819824edv.302.1602050668485; Tue, 06 Oct 2020 23:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602050668; cv=none; d=google.com; s=arc-20160816; b=dv9npsfUIOJ7xrarfihMqexBI92gAENtbjPpJ621LlPybDx9vxsB8usWFIHpMYuGfO 632Zwo1+YC8w/cvU6Nm9QSzmzAzfXRc9p4FAJ7pA32jMowDAVwUfzmsYH2Pcg+YnhhPe mfxSyW5ejDv/TMj+8IBqEg5yOGxNjN6J4qSVe0oU8en4ldylu4rsbgCjTUGoJiLfEBkg MB2KWN1ryc862Mn2TxRtSw2MdM1UuNs3XY6Z+AtfqzqRl6jZAREO7iNVm22ky4OhOfO0 e/ZcMBaOR3LRXmaQqm1IyFbs+5433gEie9fjqK4f7iHxhwydRyyMaUbiZmnVZ5Fsnexi G0+A== 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=LqrWHnOZsa9j10W0W1zhn0V+yABLmDMdbahORlsZ5WM=; b=Ni6fzk69ViPKWrvtrQFX50il2YZmAcSdZhHgmuAzUGRJVLC32q9iHT+WW2QJd2ZybY viKl/9id1b+ExRtaJ3BphQABLfaW2T3v4Qq2uSEURknPLLXT3cpsORwjkQ1wMWQ2zMG+ 7LG6Wuk8dmuq/+eIxjvMCt4I/XSMKkVgW0YYz7Jp8CRalpXD4QO98xPw/huTo02AqLqQ 04no2Yga2J0jEcN7+Hr3CmMmkBxBqx5KdEAur34aV45PBsJevaZOT+bwuKG9Y+NUKvNq Pid+SgfpLkDn6HD3gdOWE0puUPjor1Ce1Au6HLOR4NI+SB/UjoFl/vqc9VsiUPtU5bOH eXNw== 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 bu10si679906edb.54.2020.10.06.23.04.05; Tue, 06 Oct 2020 23:04:28 -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 S1727624AbgJGGCB (ORCPT + 99 others); Wed, 7 Oct 2020 02:02:01 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:34455 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727333AbgJGGB1 (ORCPT ); Wed, 7 Oct 2020 02:01:27 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 7 Oct 2020 09:01:18 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (dev-l-vrt-136.mtl.labs.mlnx [10.234.136.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09761HZb018866; Wed, 7 Oct 2020 09:01:17 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id 09761H1i021788; Wed, 7 Oct 2020 09:01:17 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id 09761HBL021786; Wed, 7 Oct 2020 09:01:17 +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 v2 12/16] devlink: Add enable_remote_dev_reset generic parameter Date: Wed, 7 Oct 2020 09:00:53 +0300 Message-Id: <1602050457-21700-13-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1602050457-21700-1-git-send-email-moshe@mellanox.com> References: <1602050457-21700-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 d2771e57a278..b01bb9bca5a2 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -469,6 +469,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, @@ -506,6 +507,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 dd889334fed9..a578634052a3 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -3521,6 +3521,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.18.2