[PATCH v2 net-next 01/16] devlink: add fw bank select parameter
From: Shannon Nelson <hidden>
Date: 2022-12-07 00:45:13
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 select the bank of
firmware to be used on future boot and/or resets in those
devices that have multiple firmware memory banks. This can
be used along with the FW_LOAD_POLICY parameter, depending on
the capabilities of the particular device.
Examples:
$ devlink dev param set pci/0000:07:00.0 name fw_bank value 1 cmode permanent
$ devlink dev param show pci/0000:07:00.0 name fw_bank
pci/0000:07:00.0:
name fw_bank type generic
values:
cmode permanent value 1
Link: https://lore.kernel.org/netdev/CO1PR11MB508942BE965E63893DE9B86AD6129@CO1PR11MB5089.namprd11.prod.outlook.com/ (local)
Signed-off-by: Shannon Nelson <redacted>
---
Documentation/networking/devlink/devlink-params.rst | 4 ++++
include/net/devlink.h | 4 ++++
net/core/devlink.c | 5 +++++
3 files changed, 13 insertions(+)
diff --git a/Documentation/networking/devlink/devlink-params.rst b/Documentation/networking/devlink/devlink-params.rst
index 4e01dc32bc08..7cf1cd68ff08 100644
--- a/Documentation/networking/devlink/devlink-params.rst
+++ b/Documentation/networking/devlink/devlink-params.rst@@ -137,3 +137,7 @@ own name. * - ``event_eq_size`` - u32 - Control the size of asynchronous control events EQ. + * - ``fw_bank`` + - u8 + - Select the bank of firmware to be used on future boot and/or resets in + devices that have multiple firmware memory banks.
diff --git a/include/net/devlink.h b/include/net/devlink.h
index 5f6eca5e4a40..3fa26a26fa44 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h@@ -510,6 +510,7 @@ enum devlink_param_generic_id { DEVLINK_PARAM_GENERIC_ID_ENABLE_IWARP, DEVLINK_PARAM_GENERIC_ID_IO_EQ_SIZE, DEVLINK_PARAM_GENERIC_ID_EVENT_EQ_SIZE, + DEVLINK_PARAM_GENERIC_ID_FW_BANK, /* add new param generic ids above here*/ __DEVLINK_PARAM_GENERIC_ID_MAX,
@@ -568,6 +569,9 @@ enum devlink_param_generic_id { #define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME "event_eq_size" #define DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE DEVLINK_PARAM_TYPE_U32 +#define DEVLINK_PARAM_GENERIC_FW_BANK_NAME "fw_bank" +#define DEVLINK_PARAM_GENERIC_FW_BANK_TYPE DEVLINK_PARAM_TYPE_U8 + #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 907df7124157..25a075f0aadd 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c@@ -5221,6 +5221,11 @@ static const struct devlink_param devlink_param_generic[] = { .name = DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_NAME, .type = DEVLINK_PARAM_GENERIC_EVENT_EQ_SIZE_TYPE, }, + { + .id = DEVLINK_PARAM_GENERIC_ID_FW_BANK, + .name = DEVLINK_PARAM_GENERIC_FW_BANK_NAME, + .type = DEVLINK_PARAM_GENERIC_FW_BANK_TYPE, + }, }; static int devlink_param_generic_verify(const struct devlink_param *param)
--
2.17.1