Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp421572pxk; Sun, 30 Aug 2020 08:34:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3M7p7DWBYnrkE9hmudAei6QjA2HeoEDmnXIPvN61djS7uPZq4qWa7L8tld1W6pzf7F2Dr X-Received: by 2002:a50:fd10:: with SMTP id i16mr3203602eds.54.1598801640128; Sun, 30 Aug 2020 08:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598801640; cv=none; d=google.com; s=arc-20160816; b=zdxWsAAOceo1r7HEfKqbgdWfbGH5Mwb9/tVUDaBMdpS3dUinXZd6PSvXVgFapdzyFW d+T1Y85lUWsQoL89J9Ocben4VUTxHsTyHc1f46Fbh2z4Eo7RCJ884giFEDZUztU5nuIa YhHAW5Jg62e5uSzkgcGOGoeXVK/APOJBs6aBrzVbgva3wHyCFM0zWm8SX7hethskSaMK DR02KDICw68dD+zxFLH8IwSPGAGcf0+YpwYRUq1EHPZ+7LBd20pgvL4DmudmcWgC3KLL cj36JJgyHeTFIf240m/KlNH8L8qiUgy390rAcd2+UCh9siX7M8Lsx1RtexgjIn/5ZM2z ij7w== 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=IL7tkidnAvGS90uAGDqBOcQluzPGACyYTGy6bQ/2LwU=; b=lFR1FSTFMtR18bVQP0mzDl1tI9jIxBnp0kbT/en3Wlj3O1kFGKLWAOdEkFa37KAwR2 /uBqwaSr5j7WDmAVCL0F3SUd1xEULi0cn+2owAYI07f1xxLA+JYNcHvSarVg3TMqQaOM Lb6dR5yYq1FZXWxcqoOB2UfeWqEJM+g+HsMnZ5gLvGSbQi2mvnEFGMkkDLFdZGxOjyXV H7gs/Q/16Sb8K1NCdoVzLFUxp/H9c4VYf/8XqH3Qljyd6mofCFumV7fHJ68+yOclaFlm 6WyEYDTXRAhYEg18V4FgpRHog2ntSWolWPl0JD83W68it24Y5XKtkhBKMj/lrbxx6Ll0 gOvQ== 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 ox9si1787554ejb.97.2020.08.30.08.33.37; Sun, 30 Aug 2020 08:34:00 -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 S1726143AbgH3Pcu (ORCPT + 99 others); Sun, 30 Aug 2020 11:32:50 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:42756 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726712AbgH3P2C (ORCPT ); Sun, 30 Aug 2020 11:28:02 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 30 Aug 2020 18:27:56 +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 07UFRutt029662; Sun, 30 Aug 2020 18:27:56 +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 07UFRu9m027849; Sun, 30 Aug 2020 18:27:56 +0300 Received: (from moshe@localhost) by dev-l-vrt-135.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id 07UFRu8P027848; Sun, 30 Aug 2020 18:27:56 +0300 From: Moshe Shemesh To: "David S. Miller" , Jakub Kicinski Cc: Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Moshe Shemesh Subject: [PATCH net-next RFC v3 10/14] devlink: Add enable_remote_dev_reset generic parameter Date: Sun, 30 Aug 2020 18:27:30 +0300 Message-Id: <1598801254-27764-11-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1598801254-27764-1-git-send-email-moshe@mellanox.com> References: <1598801254-27764-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 0547f0707d92..231b277136cd 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -421,6 +421,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, @@ -458,6 +459,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 962b14295380..e9ec6b5dfd0b 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -3312,6 +3312,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