lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190523104754.73202b23@cakuba.netronome.com>
Date:   Thu, 23 May 2019 10:47:54 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Jiri Pirko <jiri@...nulli.us>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, mlxsw@...lanox.com,
        sthemmin@...rosoft.com, dsahern@...il.com, saeedm@...lanox.com,
        leon@...nel.org
Subject: Re: [patch net-next 7/7] netdevsim: implement fake flash updating
 with notifications

On Thu, 23 May 2019 11:45:10 +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@...lanox.com>
> 
> Signed-off-by: Jiri Pirko <jiri@...lanox.com>
> ---
>  drivers/net/netdevsim/dev.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
> index b509b941d5ca..c15b86f9cd2b 100644
> --- a/drivers/net/netdevsim/dev.c
> +++ b/drivers/net/netdevsim/dev.c
> @@ -220,8 +220,43 @@ static int nsim_dev_reload(struct devlink *devlink,
>  	return 0;
>  }
>  
> +#define NSIM_DEV_FLASH_SIZE 500000
> +#define NSIM_DEV_FLASH_CHUNK_SIZE 1000
> +#define NSIM_DEV_FLASH_CHUNK_TIME_MS 10
> +
> +static int nsim_dev_flash_update(struct devlink *devlink, const char *file_name,
> +				 const char *component,
> +				 struct netlink_ext_ack *extack)
> +{
> +	int i;
> +
> +	devlink_flash_update_begin_notify(devlink);

Now I wonder if it would be good for the core to send those.  Is it
down to the driver to send the begin/end notifications because it would
be wasteful to always send them, or is it some ABI thing?

Also I wonder if it'd be useful for netdevsim to have a mode which
doesn't send notifications, to test both cases.

> +	devlink_flash_update_status_notify(devlink, "Preparing to flash",
> +					   component, 0, 0);
> +	for (i = 0; i < NSIM_DEV_FLASH_SIZE / NSIM_DEV_FLASH_CHUNK_SIZE; i++) {
> +		devlink_flash_update_status_notify(devlink, "Flashing",
> +						   component,
> +						   i * NSIM_DEV_FLASH_CHUNK_SIZE,
> +						   NSIM_DEV_FLASH_SIZE);
> +		msleep(NSIM_DEV_FLASH_CHUNK_TIME_MS);
> +	}
> +	devlink_flash_update_status_notify(devlink, "Flashing",
> +					   component,
> +					   NSIM_DEV_FLASH_SIZE,
> +					   NSIM_DEV_FLASH_SIZE);
> +
> +	devlink_flash_update_status_notify(devlink, "Flashing done",
> +					   component, 0, 0);
> +
> +	devlink_flash_update_end_notify(devlink);
> +
> +	return 0;
> +}
> +
>  static const struct devlink_ops nsim_dev_devlink_ops = {
>  	.reload = nsim_dev_reload,
> +	.flash_update = nsim_dev_flash_update,
>  };
>  
>  static struct nsim_dev *

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ