mbox series

[iproute2-next,v4,0/2] devlink: add flash update overwrite mask

Message ID 20200909222842.33952-1-jacob.e.keller@intel.com
Headers show
Series devlink: add flash update overwrite mask | expand

Message

Jacob Keller Sept. 9, 2020, 10:28 p.m. UTC
This series implements the iproute2 side of the new
DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK.

This attribute is used to allow userspace to indicate what a device should
do with various subsections of a flash component when updating. For example,
a flash component might contain vital data such as the PCIe serial number or
configuration fields such as settings that control device bootup.

The overwrite mask allows the user to specify what behavior they want when
performing an update. If nothing is specified, then the update should
preserve all vital fields and configuration.

By specifying "overwrite identifiers" the user requests that the flash
update should overwrite any identifiers in the updated flash component with
identifier values from the provided flash image.

  $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite identifiers

By specifying "overwrite settings" the user requests that the flash update
should overwrite any settings in the updated flash component with setting
values from the provided flash image.

  $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite settings

These options may be combined, in which case both subsections will be sent
in the overwrite mask, resulting in a request to overwrite all settings and
identifiers stored in the updated flash components.

  $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite settings overwrite identifiers

Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Jakub Kicinski <kuba@kernel.org>

Jacob Keller (2):
  Update devlink header for overwrite mask attribute
  devlink: support setting the overwrite mask

 devlink/devlink.c            | 48 ++++++++++++++++++++++++++++++++++--
 include/uapi/linux/devlink.h | 27 ++++++++++++++++++++
 2 files changed, 73 insertions(+), 2 deletions(-)


base-commit: ad34d5fadb0b4699b0fe136fc408685e26bb1b43

Comments

David Ahern Sept. 29, 2020, 3:33 p.m. UTC | #1
On 9/9/20 3:28 PM, Jacob Keller wrote:
> This series implements the iproute2 side of the new
> DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK.
> 
> This attribute is used to allow userspace to indicate what a device should
> do with various subsections of a flash component when updating. For example,
> a flash component might contain vital data such as the PCIe serial number or
> configuration fields such as settings that control device bootup.
> 
> The overwrite mask allows the user to specify what behavior they want when
> performing an update. If nothing is specified, then the update should
> preserve all vital fields and configuration.
> 
> By specifying "overwrite identifiers" the user requests that the flash
> update should overwrite any identifiers in the updated flash component with
> identifier values from the provided flash image.
> 
>   $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite identifiers
> 
> By specifying "overwrite settings" the user requests that the flash update
> should overwrite any settings in the updated flash component with setting
> values from the provided flash image.
> 
>   $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite settings
> 
> These options may be combined, in which case both subsections will be sent
> in the overwrite mask, resulting in a request to overwrite all settings and
> identifiers stored in the updated flash components.
> 
>   $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite settings overwrite identifiers
> 
> Cc: Jiri Pirko <jiri@mellanox.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> 
> Jacob Keller (2):
>   Update devlink header for overwrite mask attribute
>   devlink: support setting the overwrite mask
> 
>  devlink/devlink.c            | 48 ++++++++++++++++++++++++++++++++++--
>  include/uapi/linux/devlink.h | 27 ++++++++++++++++++++
>  2 files changed, 73 insertions(+), 2 deletions(-)
> 
> 
> base-commit: ad34d5fadb0b4699b0fe136fc408685e26bb1b43
> 

Jacob:

Compile fails on Ubuntu 20.04:

devlink
    CC       devlink.o
In file included from devlink.c:29:
devlink.c: In function ‘flash_overwrite_section_get’:
../include/uapi/linux/devlink.h:249:42: warning: implicit declaration of
function ‘_BITUL’ [-Wimplicit-function-declaration]
  249 | #define DEVLINK_FLASH_OVERWRITE_SETTINGS
_BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)
      |                                          ^~~~~~
devlink.c:1293:12: note: in expansion of macro
‘DEVLINK_FLASH_OVERWRITE_SETTINGS’
 1293 |   *mask |= DEVLINK_FLASH_OVERWRITE_SETTINGS;
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CC       mnlg.o
    LINK     devlink

I updated headers in -next; please redo the patch set and roll the cover
letter details in patch 2.
Jacob Keller Sept. 29, 2020, 6 p.m. UTC | #2
On 9/29/2020 8:33 AM, David Ahern wrote:
> On 9/9/20 3:28 PM, Jacob Keller wrote:
>> This series implements the iproute2 side of the new
>> DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK.
>>
>> This attribute is used to allow userspace to indicate what a device should
>> do with various subsections of a flash component when updating. For example,
>> a flash component might contain vital data such as the PCIe serial number or
>> configuration fields such as settings that control device bootup.
>>
>> The overwrite mask allows the user to specify what behavior they want when
>> performing an update. If nothing is specified, then the update should
>> preserve all vital fields and configuration.
>>
>> By specifying "overwrite identifiers" the user requests that the flash
>> update should overwrite any identifiers in the updated flash component with
>> identifier values from the provided flash image.
>>
>>   $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite identifiers
>>
>> By specifying "overwrite settings" the user requests that the flash update
>> should overwrite any settings in the updated flash component with setting
>> values from the provided flash image.
>>
>>   $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite settings
>>
>> These options may be combined, in which case both subsections will be sent
>> in the overwrite mask, resulting in a request to overwrite all settings and
>> identifiers stored in the updated flash components.
>>
>>   $devlink dev flash pci/0000:af:00.0 file flash_image.bin overwrite settings overwrite identifiers
>>
>> Cc: Jiri Pirko <jiri@mellanox.com>
>> Cc: Jakub Kicinski <kuba@kernel.org>
>>
>> Jacob Keller (2):
>>   Update devlink header for overwrite mask attribute
>>   devlink: support setting the overwrite mask
>>
>>  devlink/devlink.c            | 48 ++++++++++++++++++++++++++++++++++--
>>  include/uapi/linux/devlink.h | 27 ++++++++++++++++++++
>>  2 files changed, 73 insertions(+), 2 deletions(-)
>>
>>
>> base-commit: ad34d5fadb0b4699b0fe136fc408685e26bb1b43
>>
> 
> Jacob:
> 
> Compile fails on Ubuntu 20.04:
> 
> devlink
>     CC       devlink.o
> In file included from devlink.c:29:
> devlink.c: In function ‘flash_overwrite_section_get’:
> ../include/uapi/linux/devlink.h:249:42: warning: implicit declaration of
> function ‘_BITUL’ [-Wimplicit-function-declaration]
>   249 | #define DEVLINK_FLASH_OVERWRITE_SETTINGS
> _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)
>       |                                          ^~~~~~
> devlink.c:1293:12: note: in expansion of macro
> ‘DEVLINK_FLASH_OVERWRITE_SETTINGS’
>  1293 |   *mask |= DEVLINK_FLASH_OVERWRITE_SETTINGS;
>       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     CC       mnlg.o
>     LINK     devlink
> 
> I updated headers in -next; please redo the patch set and roll the cover
> letter details in patch 2.
> 

This appears to be because uapi/linux/const.h isn't included... I am not
sure what the correct fix here is.. should this be part of the include
chain for uapi/linux/devlink.h? I could add this to the devlink.c file
but that feels incorrect since the definition/usage is in
uapi/linux/devlink.h...

Thanks,
Jake