From: Simon Horman <simon.horman@netronome.com>
To: David Miller <davem@davemloft.net>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>,
netdev@vger.kernel.org, oss-drivers@netronome.com,
Dirk van der Merwe <dirk.vandermerwe@netronome.com>,
Simon Horman <simon.horman@netronome.com>
Subject: [net-next 02/11] devlink: add 'reset_dev_on_drv_probe' param
Date: Fri, 6 Sep 2019 18:00:52 +0200 [thread overview]
Message-ID: <20190906160101.14866-3-simon.horman@netronome.com> (raw)
In-Reply-To: <20190906160101.14866-1-simon.horman@netronome.com>
From: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Add the 'reset_dev_on_drv_probe' devlink parameter, controlling the
device reset policy on driver probe.
This parameter is useful in conjunction with the existing
'fw_load_policy' parameter.
Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
Documentation/networking/devlink-params.txt | 14 ++++++++++++++
include/net/devlink.h | 4 ++++
include/uapi/linux/devlink.h | 7 +++++++
net/core/devlink.c | 5 +++++
4 files changed, 30 insertions(+)
diff --git a/Documentation/networking/devlink-params.txt b/Documentation/networking/devlink-params.txt
index fadb5436188d..f9e30d686243 100644
--- a/Documentation/networking/devlink-params.txt
+++ b/Documentation/networking/devlink-params.txt
@@ -51,3 +51,17 @@ fw_load_policy [DEVICE, GENERIC]
* DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK (2)
Load firmware currently available on host's disk.
Type: u8
+
+reset_dev_on_drv_probe [DEVICE, GENERIC]
+ Controls the device's reset policy on driver probe.
+ Valid values:
+ * DEVLINK_PARAM_RESET_DEV_VALUE_UNKNOWN (0)
+ Unknown or invalid value.
+ * DEVLINK_PARAM_RESET_DEV_VALUE_ALWAYS (1)
+ Always reset device on driver probe.
+ * DEVLINK_PARAM_RESET_DEV_VALUE_NEVER (2)
+ Never reset device on driver probe.
+ * DEVLINK_PARAM_RESET_DEV_VALUE_DISK (3)
+ Reset only if device firmware can be found in the
+ filesystem.
+ Type: u8
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 460bc629d1a4..d880de5b8d3a 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -398,6 +398,7 @@ enum devlink_param_generic_id {
DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY,
+ DEVLINK_PARAM_GENERIC_ID_RESET_DEV,
/* add new param generic ids above here*/
__DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -428,6 +429,9 @@ enum devlink_param_generic_id {
#define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME "fw_load_policy"
#define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE DEVLINK_PARAM_TYPE_U8
+#define DEVLINK_PARAM_GENERIC_RESET_DEV_NAME "reset_dev_on_drv_probe"
+#define DEVLINK_PARAM_GENERIC_RESET_DEV_TYPE DEVLINK_PARAM_TYPE_U8
+
#define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \
{ \
.id = DEVLINK_PARAM_GENERIC_ID_##_id, \
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index c25cc29a6647..3172d1b3329f 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -205,6 +205,13 @@ enum devlink_param_fw_load_policy_value {
DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK,
};
+enum devlink_param_reset_dev_value {
+ DEVLINK_PARAM_RESET_DEV_VALUE_UNKNOWN,
+ DEVLINK_PARAM_RESET_DEV_VALUE_ALWAYS,
+ DEVLINK_PARAM_RESET_DEV_VALUE_NEVER,
+ DEVLINK_PARAM_RESET_DEV_VALUE_DISK,
+};
+
enum {
DEVLINK_ATTR_STATS_RX_PACKETS, /* u64 */
DEVLINK_ATTR_STATS_RX_BYTES, /* u64 */
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 6e52d639dac6..e8bc96f104a7 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -2852,6 +2852,11 @@ static const struct devlink_param devlink_param_generic[] = {
.name = DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME,
.type = DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE,
},
+ {
+ .id = DEVLINK_PARAM_GENERIC_ID_RESET_DEV,
+ .name = DEVLINK_PARAM_GENERIC_RESET_DEV_NAME,
+ .type = DEVLINK_PARAM_GENERIC_RESET_DEV_TYPE,
+ },
};
static int devlink_param_generic_verify(const struct devlink_param *param)
--
2.11.0
next prev parent reply other threads:[~2019-09-06 16:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 16:00 [net-next 00/11] nfp: implement firmware loading policy Simon Horman
2019-09-06 16:00 ` [net-next 01/11] devlink: extend 'fw_load_policy' values Simon Horman
2019-09-06 16:00 ` Simon Horman [this message]
2019-09-06 18:31 ` [net-next 02/11] devlink: add 'reset_dev_on_drv_probe' param Jiri Pirko
2019-09-06 18:40 ` Dirk van der Merwe
2019-09-07 4:17 ` Jakub Kicinski
2019-09-07 10:28 ` Jiri Pirko
2019-09-06 16:00 ` [net-next 03/11] nfp: nsp: add support for fw_loaded command Simon Horman
2019-09-06 16:00 ` [net-next 04/11] nfp: nsp: add support for optional hwinfo lookup Simon Horman
2019-09-06 16:00 ` [net-next 05/11] nfp: nsp: add support for hwinfo set operation Simon Horman
2019-09-06 16:00 ` [net-next 06/11] nfp: honor FW reset and loading policies Simon Horman
2019-09-06 16:00 ` [net-next 07/11] nfp: add devlink param infrastructure Simon Horman
2019-09-06 16:00 ` [net-next 08/11] nfp: devlink: add 'fw_load_policy' support Simon Horman
2019-09-06 16:00 ` [net-next 09/11] nfp: devlink: add 'reset_dev_on_drv_probe' support Simon Horman
2019-09-06 16:01 ` [net-next 10/11] kdoc: fix nfp_fw_load documentation Simon Horman
2019-09-06 16:01 ` [net-next 11/11] Documentation: nfp: add nfp driver specific notes Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190906160101.14866-3-simon.horman@netronome.com \
--to=simon.horman@netronome.com \
--cc=davem@davemloft.net \
--cc=dirk.vandermerwe@netronome.com \
--cc=jakub.kicinski@netronome.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox