[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <02874ECE860811409154E81DA85FBB58C8B9BF18@fmsmsx101.amr.corp.intel.com>
Date: Wed, 19 Aug 2020 16:01:02 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [net-next v3 3/4] devlink: introduce flash update overwrite mask
> -----Original Message-----
> From: Jakub Kicinski <kuba@...nel.org>
> Sent: Tuesday, August 18, 2020 8:55 PM
> To: Keller, Jacob E <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
>
Yea I can do that
> > 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.
>
Combinations might not be valid (as in ice where identifiers alone isn't supportable) but I suppose I could add something for it.
Would it make sense to just add them to the supported_flash_update_params? This results in a bit offset where the "supported" bits don't match the actual used bits in overwrite_mask, so we could also introduce a separate "supported_overwrite_mask" but that might just be overkill since I doubt we'll need to add more than a handlful of overwrite bits...
> > 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.
>
Even for bits? I saw that for attribute values 0 was undefined, but that didn't seem right for a bit position. sending the bitfield with zero bit set means the same as not sending the bitfield.
> > + __DEVLINK_FLASH_OVERWRITE_MAX_BIT,
> > + DEVLINK_FLASH_OVERWRITE_MAX_BIT =
> __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1
> > +};
Powered by blists - more mailing lists