Re: [PATCH net-next v4 03/10] ethtool: Add an interface for flashing transceiver modules' firmware

From: Jakub Kicinski
Date: Thu Apr 18 2024 - 22:08:06 EST


On Thu, 18 Apr 2024 13:34:48 +0300 Danielle Ratson wrote:
> + -
> + name: module-fw-flash
> + attributes:
> + -
> + name: header
> + type: nest
> + nested-attributes: header
> + -
> + name: file-name
> + type: string
> + -
> + name: password
> + type: u32
> + -
> + name: module-fw-flash-ntf
> + attributes:
> + -
> + name: header
> + type: nest
> + nested-attributes: header
> + -
> + name: status
> + type: u32
> + enum: module-fw-flash-status
> + -
> + name: status-msg
> + type: string
> + -
> + name: done
> + type: u64

uint?

> + -
> + name: total
> + type: u64

same?

> +enum {
> + ETHTOOL_A_MODULE_FW_FLASH_UNSPEC,
> + ETHTOOL_A_MODULE_FW_FLASH_HEADER, /* nest - _A_HEADER_* */
> + ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME, /* string */
> + ETHTOOL_A_MODULE_FW_FLASH_PASSWORD, /* u32 */
> + ETHTOOL_A_MODULE_FW_FLASH_PAD,
> + ETHTOOL_A_MODULE_FW_FLASH_STATUS, /* u8 */
> + ETHTOOL_A_MODULE_FW_FLASH_STATUS_MSG, /* string */
> + ETHTOOL_A_MODULE_FW_FLASH_DONE, /* u64 */
> + ETHTOOL_A_MODULE_FW_FLASH_TOTAL, /* u64 */
> +
> + /* add new constants above here */
> + __ETHTOOL_A_MODULE_FW_FLASH_CNT,
> + ETHTOOL_A_MODULE_FW_FLASH_MAX = (__ETHTOOL_A_MODULE_FW_FLASH_CNT - 1)
> +};

The next patch uses these names for notifications and patch 9 for the
action. The YAML spec should contain basically this same info.
Not sure why the spec ended up with two different nests.
Just translate this enum into YAML:

name: module-fw-flash
attributes:
-
name: header
type: nest
nested-attributes: header
-
name: file-name
type: string
-
name: password
type: u32
-
name: pad
type: pad
-
name: status
type: u8
...

And you can use this nest in multiple operations, using the attributes
members of the operation to narrow down which members will show up
in given op.