[PATCH v2 net-next 02/16] devlink: add enable_migration parameter
From: Shannon Nelson <hidden>
Date: 2022-12-07 00:45:15
Subsystem:
devlink, documentation, networking [general], the rest · Maintainers:
Jiri Pirko, Jonathan Corbet, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
Add a new device generic parameter to enable/disable support
for live migration in the devlink device. This is intended
primarily for a core device that supports other ports/VFs/SFs.
Those dependent ports may need their own migratable parameter
for individual enable/disable control.
Examples:
$ devlink dev param set pci/0000:07:00.0 name enable_migration value true cmode runtime
$ devlink dev param show pci/0000:07:00.0 name enable_migration
pci/0000:07:00.0:
name enable_migration type generic
values:
cmode runtime value true
Signed-off-by: Shannon Nelson <redacted>
---
Documentation/networking/devlink/devlink-params.rst | 3 +++
include/net/devlink.h | 4 ++++
net/core/devlink.c | 5 +++++
3 files changed, 12 insertions(+)
diff --git a/Documentation/networking/devlink/devlink-params.rst b/Documentation/networking/devlink/devlink-params.rst
index 7cf1cd68ff08..602c8d487afd 100644
--- a/Documentation/networking/devlink/devlink-params.rst
+++ b/Documentation/networking/devlink/devlink-params.rst@@ -141,3 +141,6 @@ own name. - u8 - Select the bank of firmware to be used on future boot and/or resets in devices that have multiple firmware memory banks. + * - ``enable_migration`` + - Boolean + - Enable/disable support for live migration in the devlink device.
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 3fa26a26fa44..79842b174915 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h@@ -511,6 +511,7 @@ enum devlink_param_generic_id { DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE, DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE, DEVLINK_PARAM_GENERIC_ID_FW_BANK, + DEVLINK_PARAM_GENERIC_ID_ENABLE_MIGRATION, /* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -572,6 +573,9 @@ enum devlink_param_generic_id { #define DEVLINK_PARAM_GENERIC_FW_BANK_NAME "fw_bank" #define DEVLINK_PARAM_GENERIC_FW_BANK_TYPE DEVLINK_PARAM_TYPE_U8 +#define DEVLINK_PARAM_GENERIC_ENABLE_MIGRATION_NAME "enable_migration" +#define DEVLINK_PARAM_GENERIC_ENABLE_MIGRATION_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 25a075f0aadd..b51c1d0da29f 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c@@ -5226,6 +5226,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_FW_BANK_NAME, .type = DEVLINK_PARAM_GENERIC_FW_BANK_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_ENABLE_MIGRATION, + .name = DEVLINK_PARAM_GENERIC_ENABLE_MIGRATION_NAME, + .type = DEVLINK_PARAM_GENERIC_ENABLE_MIGRATION_TYPE, + }, }; static int devlink_param_generic_verify(const struct devlink_param *param)
--
2.17.1