* [PATCH net-next v3] netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs
@ 2025-07-22 9:19 Jiri Pirko
2025-07-22 22:20 ` Jakub Kicinski
2025-07-24 2:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Pirko @ 2025-07-22 9:19 UTC (permalink / raw)
To: netdev; +Cc: davem, edumazet, kuba, pabeni, andrew+netdev, horms
From: Jiri Pirko <jiri@nvidia.com>
Netdevsim emulates firmware update and it takes 5 seconds to complete.
For some use cases, this is too long and unnecessary. Allow user to
configure the time by exposing debugfs a knob to set chunk time.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
v2->v3:
- reduced the exposed knobs to just time_ms, redurect flash size 10
times
v1->v2:
- added sanitiazation of the tunables before using them
---
drivers/net/netdevsim/dev.c | 9 ++++++---
drivers/net/netdevsim/netdevsim.h | 1 +
tools/testing/selftests/drivers/net/netdevsim/devlink.sh | 2 ++
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
index 01c7edb28d96..2672d071b325 100644
--- a/drivers/net/netdevsim/dev.c
+++ b/drivers/net/netdevsim/dev.c
@@ -314,6 +314,8 @@ static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
&nsim_dev->fw_update_status);
debugfs_create_u32("fw_update_overwrite_mask", 0600, nsim_dev->ddir,
&nsim_dev->fw_update_overwrite_mask);
+ debugfs_create_u32("fw_update_flash_chunk_time_ms", 0600, nsim_dev->ddir,
+ &nsim_dev->fw_update_flash_chunk_time_ms);
debugfs_create_u32("max_macs", 0600, nsim_dev->ddir,
&nsim_dev->max_macs);
debugfs_create_bool("test1", 0600, nsim_dev->ddir,
@@ -1015,9 +1017,9 @@ static int nsim_dev_info_get(struct devlink *devlink,
DEVLINK_INFO_VERSION_TYPE_COMPONENT);
}
-#define NSIM_DEV_FLASH_SIZE 500000
+#define NSIM_DEV_FLASH_SIZE 50000
#define NSIM_DEV_FLASH_CHUNK_SIZE 1000
-#define NSIM_DEV_FLASH_CHUNK_TIME_MS 10
+#define NSIM_DEV_FLASH_CHUNK_TIME_MS_DEFAULT 100
static int nsim_dev_flash_update(struct devlink *devlink,
struct devlink_flash_update_params *params,
@@ -1041,7 +1043,7 @@ static int nsim_dev_flash_update(struct devlink *devlink,
params->component,
i * NSIM_DEV_FLASH_CHUNK_SIZE,
NSIM_DEV_FLASH_SIZE);
- msleep(NSIM_DEV_FLASH_CHUNK_TIME_MS);
+ msleep(nsim_dev->fw_update_flash_chunk_time_ms ?: 1);
}
if (nsim_dev->fw_update_status) {
@@ -1585,6 +1587,7 @@ int nsim_drv_probe(struct nsim_bus_dev *nsim_bus_dev)
INIT_LIST_HEAD(&nsim_dev->port_list);
nsim_dev->fw_update_status = true;
nsim_dev->fw_update_overwrite_mask = 0;
+ nsim_dev->fw_update_flash_chunk_time_ms = NSIM_DEV_FLASH_CHUNK_TIME_MS_DEFAULT;
nsim_dev->max_macs = NSIM_DEV_MAX_MACS_DEFAULT;
nsim_dev->test1 = NSIM_DEV_TEST1_DEFAULT;
spin_lock_init(&nsim_dev->fa_cookie_lock);
diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h
index 8eeeb9256077..bddd24c1389d 100644
--- a/drivers/net/netdevsim/netdevsim.h
+++ b/drivers/net/netdevsim/netdevsim.h
@@ -317,6 +317,7 @@ struct nsim_dev {
struct list_head port_list;
bool fw_update_status;
u32 fw_update_overwrite_mask;
+ u32 fw_update_flash_chunk_time_ms;
u32 max_macs;
bool test1;
bool dont_allow_reload;
diff --git a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
index a102803ff74f..030762b203d7 100755
--- a/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
+++ b/tools/testing/selftests/drivers/net/netdevsim/devlink.sh
@@ -40,6 +40,8 @@ fw_flash_test()
return
fi
+ echo "10"> $DEBUGFS_DIR/fw_update_flash_chunk_time_ms
+
devlink dev flash $DL_HANDLE file $DUMMYFILE
check_err $? "Failed to flash with status updates on"
--
2.50.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs
2025-07-22 9:19 [PATCH net-next v3] netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs Jiri Pirko
@ 2025-07-22 22:20 ` Jakub Kicinski
2025-07-24 2:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-07-22 22:20 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, edumazet, pabeni, andrew+netdev, horms
On Tue, 22 Jul 2025 11:19:45 +0200 Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
>
> Netdevsim emulates firmware update and it takes 5 seconds to complete.
> For some use cases, this is too long and unnecessary. Allow user to
> configure the time by exposing debugfs a knob to set chunk time.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs
2025-07-22 9:19 [PATCH net-next v3] netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs Jiri Pirko
2025-07-22 22:20 ` Jakub Kicinski
@ 2025-07-24 2:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-24 2:00 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, davem, edumazet, kuba, pabeni, andrew+netdev, horms
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 22 Jul 2025 11:19:45 +0200 you wrote:
> From: Jiri Pirko <jiri@nvidia.com>
>
> Netdevsim emulates firmware update and it takes 5 seconds to complete.
> For some use cases, this is too long and unnecessary. Allow user to
> configure the time by exposing debugfs a knob to set chunk time.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>
> [...]
Here is the summary with links:
- [net-next,v3] netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs
https://git.kernel.org/netdev/net-next/c/9a5bbab285cd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-24 2:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 9:19 [PATCH net-next v3] netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs Jiri Pirko
2025-07-22 22:20 ` Jakub Kicinski
2025-07-24 2:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).