netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs
Subsystems (4)
PATCH v3 1/1 netdevsim: add fw_update_flash_chunk_time_ms debugfs knobs
From: Jiri Pirko <[email protected]>
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.
---v2->v3:
- reduced the exposed knobs to just time_ms, redurect flash size 10 timesv1->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(-)
drivers/net/netdevsim/dev.c +6 -3
@@ -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);
drivers/net/netdevsim/netdevsim.h +1 -0
@@ -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;
tools/testing/selftests/drivers/net/netdevsim/devlink.sh +2 -0
@@ -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"
Signature · 1 line
2.50.1
Quoted 7 lines · On Tue, 22 Jul 2025 11:19:45 +0200 Jiri Pirko wrote:
From: Jiri Pirko <[email protected]>
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 <[email protected]>
Thanks!
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 22 Jul 2025 11:19:45 +0200 you wrote:
From: Jiri Pirko <[email protected]>
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 <[email protected]>[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html