[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200818205451.35191c0d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Tue, 18 Aug 2020 20:54:51 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: netdev@...r.kernel.org
Subject: Re: [net-next v3 3/4] devlink: introduce flash update overwrite
mask
On Tue, 18 Aug 2020 17:28:17 -0700 Jacob Keller wrote:
> +The ``devlink-flash`` command allows optionally specifying a mask indicating
> +the how the device should handle subsections of flash components when
remove one 'the'?
> +updating. This mask indicates the set of sections which are allowed to be
> +overwritten.
> diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
> index ebfc4a698809..74a869fbaa67 100644
> --- a/drivers/net/netdevsim/dev.c
> +++ b/drivers/net/netdevsim/dev.c
> @@ -201,6 +201,8 @@ static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
> return PTR_ERR(nsim_dev->ports_ddir);
> debugfs_create_bool("fw_update_status", 0600, nsim_dev->ddir,
> &nsim_dev->fw_update_status);
> + debugfs_create_u32("fw_update_overwrite_mask", 0600, nsim_dev->ddir,
> + &nsim_dev->fw_update_overwrite_mask);
Nice to see the test, but netdevsim changes could be separated out :S
> debugfs_create_u32("max_macs", 0600, nsim_dev->ddir,
> &nsim_dev->max_macs);
> debugfs_create_bool("test1", 0600, nsim_dev->ddir,
> -#define DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT BIT(0)
> +#define DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT BIT(0)
> +#define DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK BIT(1)
Since core will check supported flags, I'd be tempted to have a flag
for each override type. Saves an 'if' in every driver.
> struct devlink_region;
> struct devlink_info_req;
> diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
> index cfef4245ea5a..1d8bbe9c1ae1 100644
> --- a/include/uapi/linux/devlink.h
> +++ b/include/uapi/linux/devlink.h
> @@ -228,6 +228,28 @@ enum {
> DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1
> };
>
> +/* Specify what sections of a flash component can be overwritten when
> + * performing an update. Overwriting of firmware binary sections is always
> + * implicitly assumed to be allowed.
> + *
> + * Each section must be documented in
> + * Documentation/networking/devlink/devlink-flash.rst
> + *
> + */
> +enum {
> + DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT,
> + DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT,
IMHO generally a good practice to have 0 be undefined.
> + __DEVLINK_FLASH_OVERWRITE_MAX_BIT,
> + DEVLINK_FLASH_OVERWRITE_MAX_BIT = __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1
> +};
Powered by blists - more mailing lists