Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4743584pjb; Mon, 27 Jul 2020 04:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrUmxgSyhgLIIrqfq7dtmiELCokWtHvbKoAhcrL/Livde3nwCBJ5hseNt+GlTh+8+H5p+R X-Received: by 2002:a17:906:fac1:: with SMTP id lu1mr21482543ejb.427.1595848113151; Mon, 27 Jul 2020 04:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595848113; cv=none; d=google.com; s=arc-20160816; b=mMVDvVtCB1APq87g0fuV2DKt8k9hSXMlEkIu+Q429POedvkTFJpX9saYbvgjoooJJo F1AHCSeMiYdD7lw4dmzmV/TDy4rsqcm3ub2nGZVoTBDSLyUYrZIn9rLKRGcrhZpiedIw NuL+9pC0PBwDhfXVCUvA4/Dpc34bXTsfKtoA8gEJT69590OgA+Gl0ISfmJXTOpCSvwS6 bAeWbvn9c6DSXQyaPUF/Eg1HFlQ1QETw9TwtieKHl1yohOx10MwTAq46yVhv2tWrRRSS X6erE3WMKkorRIDk4aHGWhiT+DMaC5kgfp/ZkJ80dTuXhpWhD4T7iI3FUefuKfuUmzAF kitg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Y7ps3H1wA1jvJ0pMC4HoaCM7JjJbGwNkclP2Xf3pJ8o=; b=eFqWpOlMNYYWgvWUMXLk2wOCbuaqx1H6lj6IsTjYnqFphGHpGG4pznP42yCxn2H4uR SChBQlxFRymJL4VommUu74eMmIxCxVRFmYvKv1XigPpMD2F27UjysFYRsj0DmH/AMIwE LGs1IwaAv5W/sBKVVkzan8+zYD21g0msvgP3odZTdMFSzojelkxGc03PyE0p9hZ3Os+t 28FGmfkzGfol9i+QzUh3FukoSoiZ3yLL6uYeiolW1I2GkkEnciUD7H4dA1dgTHjkNCGq MOTllyzvCq1zt6nLf4OuMBvk/yCfFVoHUqeWWW7WwHEPaDP4lyzq/e1jSehoI7mytvqy gAdw== 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 w21si5298905ejq.495.2020.07.27.04.08.10; Mon, 27 Jul 2020 04:08:33 -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 S1728578AbgG0LGW (ORCPT + 99 others); Mon, 27 Jul 2020 07:06:22 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:40705 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728535AbgG0LGR (ORCPT ); Mon, 27 Jul 2020 07:06:17 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 27 Jul 2020 14:06:13 +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 06RB6Dwf022243; Mon, 27 Jul 2020 14:06:13 +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 06RB6DJB002400; Mon, 27 Jul 2020 14:06:13 +0300 Received: (from moshe@localhost) by dev-l-vrt-135.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id 06RB6DeK002399; Mon, 27 Jul 2020 14:06:13 +0300 From: Moshe Shemesh To: "David S. Miller" , Jiri Pirko , Vasundhara Volam Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net-next RFC 09/13] devlink: Add enable_remote_dev_reset generic parameter Date: Mon, 27 Jul 2020 14:02:29 +0300 Message-Id: <1595847753-2234-10-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1595847753-2234-1-git-send-email-moshe@mellanox.com> References: <1595847753-2234-1-git-send-email-moshe@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org 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 --- 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 b291cd8d6be6..125e7bb9bb82 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -420,6 +420,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, @@ -457,6 +458,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 f1812fc620d4..4d7b0f2a6f7b 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -3230,6 +3230,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