introduce PLDM firmware update library
Subsystems (13)
Jacob Keller
maintainerv2 cover introduce PLDM firmware update library
This series goal is to enable support for updating the ice hardware flash using the devlink flash command.
The ice firmware update files are distributed using the file format described by the "PLDM for Firmware Update" standard:
https://www.dmtf.org/documents/pmci/pldm-firmware-update-specification-100
Because this file format is standard, this series introduces a new library that handles the generic logic for parsing the PLDM file header. The library uses a design that is very similar to the Mellanox mlxfw module. That is, a simple ops table is setup and device drivers instantiate an instance of the pldmfw library with the device specific operations.
Doing so allows for each device to implement the low level behavior for how to interact with its firmware.
This series includes the library and an implementation for the ice hardware. Additionally, it includes a final patch which introduces a new attribute to the devlink flash command.
Because the PLDM file format is a standard and not something that is specific to the Intel hardware, I opted to place this update library in lib/pldmfw. I should note that while I tried to make the library generic, it does not attempt to mimic the complete "Update Agent" as defined in the standard. This is mostly due to the fact that the actual interfaces exposed to software for the ice hardware would not allow this.
This series is currently based on top of Jeff Kirsher's dev-queue, as it relies on some cleanup of the device capabilities code that was recently published. For non-Intel drivers, this tree matches net-next. Once this series has left RFC status, I will be submitting it via net-next directly.
The Intel Wired LAN dev-queue can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git/log/?h=dev-queue
Changes since v1 RFC
* Removed the "allow_downgrade_on_flash_update" parameter. Instead, the driver will always attempt to flash the device, even when firmware indicates that it would be a downgrade. A dev_warn is used to indicate when this occurs.
* Removed the "ignore_pending_flash_update". Instead, the driver will always check for and cancel any previous pending update. A devlink flash status message will be sent when this cancellation occurs.
* Removed the "reset_after_flash_update" parameter. This will instead be implemented as part of a devlink reset interface, work left for a future change.
* Replaced the "flash_update_preservation_level" parameter with a new "overwrite" mode attribute on the flash update command. For ice, this mode will select the preservation level. For all other drivers, I modified them to check that the mode is "OVERWRITE_NOTHING", and have Cc'd the maintainers to get their input.
Cudzilo, Szymon T (1):
ice: Add AdminQ commands for FW update
Jacek Naczyk (1):
ice: Add support for unified NVM update flow capability
Jacob Keller (4):
ice: add flags indicating pending update of firmware module Add pldmfw library for PLDM firmware update
ice: implement device flash update via devlink
devlink: add overwrite mode to flash update
Documentation/driver-api/index.rst | 1 + .../driver-api/pldmfw/driver-ops.rst | 56 ++ .../driver-api/pldmfw/file-format.rst | 203 ++++ Documentation/driver-api/pldmfw/index.rst | 72 ++ .../networking/devlink/devlink-flash.rst | 31 + Documentation/networking/devlink/ice.rst | 27 + MAINTAINERS | 7 + .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +- .../net/ethernet/huawei/hinic/hinic_devlink.c | 3 + drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 9 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 83 ++ drivers/net/ethernet/intel/ice/ice_common.c | 21 +- drivers/net/ethernet/intel/ice/ice_common.h | 4 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 56 ++ .../net/ethernet/intel/ice/ice_fw_update.c | 805 ++++++++++++++++ .../net/ethernet/intel/ice/ice_fw_update.h | 12 + drivers/net/ethernet/intel/ice/ice_main.c | 154 +++ drivers/net/ethernet/intel/ice/ice_nvm.c | 186 ++++ drivers/net/ethernet/intel/ice/ice_nvm.h | 16 + drivers/net/ethernet/intel/ice/ice_type.h | 12 + .../net/ethernet/mellanox/mlx5/core/devlink.c | 4 + drivers/net/ethernet/mellanox/mlxsw/core.c | 3 +- drivers/net/ethernet/mellanox/mlxsw/core.h | 1 + .../net/ethernet/mellanox/mlxsw/spectrum.c | 4 + .../net/ethernet/netronome/nfp/nfp_devlink.c | 6 +- drivers/net/netdevsim/dev.c | 1 + include/linux/pldmfw.h | 165 ++++ include/net/devlink.h | 1 + include/uapi/linux/devlink.h | 16 + lib/Kconfig | 4 + lib/Makefile | 3 + lib/pldmfw/Makefile | 2 + lib/pldmfw/pldmfw.c | 879 ++++++++++++++++++ lib/pldmfw/pldmfw_private.h | 238 +++++ net/core/devlink.c | 16 +- 37 files changed, 3101 insertions(+), 9 deletions(-) create mode 100644 Documentation/driver-api/pldmfw/driver-ops.rst create mode 100644 Documentation/driver-api/pldmfw/file-format.rst create mode 100644 Documentation/driver-api/pldmfw/index.rst create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.c create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.h create mode 100644 include/linux/pldmfw.h create mode 100644 lib/pldmfw/Makefile create mode 100644 lib/pldmfw/pldmfw.c create mode 100644 lib/pldmfw/pldmfw_private.h
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH v2 1/6 ice: Add support for unified NVM update flow capability
From: Jacek Naczyk <[email protected]>
Extends function parsing response from Discover Device Capability AQC to check if the device supports unified NVM update flow.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 7 +++++++ drivers/net/ethernet/intel/ice/ice_type.h | 3 +++ 3 files changed, 11 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -109,6 +109,7 @@ struct ice_aqc_list_caps_elem {#define ICE_AQC_CAPS_MSIX 0x0043#define ICE_AQC_CAPS_FD 0x0045#define ICE_AQC_CAPS_MAX_MTU 0x0047 +#define ICE_AQC_CAPS_NVM_MGMT 0x0080u8 major_ver;u8 minor_ver;
drivers/net/ethernet/intel/ice/ice_common.c +7 -0
@@ -1855,6 +1855,13 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,"%s: msix_vector_first_id = %d\n" , prefix, caps->msix_vector_first_id);break ; +case ICE_AQC_CAPS_NVM_MGMT : + caps->nvm_unified_update = + (number &ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT ) ? + true : false; +ice_debug (hw,ICE_DBG_INIT ,"%s: nvm_unified_update = %d\n" , prefix, + caps->nvm_unified_update); +break ;case ICE_AQC_CAPS_MAX_MTU : caps->max_mtu = number; ice_debug(hw, ICE_DBG_INIT, "%s: max_mtu = %d\n",
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -262,6 +262,9 @@ struct ice_hw_common_caps {u8 rss_table_entry_width;/* RSS Entry width in bits */ u8 dcb; + +bool nvm_unified_update; +#define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT BIT(3) };/* Function specific capabilities */
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH v2 2/6 ice: Add AdminQ commands for FW update
In reply to Jacob KellerFrom: "Cudzilo, Szymon T" <[email protected]>
Add structures, identifiers, and helper functions for several AdminQ commands related to performing a firmware update for the ice hardware. These will be used in future code for implementing the devlink .flash_update handler.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 76 +++++++ drivers/net/ethernet/intel/ice/ice_common.h | 2 - drivers/net/ethernet/intel/ice/ice_nvm.c | 186 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_nvm.h | 16 ++ drivers/net/ethernet/intel/ice/ice_type.h | 3 + 5 files changed, 281 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +76 -0
@@ -1299,7 +1299,14 @@ struct ice_aqc_nvm {#define ICE_AQC_NVM_PRESERVATION_M (3 << ICE_AQC_NVM_PRESERVATION_S)#define ICE_AQC_NVM_NO_PRESERVATION (0 << ICE_AQC_NVM_PRESERVATION_S)#define ICE_AQC_NVM_PRESERVE_ALL BIT(1) +#define ICE_AQC_NVM_FACTORY_DEFAULT (2 << ICE_AQC_NVM_PRESERVATION_S)#define ICE_AQC_NVM_PRESERVE_SELECTED (3 << ICE_AQC_NVM_PRESERVATION_S) +#define ICE_AQC_NVM_ACTIV_SEL_NVM BIT(3)/* Write Activate/SR Dump only */ +#define ICE_AQC_NVM_ACTIV_SEL_OROM BIT(4) +#define ICE_AQC_NVM_ACTIV_SEL_NETLIST BIT(5) +#define ICE_AQC_NVM_SPECIAL_UPDATE BIT(6) +#define ICE_AQC_NVM_REVERT_LAST_ACTIV BIT(6)/* Write Activate only */ +#define ICE_AQC_NVM_ACTIV_SEL_MASK ICE_M(0x7, 3)#define ICE_AQC_NVM_FLASH_ONLY BIT(7)__le16 module_typeid;__le16 length;
@@ -1348,6 +1355,67 @@ struct ice_aqc_nvm_checksum {#define ICE_AQC_NVM_NETLIST_ID_BLK_SHA_HASH 0xA#define ICE_AQC_NVM_NETLIST_ID_BLK_CUST_VER 0x2F +/* Used for NVM Set Package Data command - 0x070A */ +struct ice_aqc_nvm_pkg_data { +u8 reserved[3 ]; +u8 cmd_flags; +#define ICE_AQC_NVM_PKG_DELETE BIT(0)/* used for command call */ +#define ICE_AQC_NVM_PKG_SKIPPED BIT(0)/* used for command response */ + +u32 reserved1; +__le32 addr_high; +__le32 addr_low; +}; + +/* Used for Pass Component Table command - 0x070B */ +struct ice_aqc_nvm_pass_comp_tbl { +u8 component_response;/* Response only */ +#define ICE_AQ_NVM_PASS_COMP_CAN_BE_UPDATED 0x0 +#define ICE_AQ_NVM_PASS_COMP_CAN_MAY_BE_UPDATEABLE 0x1 +#define ICE_AQ_NVM_PASS_COMP_CAN_NOT_BE_UPDATED 0x2 +u8 component_response_code;/* Response only */ +#define ICE_AQ_NVM_PASS_COMP_CAN_BE_UPDATED_CODE 0x0 +#define ICE_AQ_NVM_PASS_COMP_STAMP_IDENTICAL_CODE 0x1 +#define ICE_AQ_NVM_PASS_COMP_STAMP_LOWER 0x2 +#define ICE_AQ_NVM_PASS_COMP_INVALID_STAMP_CODE 0x3 +#define ICE_AQ_NVM_PASS_COMP_CONFLICT_CODE 0x4 +#define ICE_AQ_NVM_PASS_COMP_PRE_REQ_NOT_MET_CODE 0x5 +#define ICE_AQ_NVM_PASS_COMP_NOT_SUPPORTED_CODE 0x6 +#define ICE_AQ_NVM_PASS_COMP_CANNOT_DOWNGRADE_CODE 0x7 +#define ICE_AQ_NVM_PASS_COMP_INCOMPLETE_IMAGE_CODE 0x8 +#define ICE_AQ_NVM_PASS_COMP_VER_STR_IDENTICAL_CODE 0xA +#define ICE_AQ_NVM_PASS_COMP_VER_STR_LOWER_CODE 0xB +u8 reserved; +u8 transfer_flag; +#define ICE_AQ_NVM_PASS_COMP_TBL_START 0x1 +#define ICE_AQ_NVM_PASS_COMP_TBL_MIDDLE 0x2 +#define ICE_AQ_NVM_PASS_COMP_TBL_END 0x4 +#define ICE_AQ_NVM_PASS_COMP_TBL_START_AND_END 0x5 +__le32 reserved1; +__le32 addr_high; +__le32 addr_low; +}; + +struct ice_aqc_nvm_comp_tbl { +__le16 comp_class; +#define NVM_COMP_CLASS_ALL_FW 0x000A + +__le16 comp_id; +#define NVM_COMP_ID_OROM 0x5 +#define NVM_COMP_ID_NVM 0x6 +#define NVM_COMP_ID_NETLIST 0x8 + +u8 comp_class_idx; +#define FWU_COMP_CLASS_IDX_NOT_USE 0x0 + +__le32 comp_cmp_stamp; +u8 cvs_type; +#define NVM_CVS_TYPE_ASCII 0x1 + +u8 cvs_len; +u8 cvs[];/* Component Version String */ +} __packed; +/** * Send to PF command (indirect 0x0801) ID is only used by PF *
@@ -1795,6 +1863,8 @@ struct ice_aq_desc {struct ice_aqc_rl_profile rl_profile;struct ice_aqc_nvm nvm;struct ice_aqc_nvm_checksum nvm_checksum; +struct ice_aqc_nvm_pkg_data pkg_data; +struct ice_aqc_nvm_pass_comp_tbl pass_comp_tbl;struct ice_aqc_pf_vf_msg virt;struct ice_aqc_lldp_get_mib lldp_get_mib;struct ice_aqc_lldp_set_mib_change lldp_set_event;
@@ -1929,7 +1999,13 @@ enum ice_adminq_opc {/* NVM commands */ ice_aqc_opc_nvm_read =0x0701 , + ice_aqc_opc_nvm_erase =0x0702 , + ice_aqc_opc_nvm_write =0x0703 , ice_aqc_opc_nvm_checksum =0x0706 , + ice_aqc_opc_nvm_write_activate =0x0707 , + ice_aqc_opc_nvm_update_empr =0x0709 , + ice_aqc_opc_nvm_pkg_data =0x070A , + ice_aqc_opc_nvm_pass_component_tbl =0x070B ,/* PF/VF mailbox commands */ ice_mbx_opc_send_msg_to_pf = 0x0801,
drivers/net/ethernet/intel/ice/ice_common.h +0 -2
@@ -11,8 +11,6 @@#include "ice_switch.h" #include <linux/avf/virtchnl.h> -enum ice_status ice_nvm_validate_checksum (struct ice_hw *hw); -enum ice_status ice_init_hw (struct ice_hw *hw);void ice_deinit_hw (struct ice_hw *hw);enum ice_status ice_check_reset (struct ice_hw *hw);
drivers/net/ethernet/intel/ice/ice_nvm.c +186 -0
195 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.h +16 -0
@@ -17,4 +17,20 @@ enum ice_status ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);enum ice_status ice_init_nvm (struct ice_hw *hw);enum ice_status ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data); +enum ice_status +ice_aq_update_nvm (struct ice_hw *hw,u16 module_typeid,u32 offset, +u16 length,void *data,bool last_command,u8 command_flags, +struct ice_sq_cd *cd); +enum ice_status +ice_aq_erase_nvm (struct ice_hw *hw,u16 module_typeid,struct ice_sq_cd *cd); +enum ice_status ice_nvm_validate_checksum (struct ice_hw *hw); +enum ice_status ice_nvm_write_activate (struct ice_hw *hw,u8 cmd_flags); +enum ice_status ice_aq_nvm_update_empr (struct ice_hw *hw); +enum ice_status +ice_nvm_set_pkg_data (struct ice_hw *hw,bool del_pkg_data_flag,u8 *data, +u16 length,struct ice_sq_cd *cd); +enum ice_status +ice_nvm_pass_component_tbl (struct ice_hw *hw,u8 *data,u16 length, +u8 transfer_flag,u8 *comp_response, +u8 *comp_response_code,struct ice_sq_cd *cd);#endif /* _ICE_NVM_H_ */
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -801,6 +801,9 @@ enum ice_sw_fwd_act_type {#define ICE_OROM_VER_SHIFT 24#define ICE_OROM_VER_MASK (0xff << ICE_OROM_VER_SHIFT)#define ICE_SR_PFA_PTR 0x40 +#define ICE_SR_1ST_NVM_BANK_PTR 0x42 +#define ICE_SR_1ST_OROM_BANK_PTR 0x44 +#define ICE_SR_NETLIST_BANK_PTR 0x46#define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800/* Link override related */
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH v2 3/6 ice: add flags indicating pending update of firmware module
In reply to Jacob KellerAfter a flash update, the pending status of the update can be determined from the device capabilities.
Read the appropriate device capability and store whether there is a pending update awaiting a reboot.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 6 ++++++ drivers/net/ethernet/intel/ice/ice_common.c | 12 ++++++++++++ drivers/net/ethernet/intel/ice/ice_type.h | 6 ++++++ 3 files changed, 24 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +6 -0
@@ -109,6 +109,12 @@ struct ice_aqc_list_caps_elem {#define ICE_AQC_CAPS_MSIX 0x0043#define ICE_AQC_CAPS_FD 0x0045#define ICE_AQC_CAPS_MAX_MTU 0x0047 +#define ICE_AQC_CAPS_NVM_VER 0x0048 +#define ICE_AQC_CAPS_PENDING_NVM_VER 0x0049 +#define ICE_AQC_CAPS_OROM_VER 0x004A +#define ICE_AQC_CAPS_PENDING_OROM_VER 0x004B +#define ICE_AQC_CAPS_NET_VER 0x004C +#define ICE_AQC_CAPS_PENDING_NET_VER 0x004D#define ICE_AQC_CAPS_NVM_MGMT 0x0080u8 major_ver;
drivers/net/ethernet/intel/ice/ice_common.c +12 -0
@@ -1855,6 +1855,18 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,"%s: msix_vector_first_id = %d\n" , prefix, caps->msix_vector_first_id);break ; +case ICE_AQC_CAPS_PENDING_NVM_VER : + caps->nvm_update_pending_nvm = true; +ice_debug (hw,ICE_DBG_INIT ,"%s: update_pending_nvm\n" , prefix); +break ; +case ICE_AQC_CAPS_PENDING_OROM_VER : + caps->nvm_update_pending_orom = true; +ice_debug (hw,ICE_DBG_INIT ,"%s: update_pending_orom\n" , prefix); +break ; +case ICE_AQC_CAPS_PENDING_NET_VER : + caps->nvm_update_pending_netlist = true; +ice_debug (hw,ICE_DBG_INIT ,"%s: update_pending_netlist\n" , prefix); +break ;case ICE_AQC_CAPS_NVM_MGMT : caps->nvm_unified_update = (number & ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT) ?
drivers/net/ethernet/intel/ice/ice_type.h +6 -0
@@ -263,6 +263,12 @@ struct ice_hw_common_caps {u8 dcb; +bool nvm_update_pending_nvm; +bool nvm_update_pending_orom; +bool nvm_update_pending_netlist; +#define ICE_NVM_PENDING_NVM_IMAGE BIT(0) +#define ICE_NVM_PENDING_OROM BIT(1) +#define ICE_NVM_PENDING_NETLIST BIT(2)bool nvm_unified_update;#define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT BIT(3) };
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH v2 4/6 Add pldmfw library for PLDM firmware update
In reply to Jacob KellerThe pldmfw library is used to implement common logic needed to flash devices based on firmware files using the format described by the PLDM for Firmware Update standard.
This library consists of logic to parse the PLDM file format from a firmware file object, as well as common logic for sending the relevant PLDM header data to the device firmware.
A simple ops table is provided so that device drivers can implement device specific hardware interactions while keeping the common logic to the pldmfw library.
This library will be used by the Intel ice networking driver as part of implementing device flash update via devlink. The library aims to be vendor and device agnostic. For this reason, it has been placed in lib/pldmfw, in the hopes that other devices which use the PLDM firmware file format may benefit from it in the future. However, do note that not all features defined in the PLDM standard have been implemented.
--- Documentation/driver-api/index.rst | 1 + .../driver-api/pldmfw/driver-ops.rst | 56 ++ .../driver-api/pldmfw/file-format.rst | 203 ++++ Documentation/driver-api/pldmfw/index.rst | 72 ++ MAINTAINERS | 7 + include/linux/pldmfw.h | 165 ++++ lib/Kconfig | 4 + lib/Makefile | 3 + lib/pldmfw/Makefile | 2 + lib/pldmfw/pldmfw.c | 879 ++++++++++++++++++ lib/pldmfw/pldmfw_private.h | 238 +++++ 11 files changed, 1630 insertions(+) create mode 100644 Documentation/driver-api/pldmfw/driver-ops.rst create mode 100644 Documentation/driver-api/pldmfw/file-format.rst create mode 100644 Documentation/driver-api/pldmfw/index.rst create mode 100644 include/linux/pldmfw.h create mode 100644 lib/pldmfw/Makefile create mode 100644 lib/pldmfw/pldmfw.c create mode 100644 lib/pldmfw/pldmfw_private.h
Documentation/driver-api/index.rst +1 -0
@@ -95,6 +95,7 @@ available subsections can be seen below. phy/index pti_intel_mid pwm + pldmfw/index rfkill serial/index sm501
Documentation/driver-api/pldmfw/driver-ops.rst new file +56 -0
56 lines not on this page · raw message
Documentation/driver-api/pldmfw/file-format.rst new file +203 -0
203 lines not on this page · raw message
Documentation/driver-api/pldmfw/index.rst new file +72 -0
72 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -13587,6 +13587,13 @@ S: Maintained F: Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml F: drivers/iio/chemical/pms7003.c +PLDMFW LIBRARY +M: Jacob Keller <[email protected]> +S: Maintained +F: Documentation/driver-api/pldmfw/ +F: include/linux/pldmfw.h +F: lib/pldmfw/ + PLX DMA DRIVER M: Logan Gunthorpe <[email protected]> S: Maintained
include/linux/pldmfw.h new file +165 -0
165 lines not on this page · raw message
lib/Kconfig +4 -0
@@ -676,3 +676,7 @@ config GENERIC_LIB_CMPDI2 config GENERIC_LIB_UCMPDI2 bool + +config PLDMFW + bool + default n
lib/Makefile +3 -0
@@ -315,6 +315,9 @@ obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o obj-$(CONFIG_OBJAGG) += objagg.o +# pldmfw library +obj-$(CONFIG_PLDMFW) += pldmfw/ + # KUnit tests obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
lib/pldmfw/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_PLDMFW) += pldmfw.o
lib/pldmfw/pldmfw.c new file +879 -0
879 lines not on this page · raw message
lib/pldmfw/pldmfw_private.h new file +238 -0
238 lines not on this page · raw message
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH v2 5/6 ice: implement device flash update via devlink
In reply to Jacob KellerUse the newly added pldmfw library to implement device flash update for the Intel ice networking device driver. This support uses the devlink flash update interface.
The main parts of the flash include the Option ROM, the netlist module, and the main NVM data. The PLDM firmware file contains modules for each of these components.
Using the pldmfw library, the provided firmware file will be scanned for the three major components, "fw.undi" for the Option ROM, "fw.mgmt" for the main NVM module containing the primary device firmware, and "fw.netlist" containing the netlist module.
The flash is separated into two banks, the active bank containing the running firmware, and the inactive bank which we use for update. Each module is updated in a staged process. First, the inactive bank is erased, preparing the device for update. Second, the contents of the component are copied to the inactive portion of the flash. After all components are updated, the driver signals the device to switch the active bank during the next EMP reset (which would usually occur during the next reboot).
Although the firmware AdminQ interface does report an immediate status for each command, the NVM erase and NVM write commands receive status asynchronously. The driver must not continue writing until previous erase and write commands have finished. The real status of the NVM commands is returned over the receive AdminQ. Implement a simple interface that uses a wait queue so that the main update thread can sleep until the completion status is reported by firmware. For erasing the inactive banks, this can take quite a while in practice.
To help visualize the process to the devlink application and other applications based on the devlink netlink interface, status is reported via the devlink_flash_update_status_notify. While we do report status after each 4k block when writing, there is no real status we can report during erasing. We simply must wait for the complete module erasure to finish.
With this implementation, basic flash update for the ice hardware is supported.
--- drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 9 + drivers/net/ethernet/intel/ice/ice_common.c | 2 +- drivers/net/ethernet/intel/ice/ice_common.h | 2 + drivers/net/ethernet/intel/ice/ice_devlink.c | 54 ++ .../net/ethernet/intel/ice/ice_fw_update.c | 780 ++++++++++++++++++ .../net/ethernet/intel/ice/ice_fw_update.h | 12 + drivers/net/ethernet/intel/ice/ice_main.c | 154 ++++ 9 files changed, 1014 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.c create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.h
drivers/net/ethernet/intel/Kconfig +1 -0
@@ -295,6 +295,7 @@ config ICE default n depends on PCI_MSI select NET_DEVLINK + select PLDMFW help This driver supports Intel(R) Ethernet Connection E800 Series of devices. For more information on how to identify your adapter, go
drivers/net/ethernet/intel/ice/Makefile +1 -0
@@ -23,6 +23,7 @@ ice-y := ice_main.o \ ice_flex_pipe.o \ ice_flow.o \ ice_devlink.o \ + ice_fw_update.o \ ice_ethtool.o ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o ice_dcf.o ice_virtchnl_fdir.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
drivers/net/ethernet/intel/ice/ice.h +9 -0
@@ -19,6 +19,7 @@#include <linux/dma-mapping.h> #include <linux/pci.h> #include <linux/workqueue.h> +#include <linux/wait.h> #include <linux/aer.h> #include <linux/interrupt.h> #include <linux/ethtool.h>
@@ -415,6 +416,12 @@ struct ice_pf {struct mutex sw_mutex;/* lock for protecting VSI alloc flow */ struct mutex tc_mutex;/* lock to protect TC changes */ u32 msg_enable; + +/* spinlock to protect the AdminQ wait list */ +spinlock_t aq_wait_lock; +struct hlist_head aq_wait_list; +wait_queue_head_t aq_wait_queue; +u32 hw_csum_rx_error;u16 oicr_idx;/* Other interrupt cause MSIX vector index */ u16 num_avail_sw_msix;/* remaining MSIX SW vectors left unclaimed */
@@ -598,6 +605,8 @@ void ice_fdir_release_flows(struct ice_hw *hw);void ice_fdir_replay_flows (struct ice_hw *hw);void ice_fdir_replay_fltrs (struct ice_pf *pf);int ice_fdir_create_dflt_rules (struct ice_pf *pf); +int ice_aq_wait_for_event (struct ice_pf *pf,u16 opcode,unsigned long timeout, +struct ice_rq_event_info *event);int ice_open (struct net_device *netdev);int ice_stop (struct net_device *netdev);void ice_service_task_schedule (struct ice_pf *pf);
drivers/net/ethernet/intel/ice/ice_common.c +1 -1
@@ -2221,7 +2221,7 @@ ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,* Read the device capabilities and extract them into the dev_caps structure * for later use. */ -static enum ice_status +enum ice_status ice_discover_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_caps) {enum ice_status status;
drivers/net/ethernet/intel/ice/ice_common.h +2 -0
@@ -88,6 +88,8 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,enum ice_status ice_aq_list_caps (struct ice_hw *hw,void *buf,u16 buf_size,u32 *cap_count,enum ice_adminq_opc opc,struct ice_sq_cd *cd); +enum ice_status +ice_discover_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_caps);void ice_update_phy_type (u64 *phy_type_low,u64 *phy_type_high,u16 link_speeds_bitmap);
drivers/net/ethernet/intel/ice/ice_devlink.c +54 -0
68 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fw_update.c new file +780 -0
780 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fw_update.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2018-2019, Intel Corporation. */ + +#ifndef _ICE_FW_UPDATE_H_ +#define _ICE_FW_UPDATE_H_ + +int ice_flash_pldm_image (struct ice_pf *pf,const struct firmware *fw, +struct netlink_ext_ack *extack); +int ice_check_for_pending_update (struct ice_pf *pf,const char *component, +struct netlink_ext_ack *extack); + +#endif
drivers/net/ethernet/intel/ice/ice_main.c +154 -0
178 lines not on this page · raw message
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
kernel test robot
build botRe: [RFC PATCH net-next v2 5/6] ice: implement device flash update via devlink
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Jacob,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on jkirsher-next-queue/dev-queue]
[cannot apply to net-next/master ipvs/master linus/master v5.8-rc6 next-20200717] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jacob-Keller/introduce-PLDM-firmware-update-library/20200718-031225 base: https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue config: arm-randconfig-c022-20200717 (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from lib/pldmfw/pldmfw.c:15:
>> lib/pldmfw/pldmfw_private.h:60:1: warning: alignment 1 of 'struct __pldm_header' is less than 4 [-Wpacked-not-aligned]
60 | } __packed __aligned(1);
| ^
>> lib/pldmfw/pldmfw_private.h:45:26: warning: 'release_date' offset 19 in 'struct __pldm_header' isn't aligned to 4 [-Wpacked-not-aligned] 45 | struct __pldm_timestamp release_date; /* PackageReleaseDateTime */
| ^~~~~~~~~~~~
vim +60 lib/pldmfw/pldmfw_private.h
6b3d6687bf587b Jacob Keller 2020-07-17 39
6b3d6687bf587b Jacob Keller 2020-07-17 40 /* Package Header Information */
6b3d6687bf587b Jacob Keller 2020-07-17 41 struct __pldm_header {
6b3d6687bf587b Jacob Keller 2020-07-17 42 uuid_t id; /* PackageHeaderIdentifier */
6b3d6687bf587b Jacob Keller 2020-07-17 43 u8 revision; /* PackageHeaderFormatRevision */
6b3d6687bf587b Jacob Keller 2020-07-17 44 __le16 size; /* PackageHeaderSize */
6b3d6687bf587b Jacob Keller 2020-07-17 @45 struct __pldm_timestamp release_date; /* PackageReleaseDateTime */
6b3d6687bf587b Jacob Keller 2020-07-17 46 __le16 component_bitmap_len; /* ComponentBitmapBitLength */
6b3d6687bf587b Jacob Keller 2020-07-17 47 u8 version_type; /* PackageVersionStringType */
6b3d6687bf587b Jacob Keller 2020-07-17 48 u8 version_len; /* PackageVersionStringLength */
6b3d6687bf587b Jacob Keller 2020-07-17 49
6b3d6687bf587b Jacob Keller 2020-07-17 50 /*
6b3d6687bf587b Jacob Keller 2020-07-17 51 * DSP0267 also includes the following variable length fields at the
6b3d6687bf587b Jacob Keller 2020-07-17 52 * end of this structure:
6b3d6687bf587b Jacob Keller 2020-07-17 53 *
6b3d6687bf587b Jacob Keller 2020-07-17 54 * PackageVersionString, length is version_len.
6b3d6687bf587b Jacob Keller 2020-07-17 55 *
6b3d6687bf587b Jacob Keller 2020-07-17 56 * The total size of this section is
6b3d6687bf587b Jacob Keller 2020-07-17 57 * sizeof(pldm_header) + version_len;
6b3d6687bf587b Jacob Keller 2020-07-17 58 */
6b3d6687bf587b Jacob Keller 2020-07-17 59 u8 version_string[]; /* PackageVersionString */6b3d6687bf587b Jacob Keller 2020-07-17 @60 } __packed __aligned(1); 6b3d6687bf587b Jacob Keller 2020-07-17 61
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 5/6] ice: implement device flash update via devlink
In reply to Jacob Kellerdrivers/net/ethernet/intel/ice/ice_devlink.c static int ice_devlink_info_get(struct devlink *devlink, · line 284
Quoted 11 lines · Jacob Keller
drivers/net/ethernet/intel/ice/ice_devlink.c +11
-0+devlink_flash_update_begin_notify (devlink); +devlink_flash_update_status_notify (devlink,"Preparing to flash" , + component,0 ,0 ); + err =ice_flash_pldm_image (pf, fw, extack); +devlink_flash_update_end_notify (devlink); + +release_firmware (fw); + +return err; +} +
Hi Jakub, Jiri,
I noticed something interesting recently in regards to the devlink_flash_update_end_notify.
The way that iproute2/devlink works is that if DEVLINK_CMD_FLASH_UPDATE_END is sent, then it will stop waiting for the error response from DEVLINK_CMD_FLASH_UPDATE.
This means that if a driver sends DEVLINK_CMD_FLASH_UPDATE_END on a failed update, the devlink program doesn't report the error or the netlink status message.
Is it expected to send DEVLINK_CMD_FLASH_UPDATE_END on failures? All current drivers appear to do so.
Perhaps its a bug in the devlink application on not waiting for the flash command to properly complete?
Would it make sense to extend DEVLINK_FLASH_UPDATE_END to include an attribute which specified the error code? But then would that include the netlink extended status message?
It's not a huge deal but it seemed weird that if we detect any errors during the main flash update process we will not properly report them.
I wasn't quite sure where the bug actually lies, so help here is appreciated on figuring out what the best fix is.
Regards,
Jake
Jacob Keller
maintainerRFC PATCH v2 6/6 devlink: add overwrite mode to flash update
In reply to Jacob KellerA flash image may contain settings or device identifying information. When performing a flash update, these settings and information may conflict with contents already in the flash. Devices may handle this conflict in multiple ways.
Add a new attribute to the devlink command, DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MODE, which specifies how the device should handle these settings and fields.
DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING, the default, requests that all settings and device identifiers within the current flash are kept. That is, no settings or fields will be overwritten. This is the expected behavior for most updates, and appears to be how all of the drivers are implemented today.
DEVLINK_FLASH_UPDATE_OVERWRITE_SETTINGS, requests that the device overwrite any device settings in the flash section with the settings from the flash image, but to preserve identifiers such as the MAC address and serial identifier. This may be useful as a way to restore a device to known-good settings from a new flash image.
DEVLINK_FLASH_UPDATE_OVERWRITE_EVERYTHING, requests that all content in the flash image be preserved over content of flash on the device. This mode requests the device to completely overwrite the flash section, possibly changing settings and device identifiers. The primary motivation is to support writing initial device identifiers during manufacturing. It is not expected to be necessary in normal end-user flash updates.
For the ice driver, implement support for the overwrite mode by selecting the associated preservation level to request from firmware.
For all other drivers that support flash update, require that the mode be DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING, which is the expected default.
Update the documentation to explain the overwrite mode attribute.
--- .../networking/devlink/devlink-flash.rst | 31 +++++++++++++++++++ Documentation/networking/devlink/ice.rst | 27 ++++++++++++++++ .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 ++++- .../net/ethernet/huawei/hinic/hinic_devlink.c | 3 ++ drivers/net/ethernet/intel/ice/ice_devlink.c | 6 ++-- .../net/ethernet/intel/ice/ice_fw_update.c | 24 +++++++++++++- .../net/ethernet/intel/ice/ice_fw_update.h | 1 + .../net/ethernet/mellanox/mlx5/core/devlink.c | 4 +++ drivers/net/ethernet/mellanox/mlxsw/core.c | 3 +- drivers/net/ethernet/mellanox/mlxsw/core.h | 1 + .../net/ethernet/mellanox/mlxsw/spectrum.c | 4 +++ .../net/ethernet/netronome/nfp/nfp_devlink.c | 6 +++- drivers/net/netdevsim/dev.c | 1 + include/net/devlink.h | 1 + include/uapi/linux/devlink.h | 16 ++++++++++ net/core/devlink.c | 16 ++++++++-- 16 files changed, 142 insertions(+), 9 deletions(-)
Documentation/networking/devlink/devlink-flash.rst +31 -0
@@ -16,6 +16,37 @@ Note that the file name is a path relative to the firmware loading path (usually ``/lib/firmware/``). Drivers may send status updates to inform user space about the progress of the update operation. +Overwrite Mode +============== + +The ``devlink-flash`` command allows optionally specifying an overwrite mode +indicating how the device should handle static settings and fields in the +device flash when updating. + +.. list-table:: List of overwrite modes + :widths: 5 95 + + * - Name + - Description + * - ``DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING`` + - Do not overwrite any settings or fields in the device flash; only + update the associated firmware binaries. This preserves settings + stored in the flash, as well as device identifiers. This is the + default if no overwrite mode is specified. + * - ``DEVLINK_FLASH_UPDATE_OVERWRITE_SETTINGS`` + - Overwrite device settings stored in the flash with settings from the + provided image, but do not overwrite device identifiers such as MAC + addresses or serial identifiers. This may be useful to restore a + device to default settings from a new image. + * - ``DEVLINK_FLASH_UPDATE_OVERWRITE_EVERYTHING`` + - Overwrite everything in the device flash including settings and + device identifiers with the contents from the provided flash image. + Unless the provided image has been customized for this device, it + will result in clearing the identifying information in the device + flash. This mode is primarily intended for device manufacturers + performing initial device programming, and is not expected to be + necessary when performing regular flash updates. + Firmware Loading ================
Documentation/networking/devlink/ice.rst +27 -0
@@ -81,6 +81,33 @@ The ``ice`` driver reports the following versions - 0xee16ced7 - The first 4 bytes of the hash of the netlist module contents. +Flash Update +============ + +The ``ice`` driver implements support for flash update using the +``devlink-flash`` interface. It supports updating the device flash using a +combined flash image that contains the ``fw.mgmt``, ``fw.undi``, and +``fw.netlist`` components. + +.. list-table:: List of supported overwrite modes + :widths: 5 95 + + * - Name + - Behavior + * - ``DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING`` + - Do not overwrite any settings or device identifying information. + * - ``DEVLINK_FLASH_UPDATE_OVERWRITE_SETTINGS`` + - Overwrite device settings, but not identifying information. This + includes overwriting the port configuration that determines the + number of physical functions the device will initialize with. + * - ``DEVLINK_FLASH_UPDATE_OVERWRITE_EVERYTHING`` + - Overwrite everything in the flash with the contents from the provided + flash image. This includes overwriting all settings as well as device + identifying information such as the MAC address and device serial + number. It is expected that this be used with an image customized for + the specific device, and is not necessary or expected in most + circumstances. + Regions =======
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +6 -1
@@ -18,7 +18,9 @@static int bnxt_dl_flash_update (struct devlink *dl,const char *filename, -const char *region,struct netlink_ext_ack *extack) +const char *region, +enum devlink_flash_update_overwrite_mode mode, +struct netlink_ext_ack *extack) {struct bnxt *bp =bnxt_get_bp_from_dl (dl);int rc;
@@ -26,6 +28,9 @@ bnxt_dl_flash_update(struct devlink *dl, const char *filename,if (region)return -EOPNOTSUPP ; +if (mode !=DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING ) +return -EOPNOTSUPP ; +if (!BNXT_PF (bp)) {NL_SET_ERR_MSG_MOD (extack,"flash update not supported from a VF" );
drivers/net/ethernet/huawei/hinic/hinic_devlink.c +3 -0
@@ -283,6 +283,7 @@ static int hinic_firmware_update(struct hinic_devlink_priv *priv,static int hinic_devlink_flash_update (struct devlink *devlink,const char *file_name,const char *component, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack) {struct hinic_devlink_priv *priv =devlink_priv (devlink);
@@ -291,6 +292,8 @@ static int hinic_devlink_flash_update(struct devlink *devlink,if (component)return -EOPNOTSUPP ; +if (mode !=DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING ) +return -EOPNOTSUPP ; err =request_firmware_direct (&fw, file_name, &priv->hwdev->hwif->pdev->dev);
drivers/net/ethernet/intel/ice/ice_devlink.c +4 -2
@@ -244,7 +244,9 @@ static int ice_devlink_info_get(struct devlink *devlink,*/ static int ice_devlink_flash_update (struct devlink *devlink,const char *path, -const char *component,struct netlink_ext_ack *extack) +const char *component, +enum devlink_flash_update_overwrite_mode mode, +struct netlink_ext_ack *extack) {struct ice_pf *pf =devlink_priv (devlink);struct device *dev = &pf->pdev->dev;
@@ -274,7 +276,7 @@ ice_devlink_flash_update(struct devlink *devlink, const char *path,devlink_flash_update_begin_notify (devlink);devlink_flash_update_status_notify (devlink,"Preparing to flash" , component,0 ,0 ); - err =ice_flash_pldm_image (pf, fw, extack); + err =ice_flash_pldm_image (pf, fw, mode, extack);devlink_flash_update_end_notify (devlink);release_firmware (fw);
drivers/net/ethernet/intel/ice/ice_fw_update.c +23 -1
@@ -630,6 +630,7 @@ static const struct pldmfw_ops ice_fwu_ops = {* ice_flash_pldm_image - Write a PLDM-formatted firmware image to the device * @pf: private device driver structure * @fw: firmware object pointing to the relevant firmware file +* @mode: flash overwrite mode * @extack: netlink extended ACK structure * * Parse the data for a given firmware file, verifying that it is a valid PLDM
@@ -643,6 +644,7 @@ static const struct pldmfw_ops ice_fwu_ops = {* Returns: zero on success or a negative error code on failure. */ int ice_flash_pldm_image (struct ice_pf *pf,const struct firmware *fw, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack) {struct device *dev =ice_pf_to_dev (pf);
@@ -657,7 +659,27 @@ int ice_flash_pldm_image(struct ice_pf *pf, const struct firmware *fw, priv.context.dev = dev; priv.extack = extack; priv.pf = pf; - priv.activate_flags =ICE_AQC_NVM_PRESERVE_ALL ; + +/* Based on the requested overwrite mode, determine what preservation +* level to specify when activating the NVM banks at the end of the +* update. +*/ +switch (mode) { +case DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING : +/* Preserve all settings and fields in the existing flash */ + priv.activate_flags =ICE_AQC_NVM_PRESERVE_ALL ; +break ; +case DEVLINK_FLASH_UPDATE_OVERWRITE_SETTINGS : +/* Overwrite settings, but preserve limited fields */ + priv.activate_flags =ICE_AQC_NVM_PRESERVE_SELECTED ; +break ; +case DEVLINK_FLASH_UPDATE_OVERWRITE_EVERYTHING : +/* Overwrite everything in the flash */ + priv.activate_flags =ICE_AQC_NVM_NO_PRESERVATION ; +break ; +default : +return -EOPNOTSUPP ; + } status =ice_acquire_nvm (hw,ICE_RES_WRITE );if (status) {
drivers/net/ethernet/intel/ice/ice_fw_update.h +1 -0
@@ -5,6 +5,7 @@#define _ICE_FW_UPDATE_H_int ice_flash_pldm_image (struct ice_pf *pf,const struct firmware *fw, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack);int ice_check_for_pending_update (struct ice_pf *pf,const char *component,struct netlink_ext_ack *extack);
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +4 -0
@@ -10,6 +10,7 @@static int mlx5_devlink_flash_update (struct devlink *devlink,const char *file_name,const char *component, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack) {struct mlx5_core_dev *dev =devlink_priv (devlink);
@@ -19,6 +20,9 @@ static int mlx5_devlink_flash_update(struct devlink *devlink,if (component)return -EOPNOTSUPP ; +if (mode !=DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING ) +return -EOPNOTSUPP ; + err =request_firmware_direct (&fw, file_name, &dev->pdev->dev);if (err)return err;
drivers/net/ethernet/mellanox/mlxsw/core.c +2 -1
@@ -1139,6 +1139,7 @@ mlxsw_devlink_core_bus_device_reload_up(struct devlink *devlink,static int mlxsw_devlink_flash_update (struct devlink *devlink,const char *file_name,const char *component, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack) {struct mlxsw_core *mlxsw_core =devlink_priv (devlink);
@@ -1147,7 +1148,7 @@ static int mlxsw_devlink_flash_update(struct devlink *devlink,if (!mlxsw_driver->flash_update)return -EOPNOTSUPP ;return mlxsw_driver->flash_update (mlxsw_core, file_name, - component, extack); + component, mode, extack); } static int mlxsw_devlink_trap_init(struct devlink *devlink,
drivers/net/ethernet/mellanox/mlxsw/core.h +1 -0
@@ -319,6 +319,7 @@ struct mlxsw_driver { u32 *p_cur, u32 *p_max);int (*flash_update)(struct mlxsw_core *mlxsw_core,const char *file_name,const char *component, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack);int (*trap_init)(struct mlxsw_core *mlxsw_core,const struct devlink_trap *trap,void *trap_ctx);
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +4 -0
@@ -419,6 +419,7 @@ static int mlxsw_sp_fw_rev_validate(struct mlxsw_sp *mlxsw_sp)static int mlxsw_sp_flash_update (struct mlxsw_core *mlxsw_core,const char *file_name,const char *component, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack) {struct mlxsw_sp *mlxsw_sp =mlxsw_core_driver_priv (mlxsw_core);
@@ -428,6 +429,9 @@ static int mlxsw_sp_flash_update(struct mlxsw_core *mlxsw_core,if (component)return -EOPNOTSUPP ; +if (mode !=DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING ) +return -EOPNOTSUPP ; + err =request_firmware_direct (&firmware, file_name, mlxsw_sp->bus_info->dev);if (err)
drivers/net/ethernet/netronome/nfp/nfp_devlink.c +5 -1
@@ -330,10 +330,14 @@ nfp_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,static int nfp_devlink_flash_update (struct devlink *devlink,const char *path, -const char *component,struct netlink_ext_ack *extack) +const char *component, +enum devlink_flash_update_overwrite_mode mode, +struct netlink_ext_ack *extack) {if (component)return -EOPNOTSUPP ; +if (mode !=DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING ) +return -EOPNOTSUPP ;return nfp_flash_update_common (devlink_priv (devlink), path, extack); }
drivers/net/netdevsim/dev.c +1 -0
@@ -742,6 +742,7 @@ static int nsim_dev_info_get(struct devlink *devlink,static int nsim_dev_flash_update (struct devlink *devlink,const char *file_name,const char *component, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack) {struct nsim_dev *nsim_dev =devlink_priv (devlink);
include/net/devlink.h +1 -0
@@ -1045,6 +1045,7 @@ struct devlink_ops { struct netlink_ext_ack *extack);int (*flash_update)(struct devlink *devlink,const char *file_name,const char *component, +enum devlink_flash_update_overwrite_mode mode,struct netlink_ext_ack *extack);/** * @trap_init: Trap initialization function.
include/uapi/linux/devlink.h +16 -0
@@ -228,6 +228,20 @@ enum { DEVLINK_ATTR_STATS_MAX = __DEVLINK_ATTR_STATS_MAX - 1 }; +/* All flash update overwrite modes must be documented in +* Documentation/networking/devlink/devlink-flash.rst +*/ +enum devlink_flash_update_overwrite_mode { +DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING , +DEVLINK_FLASH_UPDATE_OVERWRITE_SETTINGS , +DEVLINK_FLASH_UPDATE_OVERWRITE_EVERYTHING , + +/* Add new flash overwrite modes above */ + __DEVLINK_FLASH_UPDATE_OVERWRITE_MODE_MAX, +DEVLINK_FLASH_UPDATE_OVERWRITE_MODE_MAX = + __DEVLINK_FLASH_UPDATE_OVERWRITE_MODE_MAX -1 , +}; +/** * enum devlink_trap_action - Packet trap action. * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not
@@ -458,6 +472,8 @@ enum devlink_attr {DEVLINK_ATTR_PORT_LANES ,/* u32 */ DEVLINK_ATTR_PORT_SPLITTABLE ,/* u8 */ +DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MODE ,/* u8 */ +/* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX,
net/core/devlink.c +13 -3
@@ -3097,9 +3097,10 @@ EXPORT_SYMBOL_GPL(devlink_flash_update_status_notify);static int devlink_nl_cmd_flash_update (struct sk_buff *skb,struct genl_info *info) { +enum devlink_flash_update_overwrite_mode mode;struct devlink *devlink = info->user_ptr[0 ]; +struct nlattr *nla_component, *nla_mode;const char *file_name, *component; -struct nlattr *nla_component;if (!devlink->ops->flash_update)return -EOPNOTSUPP ;
@@ -3111,7 +3112,13 @@ static int devlink_nl_cmd_flash_update(struct sk_buff *skb, nla_component = info->attrs[DEVLINK_ATTR_FLASH_UPDATE_COMPONENT ]; component = nla_component ?nla_data (nla_component) :NULL ; -return devlink->ops->flash_update (devlink, file_name, component, + nla_mode = info->attrs[DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MODE ]; + mode = nla_mode ?nla_get_u8 (nla_mode) :DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING ; + +if (mode >DEVLINK_FLASH_UPDATE_OVERWRITE_MODE_MAX ) +return -EINVAL ; + +return devlink->ops->flash_update (devlink, file_name, component, mode, info->extack); }
@@ -6999,6 +7006,7 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = { [DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER] = { .type = NLA_U8 }, [DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME] = { .type = NLA_NUL_STRING }, [DEVLINK_ATTR_FLASH_UPDATE_COMPONENT] = { .type = NLA_NUL_STRING }, + [DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MODE] = { .type = NLA_U8 }, [DEVLINK_ATTR_TRAP_NAME] = { .type = NLA_NUL_STRING }, [DEVLINK_ATTR_TRAP_ACTION] = { .type = NLA_U8 }, [DEVLINK_ATTR_TRAP_GROUP_NAME] = { .type = NLA_NUL_STRING },
@@ -9564,7 +9572,9 @@ int devlink_compat_flash_update(struct net_device *dev, const char *file_name) }mutex_lock (&devlink->lock); - ret = devlink->ops->flash_update (devlink, file_name,NULL ,NULL ); + ret = devlink->ops->flash_update (devlink, file_name,NULL , +DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING , +NULL );mutex_unlock (&devlink->lock); out:
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jiri Pirko
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 29 lines · Fri, Jul 17, 2020 at 08:35:41PM CEST, [email protected] wrote:
A flash image may contain settings or device identifying information. When performing a flash update, these settings and information may conflict with contents already in the flash. Devices may handle this conflict in multiple ways.
Add a new attribute to the devlink command,
DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MODE, which specifies how the device should handle these settings and fields.
DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING, the default, requests that all settings and device identifiers within the current flash are kept. That is, no settings or fields will be overwritten. This is the expected behavior for most updates, and appears to be how all of the drivers are implemented today.
DEVLINK_FLASH_UPDATE_OVERWRITE_SETTINGS, requests that the device overwrite any device settings in the flash section with the settings from the flash image, but to preserve identifiers such as the MAC address and serial identifier. This may be useful as a way to restore a device to known-good settings from a new flash image.
DEVLINK_FLASH_UPDATE_OVERWRITE_EVERYTHING, requests that all content in the flash image be preserved over content of flash on the device. This mode requests the device to completely overwrite the flash section, possibly changing settings and device identifiers. The primary motivation is to support writing initial device identifiers during manufacturing. It is not expected to be necessary in normal end-user flash updates.
Quoted 8 lines
For the ice driver, implement support for the overwrite mode by selecting the associated preservation level to request from firmware.
For all other drivers that support flash update, require that the mode be
DEVLINK_FLASH_UPDATE_OVERWRITE_NOTHING, which is the expected default.Update the documentation to explain the overwrite mode attribute.
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"
Then it is up to the user what he decides to flash.
Re: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 8 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"Then it is up to the user what he decides to flash.
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
In case of MLX is PSID considered config?
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 8 lines · Jakub Kicinski
Quoted 7 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"
First off, unfortunately at least for ice, the "main" section of NVM contains both the management firmware as well as config settings. I don't really have a way to split it up.
This series includes support for updating the main NVM section containing the management firmware (and some config) "fw.mgmt", as well as "fw.undi" which contains the OptionROM, and "fw.netlist" which contains additional configuration TLVs.
The firmware interface allows me to separate the three components, but does not let me separate the "fw binary" from the "config settings" that are stored within the main NVM bank. (These fields include other data like the device MAC address and VPD area of the device too, so using "config" is a bit of a misnomer).
Quoted 9 lines
Quoted 1 line
Then it is up to the user what he decides to flash.
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
I also agree here, I'd like to be able to make the "update with the complete file" just work in the most straight forward way (i.e. without erasing stuff by accident) be the default.
The option I'm proposing here is to enable allowing tools to optionally specify handling this type of overwrite. The goal is to support these use cases:
a) (default) just update the image, but keep the config and vital data the same as before the update.
b) overwrite config fields, but keep vital fields the same. Intended to allow returning configuration to "image defaults". This mostly is intended in case regular update caused some issues like if somehow the config preservation didn't work properly.
c) overwrite all fields. The intention here is to allow programming a customized image during initial setup that would contain new IDs etc. It is not expected to be used in general, as this does overwrite vital data like the MAC addresses and such.
So the problem is that the vital data, config data, and firmware binaries are stored in the same section, without a good way to separate between them. We program all of these together as one chunk to the "secondary NVM bank" and then ask firmware to update. It reads through and based on our "preservation" setting will update the binaries and merge the configuration sections.
Quoted 2 lines
In case of MLX is PSID considered config?
Jiri Pirko
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 12 lines · Mon, Jul 20, 2020 at 08:52:58PM CEST, [email protected] wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 7 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"
Quoted 3 lines
First off, unfortunately at least for ice, the "main" section of NVM contains both the management firmware as well as config settings. I don't really have a way to split it up.
You don't have to split it up. Just for component "x" you push binary "A" and flash part of it and for comonent "y" you push the same binary "A" and flash different part of it.
Consider the component as a "mask" in your case.
Quoted 52 lines
This series includes support for updating the main NVM section containing the management firmware (and some config) "fw.mgmt", as well as "fw.undi" which contains the OptionROM, and "fw.netlist" which contains additional configuration TLVs.
The firmware interface allows me to separate the three components, but does not let me separate the "fw binary" from the "config settings" that are stored within the main NVM bank. (These fields include other data like the device MAC address and VPD area of the device too, so using "config" is a bit of a misnomer).
Quoted 9 lines
Quoted 1 line
Then it is up to the user what he decides to flash.
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
I also agree here, I'd like to be able to make the "update with the complete file" just work in the most straight forward way (i.e. without erasing stuff by accident) be the default.
The option I'm proposing here is to enable allowing tools to optionally specify handling this type of overwrite. The goal is to support these use cases:
a) (default) just update the image, but keep the config and vital data the same as before the update.
b) overwrite config fields, but keep vital fields the same. Intended to allow returning configuration to "image defaults". This mostly is intended in case regular update caused some issues like if somehow the config preservation didn't work properly.
c) overwrite all fields. The intention here is to allow programming a customized image during initial setup that would contain new IDs etc. It is not expected to be used in general, as this does overwrite vital data like the MAC addresses and such.
So the problem is that the vital data, config data, and firmware binaries are stored in the same section, without a good way to separate between them. We program all of these together as one chunk to the "secondary NVM bank" and then ask firmware to update. It reads through and based on our "preservation" setting will update the binaries and merge the configuration sections.
Quoted 2 lines
In case of MLX is PSID considered config?
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 17 lines · Jiri Pirko
Quoted 12 lines · Mon, Jul 20, 2020 at 08:52:58PM CEST, [email protected] wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 7 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"Quoted 3 lines
First off, unfortunately at least for ice, the "main" section of NVM contains both the management firmware as well as config settings. I don't really have a way to split it up.
Quoted 7 lines
You don't have to split it up. Just for component "x" you push binary "A" and flash part of it and for comonent "y" you push the same binary "A" and flash different part of it.
Consider the component as a "mask" in your case.
The driver itself doesn't really know what parts of the image are which. I have to ask the firmware. And it doesn't have a "settings only" flag. I have roughly equivalent to "binary only", "binary + settings" and "binary + settings + vital fields"
Plus, this means that every update must be single-component and there's no way to distinguish this when an update is supposed to be for all of the components in the PLDM file.
Jiri Pirko
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
In reply to Jakub KicinskiQuoted 8 lines · Mon, Jul 20, 2020 at 05:51:59PM CEST, [email protected] wrote:
Quoted 7 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"
Quoted 4 lines
Quoted 1 line
Then it is up to the user what he decides to flash.
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component
Well you can have multiple component what would overlap:
1) "program" + "config" (default)
2) "program"
3) "config"
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
I see it as an extra knob that is actually somehow provides degradation of components.
Quoted 2 lines
In case of MLX is PSID considered config?
Nope.
Re: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 11 lines · On Tue, 21 Jul 2020 15:53:56 +0200 Jiri Pirko wrote:
Quoted 10 lines · Mon, Jul 20, 2020 at 05:51:59PM CEST, [email protected] wrote:
Quoted 8 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"Then it is up to the user what he decides to flash.
Quoted 7 lines
Quoted 2 lines
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component
Well you can have multiple component what would overlap:
1) "program" + "config" (default)
2) "program"
3) "config"
Say I have FW component and UNDI driver. Now I'll have 4 components? fw.prog, fw.config, undi.prog etc? Are those extra ones visible or just "implied"? If they are visible what version does the config have?
Also (3) - flashing config from one firmware version and program from another - makes a very limited amount of sense to me.
Quoted 7 lines
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
I see it as an extra knob that is actually somehow provides degradation of components.
Hm. We have the exact opposite view on the matter. To me components currently correspond to separate fw/hw entities, that's a very clear meaning. PHY firmware, management FW, UNDI. Now we would add a completely orthogonal meaning to the same API.
Why?
In the name of "field reuse"?
Quoted 3 lines
Quoted 1 line
In case of MLX is PSID considered config?
Nope.
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 20 lines · Jakub Kicinski
Quoted 11 lines · On Tue, 21 Jul 2020 15:53:56 +0200 Jiri Pirko wrote:
Quoted 10 lines · Mon, Jul 20, 2020 at 05:51:59PM CEST, [email protected] wrote:
Quoted 8 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"Then it is up to the user what he decides to flash.
Quoted 7 lines
Quoted 2 lines
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component
Well you can have multiple component what would overlap:
1) "program" + "config" (default)
2) "program"
3) "config"
Quoted 7 lines
Say I have FW component and UNDI driver. Now I'll have 4 components? fw.prog, fw.config, undi.prog etc? Are those extra ones visible or just "implied"? If they are visible what version does the config have?
Also (3) - flashing config from one firmware version and program from another - makes a very limited amount of sense to me.
Right, this is actually one of the potential problems I've been told
about: if the config doesn't match the firmware it's supposed to work, but the "overwrite config" option is partially there to help have a way out in case the config and firmware aren't in sync and something goes wrong.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
I see it as an extra knob that is actually somehow provides degradation of components.
Quoted 9 lines
Hm. We have the exact opposite view on the matter. To me components currently correspond to separate fw/hw entities, that's a very clear meaning. PHY firmware, management FW, UNDI. Now we would add a completely orthogonal meaning to the same API.
Why?
In the name of "field reuse"?
Right. I understand that other hardware works differently and has all config separated to separate distinct components, but I think it would be needlessly confusing to have separate component names. Plus, as I said in another thread: I can't really separate the two components when I update. I have to send the combined block to firmware with the flag indicating how it should do preservation/merging. So I can't really do "just settings" anyways, meaning that it really would be two components which overlap. Plus, I wouldn't really have a separate "info" display.
Ultimately it ends up feeling like a significant hack of the component name if I go that route.
Jiri Pirko
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
In reply to Jakub KicinskiQuoted 15 lines · Tue, Jul 21, 2020 at 07:04:06PM CEST, [email protected] wrote:
Quoted 14 lines · On Tue, 21 Jul 2020 15:53:56 +0200 Jiri Pirko wrote:
Quoted 12 lines · Mon, Jul 20, 2020 at 05:51:59PM CEST, [email protected] wrote:
Quoted 8 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"Then it is up to the user what he decides to flash.
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component
Quoted 7 lines
Quoted 4 lines
Well you can have multiple component what would overlap:
1) "program" + "config" (default)
2) "program"
3) "config"Say I have FW component and UNDI driver. Now I'll have 4 components? fw.prog, fw.config, undi.prog etc? Are those extra ones visible or just
Visible in which sense? We don't show components anywhere if I'm not mistaken. They are currently very rarely used. Basically we just ported it from ethtool without much thinking.
Quoted 1 line
"implied"? If they are visible what version does the config have?
Good question. we don't have per-component version so far. I think it would be good to have it alonside with the listing.
Quoted 9 lines
Also (3) - flashing config from one firmware version and program from another - makes a very limited amount of sense to me.
Quoted 5 lines
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
Quoted 7 lines
Quoted 2 lines
I see it as an extra knob that is actually somehow provides degradation of components.
Hm. We have the exact opposite view on the matter. To me components currently correspond to separate fw/hw entities, that's a very clear meaning. PHY firmware, management FW, UNDI. Now we would add a completely orthogonal meaning to the same API.
I understand. My concern is, we would have a component with some "subparts". Now it is some fuzzy vagely defined "config part", in the future it might be something else. That is what I'm concerned about. Components have clear api.
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
Quoted 9 lines
Why?
In the name of "field reuse"?
Quoted 3 lines
Quoted 1 line
In case of MLX is PSID considered config?
Nope.
Keller, Jacob E
maintainerRE: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 38 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jiri Pirko
Sent: Wednesday, July 22, 2020 3:52 AM
To: Jakub Kicinski <[email protected]>
Cc: Keller, Jacob E <[email protected]>; [email protected]; Tom Herbert <[email protected]>; Jiri Pirko <[email protected]>; Jakub Kicinski <[email protected]>; Jonathan Corbet <[email protected]>; Michael Chan <[email protected]>; Bin Luo <[email protected]>; Saeed Mahameed <[email protected]>; Leon Romanovsky <[email protected]>; Ido Schimmel <[email protected]>; Danielle Ratson <[email protected]>
Subject: Re: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash updateQuoted 20 lines · Tue, Jul 21, 2020 at 07:04:06PM CEST, [email protected] wrote:
Quoted 18 lines · On Tue, 21 Jul 2020 15:53:56 +0200 Jiri Pirko wrote:
Quoted 8 lines · Mon, Jul 20, 2020 at 05:51:59PM CEST, [email protected] wrote:
Quoted 7 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"Quoted 4 lines
Quoted 1 line
Then it is up to the user what he decides to flash.
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component
Well you can have multiple component what would overlap:
1) "program" + "config" (default)
2) "program"
3) "config"
Quoted 7 lines
Quoted 2 lines
Say I have FW component and UNDI driver. Now I'll have 4 components? fw.prog, fw.config, undi.prog etc? Are those extra ones visible or just
Visible in which sense? We don't show components anywhere if I'm not mistaken. They are currently very rarely used. Basically we just ported it from ethtool without much thinking.
Component names are used in devlink info and displayed to end users along with versions, plus they're names passed by the user in devlink flash update. As far as documented, we shouldn't add new components without associated versions in the info report.
Quoted 24 lines
Quoted 2 lines
"implied"? If they are visible what version does the config have?
Good question. we don't have per-component version so far. I think it would be good to have it alonside with the listing.
Quoted 9 lines
Also (3) - flashing config from one firmware version and program from another - makes a very limited amount of sense to me.
Quoted 5 lines
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
Quoted 7 lines
Quoted 2 lines
I see it as an extra knob that is actually somehow provides degradation of components.
Hm. We have the exact opposite view on the matter. To me components currently correspond to separate fw/hw entities, that's a very clear meaning. PHY firmware, management FW, UNDI. Now we would add a completely orthogonal meaning to the same API.
Quoted 10 lines
I understand. My concern is, we would have a component with some "subparts". Now it is some fuzzy vagely defined "config part", in the future it might be something else. That is what I'm concerned about. Components have clear api.
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
So, we could make this selection a series of masked bits instead of a single enumeration value.
Jakub Kicinski
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 18 lines · Jacob E
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
Quoted 7 lines
Quoted 2 lines
I see it as an extra knob that is actually somehow provides degradation of components.
Hm. We have the exact opposite view on the matter. To me components currently correspond to separate fw/hw entities, that's a very clear meaning. PHY firmware, management FW, UNDI. Now we would add a completely orthogonal meaning to the same API.
I understand. My concern is, we would have a component with some "subparts". Now it is some fuzzy vagely defined "config part", in the future it might be something else. That is what I'm concerned about. Components have clear api.
Quoted 6 lines
Quoted 3 lines
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
So, we could make this selection a series of masked bits instead of a single enumeration value.
I'd still argue that components (as defined in devlink info) and config are pretty orthogonal. In my experience config is stored in its own section of the flash, and some of the knobs are in no obvious way associated with components (used by components).
That said, if we rename the "component mask" to "update mask" that's fine with me.
Then we'd have
bit 0 - don't overwrite config
bit 1 - don't overwrite identifiers
?
Let's define a bit for "don't update program" when we actually need it.
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 16 lines · Jakub Kicinski
Quoted 6 lines · Jacob E
Quoted 3 lines
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
So, we could make this selection a series of masked bits instead of a single enumeration value.
I'd still argue that components (as defined in devlink info) and config are pretty orthogonal. In my experience config is stored in its own section of the flash, and some of the knobs are in no obvious way associated with components (used by components).
That said, if we rename the "component mask" to "update mask" that's fine with me.
Quoted 9 lines
Then we'd have
bit 0 - don't overwrite config
bit 1 - don't overwrite identifiers?
Let's define a bit for "don't update program" when we actually need it.
Ok. And this can be later extended with additional bits with new meanings should the need arise.
Additionally, drivers can ensure that the valid combination of bits is set. the drivers can reject requests for combinations that they do not support.
I can make that change.
My preference is that "0" for a bit means do not overwrite while "1" means overwrite. This way, if/when additional bits are added, drivers won't need to be updated to reject such requests. If we make "1" the "do not overwrite" then we'd have a case where drivers must update to ensure they reject requests which don't set the bit.
Thanks,
Jake
Jiri Pirko
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 30 lines · Wed, Jul 22, 2020 at 08:21:22PM CEST, [email protected] wrote:
Quoted 16 lines · Jakub Kicinski
Quoted 6 lines · Jacob E
Quoted 3 lines
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
So, we could make this selection a series of masked bits instead of a single enumeration value.
I'd still argue that components (as defined in devlink info) and config are pretty orthogonal. In my experience config is stored in its own section of the flash, and some of the knobs are in no obvious way associated with components (used by components).
That said, if we rename the "component mask" to "update mask" that's fine with me.
Quoted 9 lines
Then we'd have
bit 0 - don't overwrite config
bit 1 - don't overwrite identifiers?
Let's define a bit for "don't update program" when we actually need it.
Quoted 6 lines
Ok. And this can be later extended with additional bits with new meanings should the need arise.
Additionally, drivers can ensure that the valid combination of bits is set. the drivers can reject requests for combinations that they do not support.
Makes sense.
Quoted 8 lines
I can make that change.
My preference is that "0" for a bit means do not overwrite while "1" means overwrite. This way, if/when additional bits are added, drivers won't need to be updated to reject such requests. If we make "1" the "do not overwrite" then we'd have a case where drivers must update to ensure they reject requests which don't set the bit.
0 should be default and driver should bahave accordingly.
Quoted 3 lines
Thanks,
Jake
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 43 lines · Jiri Pirko
Quoted 30 lines · Wed, Jul 22, 2020 at 08:21:22PM CEST, [email protected] wrote:
Quoted 16 lines · Jakub Kicinski
Quoted 6 lines · Jacob E
Quoted 3 lines
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
So, we could make this selection a series of masked bits instead of a single enumeration value.
I'd still argue that components (as defined in devlink info) and config are pretty orthogonal. In my experience config is stored in its own section of the flash, and some of the knobs are in no obvious way associated with components (used by components).
That said, if we rename the "component mask" to "update mask" that's fine with me.
Quoted 9 lines
Then we'd have
bit 0 - don't overwrite config
bit 1 - don't overwrite identifiers?
Let's define a bit for "don't update program" when we actually need it.
Quoted 6 lines
Ok. And this can be later extended with additional bits with new meanings should the need arise.
Additionally, drivers can ensure that the valid combination of bits is set. the drivers can reject requests for combinations that they do not support.
Makes sense.
Quoted 3 lines
I can make that change.
Quoted 8 lines
Quoted 5 lines
My preference is that "0" for a bit means do not overwrite while "1" means overwrite. This way, if/when additional bits are added, drivers won't need to be updated to reject such requests. If we make "1" the "do not overwrite" then we'd have a case where drivers must update to ensure they reject requests which don't set the bit.
0 should be default and driver should bahave accordingly.
Correct, and it's good to spell that out more clearly.
Thanks,
Jake
Quoted 4 lines
Quoted 4 lines
Thanks,
Jake
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
In reply to Jakub KicinskiQuoted 34 lines · Jakub Kicinski
Quoted 18 lines · Jacob E
Quoted 18 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
Quoted 7 lines
Quoted 2 lines
I see it as an extra knob that is actually somehow provides degradation of components.
Hm. We have the exact opposite view on the matter. To me components currently correspond to separate fw/hw entities, that's a very clear meaning. PHY firmware, management FW, UNDI. Now we would add a completely orthogonal meaning to the same API.
I understand. My concern is, we would have a component with some "subparts". Now it is some fuzzy vagely defined "config part", in the future it might be something else. That is what I'm concerned about. Components have clear api.
Quoted 6 lines
Quoted 3 lines
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
So, we could make this selection a series of masked bits instead of a single enumeration value.
I'd still argue that components (as defined in devlink info) and config are pretty orthogonal. In my experience config is stored in its own section of the flash, and some of the knobs are in no obvious way associated with components (used by components).
That said, if we rename the "component mask" to "update mask" that's fine with me.
Quoted 9 lines
Then we'd have
bit 0 - don't overwrite config
bit 1 - don't overwrite identifiers?
Let's define a bit for "don't update program" when we actually need it.
One further wrinkle I was just reminded about. The ice hardware has a section of the flash which defines a "minimum security revision". All NVM images also have a "security revision". The firmware will fail to load if the NVM image's security revision is less than the mimimum security revision.
The minimum security revision is not updated automatically. Current tools which had direct access have an optional "opt in to minimum security revision update" which would optionally bump the minimum security revision after an update. The intent is that once an image is tested and verified to be stable, an administrator can opt in to prevent downgrade below that security revision. (Thus preventing potential downgrade to a known insecure image).
The folks adjusting our tools would like to continue to support this. I think the best solution would be to have both the security revision and minimum security revision become components, i.e. "fw.mgmt.security_revision" and "fw.mgmt.min_security_revision" (maybe shortened like "secrev or srev?), and then use the fw.mgmt.min_security_revision component name in the flash update request.
The security revision is tied into the management firmware image and would always be updated when an image is updated, but the minimum revision is only updated on an explicit request request.
In theory this could be done as part of this overwrite, but since I suspect this is somewhat device specific, (not sure other vendors have something similar?), and because there is a valid/known version we can report I think a component makes the most sense.
Jakub Kicinski
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 3 lines · On Wed, 29 Jul 2020 15:49:05 -0700 Jacob Keller wrote:
The security revision is tied into the management firmware image and would always be updated when an image is updated, but the minimum revision is only updated on an explicit request request.
Does it have to be updated during FW flashing? Can't it be a devlink param?
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 8 lines · Jakub Kicinski
Quoted 3 lines · On Wed, 29 Jul 2020 15:49:05 -0700 Jacob Keller wrote:
The security revision is tied into the management firmware image and would always be updated when an image is updated, but the minimum revision is only updated on an explicit request request.
Does it have to be updated during FW flashing? Can't it be a devlink param?
Oh, right. I'd forgotten about that type of parameter. Makes sense. I'll implement the current security revision as a component of flash info (so that it can be reported via devlink info, and can't be changed) but the minimum should be able to be a parameter just fine.
Thanks,
Jake
Jiri Pirko
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
In reply to Keller, Jacob EQuoted 41 lines · Wed, Jul 22, 2020 at 05:30:05PM CEST, [email protected] wrote:
Quoted 41 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jiri Pirko
Sent: Wednesday, July 22, 2020 3:52 AM
To: Jakub Kicinski <[email protected]>
Cc: Keller, Jacob E <[email protected]>; [email protected]; Tom Herbert <[email protected]>; Jiri Pirko <[email protected]>; Jakub Kicinski <[email protected]>; Jonathan Corbet <[email protected]>; Michael Chan <[email protected]>; Bin Luo <[email protected]>; Saeed Mahameed <[email protected]>; Leon Romanovsky <[email protected]>; Ido Schimmel <[email protected]>; Danielle Ratson <[email protected]>
Subject: Re: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash updateQuoted 22 lines · Tue, Jul 21, 2020 at 07:04:06PM CEST, [email protected] wrote:
Quoted 11 lines · On Tue, 21 Jul 2020 15:53:56 +0200 Jiri Pirko wrote:
Quoted 10 lines · Mon, Jul 20, 2020 at 05:51:59PM CEST, [email protected] wrote:
Quoted 8 lines · On Mon, 20 Jul 2020 12:09:53 +0200 Jiri Pirko wrote:
This looks odd. You have a single image yet you somehow divide it into "program" and "config" areas. We already have infra in place to take care of this. See
DEVLINK_ATTR_FLASH_UPDATE_COMPONENT. You should have 2 components:
1) "program"
2) "config"Then it is up to the user what he decides to flash.
Quoted 7 lines
Quoted 2 lines
99.9% of the time users want to flash "all". To achieve "don't flash config" with current infra users would have to flash each component
Well you can have multiple component what would overlap:
1) "program" + "config" (default)
2) "program"
3) "config"Say I have FW component and UNDI driver. Now I'll have 4 components? fw.prog, fw.config, undi.prog etc? Are those extra ones visible or just
Quoted 6 lines
Quoted 4 lines
Visible in which sense? We don't show components anywhere if I'm not mistaken. They are currently very rarely used. Basically we just ported it from ethtool without much thinking.
Component names are used in devlink info and displayed to end users along with versions, plus they're names passed by the user in devlink flash update. As far as documented, we shouldn't add new components without associated versions in the info report.
Okay. So it is loosely coupled. I think it would be nice to tight those 2 togeter so it is not up to the driver how he decides to implement it.
Quoted 30 lines
Quoted 30 lines
Quoted 3 lines
"implied"? If they are visible what version does the config have?
Good question. we don't have per-component version so far. I think it would be good to have it alonside with the listing.
Quoted 9 lines
Also (3) - flashing config from one firmware version and program from another - makes a very limited amount of sense to me.
Quoted 5 lines
Quoted 4 lines
one by one and then omit the one(s) which is config (guessing which one that is based on the name).
Wouldn't this be quite inconvenient?
Quoted 7 lines
Quoted 2 lines
I see it as an extra knob that is actually somehow provides degradation of components.
Hm. We have the exact opposite view on the matter. To me components currently correspond to separate fw/hw entities, that's a very clear meaning. PHY firmware, management FW, UNDI. Now we would add a completely orthogonal meaning to the same API.
I understand. My concern is, we would have a component with some "subparts". Now it is some fuzzy vagely defined "config part", in the future it might be something else. That is what I'm concerned about. Components have clear api.
Quoted 7 lines
Quoted 5 lines
So perhaps we can introduce something like "component mask", which would allow to flash only part of the component. That is basically what Jacob has, I would just like to have it well defined.
So, we could make this selection a series of masked bits instead of a single enumeration value.
Yeah.
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 10 lines · Jiri Pirko
Quoted 9 lines · Wed, Jul 22, 2020 at 05:30:05PM CEST, [email protected] wrote:
Quoted 8 lines
-----Original Message-----
From: [email protected] <[email protected]> On Visible in which sense? We don't show components anywhere if I'm not mistaken. They are currently very rarely used. Basically we just ported it from ethtool without much thinking.
Quoted 5 lines
Quoted 1 line
Component names are used in devlink info and displayed to end users along with versions, plus they're names passed by the user in devlink flash update. As far as documented, we shouldn't add new components without associated versions in the info report.
Okay. So it is loosely coupled. I think it would be nice to tight those 2 togeter so it is not up to the driver how he decides to implement it.
I felt the coupling was quite clear from Jakub's recent documentation improvements in the devlink-flash.rst doc file.
Are you thinking find some way to tie these two lists more closely in code?
Thanks,
Jake
Jiri Pirko
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 15 lines · Mon, Jul 27, 2020 at 08:13:12PM CEST, [email protected] wrote:
Quoted 12 lines · Jiri Pirko
Quoted 10 lines · Wed, Jul 22, 2020 at 05:30:05PM CEST, [email protected] wrote:
Quoted 8 lines
-----Original Message-----
From: [email protected] <[email protected]> On Visible in which sense? We don't show components anywhere if I'm not mistaken. They are currently very rarely used. Basically we just ported it from ethtool without much thinking.Component names are used in devlink info and displayed to end users along with versions, plus they're names passed by the user in devlink flash update. As far as documented, we shouldn't add new components without associated versions in the info report.
Quoted 7 lines
Quoted 3 lines
Okay. So it is loosely coupled. I think it would be nice to tight those 2 togeter so it is not up to the driver how he decides to implement it.
I felt the coupling was quite clear from Jakub's recent documentation improvements in the
devlink-flash.rstdoc file.Are you thinking find some way to tie these two lists more closely in code?
Yes. Documentation is very easy to ignore unfortunatelly. The driver developer has to be tight up by the core code and api, I believe.
Quoted 3 lines
Thanks,
Jake
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 3 lines · Jiri Pirko
Yes. Documentation is very easy to ignore unfortunatelly. The driver developer has to be tight up by the core code and api, I believe.
So I'm not sure what the best proposal here is. We do have a list of generic components, but given that each piece of HW has different elements, it's not always feasible to have fully generic names. Some of the names are driver specific.
I guess we could use some system where components are "registered" when loading the devlink, so that they can be verified by the stack when used as a parameter for flash update? Perhaps take something like the table-driven approach used for infos and extend that into devlink core so that drivers basically register a table of the components which includes both a function callback that gets the version string as well as an indication of whether that component can be updated via flash_update?
I know it would also be useful for ice to have a sort of "pre-info" callback that generates a context structure that is passed to each of the info callbacks. (that way a single up-front step could be to lookup the relevant information, and this is then forwarded to each of the formatter functions for each component).
Am I on the right track here or just over-engineering?
Re: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 17 lines · On Tue, 28 Jul 2020 09:58:44 -0700 Jacob Keller wrote:
Quoted 2 lines · Jiri Pirko
Yes. Documentation is very easy to ignore unfortunatelly. The driver developer has to be tight up by the core code and api, I believe.
So I'm not sure what the best proposal here is. We do have a list of generic components, but given that each piece of HW has different elements, it's not always feasible to have fully generic names. Some of the names are driver specific.
I guess we could use some system where components are "registered" when loading the devlink, so that they can be verified by the stack when used as a parameter for flash update? Perhaps take something like the table-driven approach used for infos and extend that into devlink core so that drivers basically register a table of the components which includes both a function callback that gets the version string as well as an indication of whether that component can be updated via
flash_update?
Quoted 7 lines
I know it would also be useful for ice to have a sort of "pre-info" callback that generates a context structure that is passed to each of the info callbacks. (that way a single up-front step could be to lookup the relevant information, and this is then forwarded to each of the formatter functions for each component).
Am I on the right track here or just over-engineering?
I don't understand why we're having this conversation.
No driver right now uses the component name.
AFAIU we agreed not to use the component name for config vs code.
So you may as well remove the component name from the devlink op and add a todo there saying "when adding component back, make sure it's tightly coupled to info".
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
Quoted 28 lines · Jakub Kicinski
Quoted 17 lines · On Tue, 28 Jul 2020 09:58:44 -0700 Jacob Keller wrote:
Quoted 2 lines · Jiri Pirko
Yes. Documentation is very easy to ignore unfortunatelly. The driver developer has to be tight up by the core code and api, I believe.
So I'm not sure what the best proposal here is. We do have a list of generic components, but given that each piece of HW has different elements, it's not always feasible to have fully generic names. Some of the names are driver specific.
I guess we could use some system where components are "registered" when loading the devlink, so that they can be verified by the stack when used as a parameter for flash update? Perhaps take something like the table-driven approach used for infos and extend that into devlink core so that drivers basically register a table of the components which includes both a function callback that gets the version string as well as an indication of whether that component can be updated via
flash_update?Quoted 7 lines
I know it would also be useful for ice to have a sort of "pre-info" callback that generates a context structure that is passed to each of the info callbacks. (that way a single up-front step could be to lookup the relevant information, and this is then forwarded to each of the formatter functions for each component).
Am I on the right track here or just over-engineering?
I don't understand why we're having this conversation.
Quoted 8 lines
No driver right now uses the component name.
AFAIU we agreed not to use the component name for config vs code.
So you may as well remove the component name from the devlink op and add a todo there saying "when adding component back, make sure it's tightly coupled to info".
Fair enough yea.
Jacob Keller
maintainerRe: [RFC PATCH net-next v2 6/6] devlink: add overwrite mode to flash update
In reply to Jakub KicinskiQuoted 28 lines · Jakub Kicinski
Quoted 17 lines · On Tue, 28 Jul 2020 09:58:44 -0700 Jacob Keller wrote:
Quoted 2 lines · Jiri Pirko
Yes. Documentation is very easy to ignore unfortunatelly. The driver developer has to be tight up by the core code and api, I believe.
So I'm not sure what the best proposal here is. We do have a list of generic components, but given that each piece of HW has different elements, it's not always feasible to have fully generic names. Some of the names are driver specific.
I guess we could use some system where components are "registered" when loading the devlink, so that they can be verified by the stack when used as a parameter for flash update? Perhaps take something like the table-driven approach used for infos and extend that into devlink core so that drivers basically register a table of the components which includes both a function callback that gets the version string as well as an indication of whether that component can be updated via
flash_update?Quoted 7 lines
I know it would also be useful for ice to have a sort of "pre-info" callback that generates a context structure that is passed to each of the info callbacks. (that way a single up-front step could be to lookup the relevant information, and this is then forwarded to each of the formatter functions for each component).
Am I on the right track here or just over-engineering?
I don't understand why we're having this conversation.
Quoted 8 lines
No driver right now uses the component name.
AFAIU we agreed not to use the component name for config vs code.
So you may as well remove the component name from the devlink op and add a todo there saying "when adding component back, make sure it's tightly coupled to info".
Another simpler option would be to just call .info_get and verify that the requested component appeared in that list. Ofcourse we'd be making this call every flash_update...
Quoted 2 lines · On Fri, 17 Jul 2020 11:35:35 -0700 Jacob Keller wrote:
This series goal is to enable support for updating the ice hardware flash using the devlink flash command.
Looks reasonable.
You have some left over references to ignore_pending_flash_update in comments, and you should use NLA_POLICY_RANGE() for the new attr.
Taking and releasing the FW lock may be fun for multi-host devices if you ever support those.
Keller, Jacob E
maintainerQuoted 15 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jakub Kicinski
Sent: Friday, July 17, 2020 12:58 PM
To: Keller, Jacob E <[email protected]>
Cc: [email protected]; Jiri Pirko <[email protected]>; Tom Herbert <[email protected]>; Jiri Pirko <[email protected]>; Jakub Kicinski <[email protected]>; Jonathan Corbet <[email protected]>; Michael Chan <[email protected]>; Bin Luo <[email protected]>; Saeed Mahameed <[email protected]>; Leon Romanovsky <[email protected]>; Ido Schimmel <[email protected]>; Danielle Ratson <[email protected]>
Subject: Re: [RFC PATCH net-next v2 0/6] introduce PLDM firmware update library
Quoted 9 lines
Quoted 2 lines · On Fri, 17 Jul 2020 11:35:35 -0700 Jacob Keller wrote:
This series goal is to enable support for updating the ice hardware flash using the devlink flash command.
Looks reasonable.
You have some left over references to
ignore_pending_flash_updatein comments, and you should useNLA_POLICY_RANGE()for the new attr.
Ah, good point I'll make sure to fix those up, and switch the NLA_POLICY_RANGE.
Quoted 2 lines
Taking and releasing the FW lock may be fun for multi-host devices if you ever support those.
Yea. The lib/pldm stuff assumes the driver will manage the locking. I'm not sure how the resource locks work in a multi-host environment at all..
Thanks,
Jake
Keller, Jacob E
maintainerQuoted 17 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Jakub Kicinski
Sent: Friday, July 17, 2020 12:58 PM
To: Keller, Jacob E <[email protected]>
Cc: [email protected]; Jiri Pirko <[email protected]>; Tom Herbert <[email protected]>; Jiri Pirko <[email protected]>; Jakub Kicinski <[email protected]>; Jonathan Corbet <[email protected]>; Michael Chan <[email protected]>; Bin Luo <[email protected]>; Saeed Mahameed <[email protected]>; Leon Romanovsky <[email protected]>; Ido Schimmel <[email protected]>; Danielle Ratson <[email protected]>
Subject: Re: [RFC PATCH net-next v2 0/6] introduce PLDM firmware update library
Quoted 9 lines
Quoted 2 lines · On Fri, 17 Jul 2020 11:35:35 -0700 Jacob Keller wrote:
This series goal is to enable support for updating the ice hardware flash using the devlink flash command.
Looks reasonable.
You have some left over references to
ignore_pending_flash_updatein comments, and you should useNLA_POLICY_RANGE()for the new attr.
Since the minimum value is zero, I switched the code to use NLA_POLICY_MAX.
Thanks,
Jake