ice devlink support
Subsystems (6)
v3 cover ice devlink support
(Sorry for the thrash, v3 should correct the warning)
Implement basic support for the devlink interface in the ice driver. Additionally pave some necessary changes for adding a devlink region that exposes the NVM contents.
This series first contains 5 patches for enabling and implementing full NVM read access via the ETHTOOL_GEEPROM interface. This includes some cleanup of endian-types, a new function for reading from the NVM and Shadow RAM as a flat addressable space, a function to calculate the available flash size during load, and a change to how some of the NVM version fields are stored in the ice_nvm_info structure.
Following this is 3 patches for implementing devlink support. First, one patch which implements the basic framework and introduces the ice_devlink.c file. Second, a patch to implement basic .info_get support. Finally, a patch which reads the device PBA identifier and reports it as the board.id value in the .info_get response.
This series builds on previous reviews for patches sent as RFC and is intended to pave the way for the devlink region changes to support creating snapshots from userspace and reading from a region without a snapshot.
Previous RFC series and discussion can be found at the following locations
* v1 https://lore.kernel.org/netdev/20200130225913.1671982-2-jacob.e.keller at intel.com/
* v2 https://lore.kernel.org/netdev/20200214232223.3442651-1-jacob.e.keller at intel.com/
This series only contains the ice driver changes for the basic devlink interface. I am working on updating the devlink core proposals and will send them to the netdev list after this has been merged.
Once again, thank you for your continued review and feedback.
## Changes since v2 ##
* create devlink_port before calling register_netdev, correctly fixing the issue pointed out by Jiri in the RFC review.
## Changes since v1 ##
* added a patch to promote ``fw.bundle_id`` to a generic version
* used ``fw.bundle_id`` instead of ``fw.bundle``
## Changes since the RFC ##
Removed patches:
* remove "ice: rename variables used for Option ROM version", as this is superseded by the patch to change now NVM version data is stored.
Patches without change:
* "ice: use __le16 types for explicitly Little Endian values"
* "ice: create function to read a section of the NVM and Shadow RAM"
New patches:
* "ice: store NVM version info in extracted format"
a patch which modifies how the NVM version information is stored
* "ice: discover and store size of available flash"
a patch to discover and save the available flash size during load
Changes in "ice: implement full NVM read from ETHTOOL_GEEPROM"
* use the new flash_size field in ice_get_eeprom_len, enabling a complete dump of flash contents, instead of only the initial 64Kb
* remove the unnecessary EINVAL check on return value from ice_read_flat_nvm. Now that we report the proper flash size, this error code is unexpected, and should be treated as an error.
* Use a "goto release" to ensure that the ice_release_nvm() function is called.
Changes in "ice: enable initial devlink support"
* Update copyright year on ice_devlink.c to 2020
* make ice_devlink_ops static
* Use "Return:" instead of "@returns" in kernel-doc comments
* Move the call to devlink_port_type_eth_set into ice_cfg_netdev, after the call to register_netdev().
Changes in "ice: add basic handler for devlink .info_get"
* convert to a loop over structured data, similar to the nfp driver
* change ``fw.mgmt.bundle`` to ``fw.mgmt.build``
* change ``fw.undi.orom`` to just ``fw.undi``
* change ``nvm.psid`` to ``fw.psid.api``
* change ``nvm.bundle`` to ``fw.bundle``
* add ``fw.app.name`` and ``fw.app`` representing the name and version of the active DDP package
* use lowercase %08x instead of %08X for ``fw.bundle``
Changes in "ice: add board identifier info to devlink .info_get"
* modified to use the new structured format for adding new versions
Jacob Keller (8):
ice: use __le16 types for explicitly Little Endian values
ice: create function to read a section of the NVM and Shadow RAM
ice: store NVM version info in extracted format
ice: discover and store size of available flash
ice: enable initial devlink support
devlink: promote "fw.bundle_id" to a generic info version
ice: add basic handler for devlink .info_get
ice: add board identifier info to devlink .info_get
Jesse Brandeburg (1):
ice: implement full NVM read from ETHTOOL_GEEPROM
.../networking/devlink/devlink-info.rst | 5 + Documentation/networking/devlink/ice.rst | 71 +++ Documentation/networking/devlink/index.rst | 1 + drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 4 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 4 + drivers/net/ethernet/intel/ice/ice_common.c | 89 ---- drivers/net/ethernet/intel/ice/ice_common.h | 9 - drivers/net/ethernet/intel/ice/ice_devlink.c | 320 ++++++++++++ drivers/net/ethernet/intel/ice/ice_devlink.h | 14 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 46 +- drivers/net/ethernet/intel/ice/ice_main.c | 33 +- drivers/net/ethernet/intel/ice/ice_nvm.c | 484 +++++++++++------- drivers/net/ethernet/intel/ice/ice_nvm.h | 12 + drivers/net/ethernet/intel/ice/ice_type.h | 32 +- .../net/ethernet/netronome/nfp/nfp_devlink.c | 2 +- include/net/devlink.h | 2 + 18 files changed, 826 insertions(+), 304 deletions(-) create mode 100644 Documentation/networking/devlink/ice.rst create mode 100644 drivers/net/ethernet/intel/ice/ice_devlink.c create mode 100644 drivers/net/ethernet/intel/ice/ice_devlink.h
Signature · 1 line
2.24.1
PATCH v3 1/9 ice: use __le16 types for explicitly Little Endian values
The ice_read_sr_aq function returns words in the Little Endian format. Remove the need for __force and typecasting by using a local variable in the ice_read_sr_word_aq function.
Additionally clarify explicitly that the ice_read_sr_aq function takes storage for __le16 values instead of using u16.
Being explicit about the endianness of this data helps when using tools like sparse to catch endian-related issues.
--- drivers/net/ethernet/intel/ice/ice_nvm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ice/ice_nvm.c +7 -5
@@ -80,13 +80,14 @@ ice_check_sr_access_params(struct ice_hw *hw, u32 offset, u16 words)* @hw: pointer to the HW structure * @offset: offset in words from module start * @words: number of words to read -* @data: buffer for words reads from Shadow RAM +* @data: storage for the words read from Shadow RAM (Little Endian) * @last_command: tells the AdminQ that this is the last command * -* Reads 16-bit word buffers from the Shadow RAM using the admin command. +* Reads 16-bit Little Endian word buffers from the Shadow RAM using the admin +* command. */ static enum ice_status -ice_read_sr_aq (struct ice_hw *hw,u32 offset,u16 words,u16 *data, +ice_read_sr_aq (struct ice_hw *hw,u32 offset,u16 words,__le16 *data,bool last_command) {enum ice_status status;
@@ -116,10 +117,11 @@ static enum ice_status ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data) { enum ice_status status; +__le16 data_local; - status =ice_read_sr_aq (hw, offset,1 , data, true); + status =ice_read_sr_aq (hw, offset,1 , &data_local, true);if (!status) - *data =le16_to_cpu (*(__force __le16 *)data); + *data =le16_to_cpu (data_local);return status; }
Signature · 1 line
2.24.1
Bowers
PATCH v3 1/9 ice: use __le16 types for explicitly Little Endian values
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 1/9] ice: use __le16 types for explicitly Little Endian values
The ice_read_sr_aq function returns words in the Little Endian format.
Remove the need for __force and typecasting by using a local variable in the ice_read_sr_word_aq function.
Additionally clarify explicitly that the ice_read_sr_aq function takes storage for __le16 values instead of using u16.
Being explicit about the endianness of this data helps when using tools like sparse to catch endian-related issues.
--- drivers/net/ethernet/intel/ice/ice_nvm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
PATCH v3 2/9 ice: create function to read a section of the NVM and Shadow RAM
In reply to Jacob KellerThe NVM contents are read via firmware by using the ice_aq_read_nvm function. This function has a couple of limits:
1) The AdminQ commands can only take buffers sized up to 4Kb. Thus, any larger read must be split into multiple reads.
2) when reading from the Shadow RAM, reads must not cross sector boundaries. The sectors are also 4Kb in size.
Implement the ice_read_flat_nvm function to read portions of the NVM by flat offset. That is, to read using offsets from the start of the NVM rather than from a specific module.
This function will be able to read both from the NVM and from the Shadow RAM. For simplicity NVM reads will always be broken up to not cross 4Kb page boundaries, even though this is not required unless reading from the Shadow RAM.
Use this new function as the implementation of ice_read_sr_word_aq.
The ice_read_sr_buf_aq function is not modified here. This is because a following change will remove the only caller of that function in favor of directly using ice_read_flat_nvm. Thus, there is little benefit to changing it now only to remove it momentarily. At the same time, the ice_read_sr_aq function will also be removed.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_nvm.c | 87 +++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_nvm.h | 3 + 3 files changed, 85 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -0
@@ -1251,6 +1251,8 @@ struct ice_aqc_nvm {__le32 addr_low; }; +#define ICE_AQC_NVM_START_POINT 0 +/* NVM Checksum Command (direct, 0x0706) */ struct ice_aqc_nvm_checksum {u8 flags;
drivers/net/ethernet/intel/ice/ice_nvm.c +80 -7
131 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.h +3 -0
@@ -4,5 +4,8 @@#ifndef _ICE_NVM_H_#define _ICE_NVM_H_ +enum ice_status +ice_read_flat_nvm (struct ice_hw *hw,u32 offset,u32 *length,u8 *data, +bool read_shadow_ram);enum ice_status ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data);#endif /* _ICE_NVM_H_ */
Signature · 1 line
2.24.1
Bowers
PATCH v3 2/9 ice: create function to read a section of the NVM and Shadow RAM
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 2/9] ice: create function to read a section of the NVM and Shadow RAM
The NVM contents are read via firmware by using the ice_aq_read_nvm function. This function has a couple of limits:
1) The AdminQ commands can only take buffers sized up to 4Kb. Thus, any larger read must be split into multiple reads.
2) when reading from the Shadow RAM, reads must not cross sector boundaries. The sectors are also 4Kb in size.
Implement the ice_read_flat_nvm function to read portions of the NVM by flat offset. That is, to read using offsets from the start of the NVM rather than from a specific module.
This function will be able to read both from the NVM and from the Shadow RAM. For simplicity NVM reads will always be broken up to not cross 4Kb page boundaries, even though this is not required unless reading from the Shadow RAM.
Use this new function as the implementation of ice_read_sr_word_aq.
The ice_read_sr_buf_aq function is not modified here. This is because a following change will remove the only caller of that function in favor of directly using ice_read_flat_nvm. Thus, there is little benefit to changing it now only to remove it momentarily. At the same time, the ice_read_sr_aq function will also be removed.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_nvm.c | 87 +++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_nvm.h | 3 + 3 files changed, 85 insertions(+), 7 deletions(-)
PATCH v3 3/9 ice: store NVM version info in extracted format
In reply to Jacob KellerThe NVM version and Option ROM version information is stored within the struct ice_nvm_ver_info structure. The data for the NVM is stored as a 2byte value with the major and minor versions each using one byte from the field. The Option ROM is stored as a 4byte value that contains a major, build, and patch number.
Modify the code to immediately extract the version values and store them in a new struct ice_orom_info. Remove the now unnecessary ice_get_nvm_version function.
Update ice_ethtool.c to use the new fields directly from the structured data.
This reduces complexity of the code that prints these versions in ice_ethtool.c
Update the macro definitions and variable names to use the term "orom" instead of "oem" for the Option ROM version. This helps increase the clarity of the Option ROM version code.
--- drivers/net/ethernet/intel/ice/ice_common.c | 23 ----- drivers/net/ethernet/intel/ice/ice_common.h | 3 - drivers/net/ethernet/intel/ice/ice_ethtool.c | 13 +-- drivers/net/ethernet/intel/ice/ice_nvm.c | 94 +++++++++++++------- drivers/net/ethernet/intel/ice/ice_type.h | 30 ++++--- 5 files changed, 88 insertions(+), 75 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +0 -23
@@ -614,29 +614,6 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw) } } -/** -* ice_get_nvm_version - get cached NVM version data -* @hw: pointer to the hardware structure -* @oem_ver: 8 bit NVM version -* @oem_build: 16 bit NVM build number -* @oem_patch: 8 NVM patch number -* @ver_hi: high 8 bits of the NVM version -* @ver_lo: low 8 bits of the NVM version -*/ -void -ice_get_nvm_version (struct ice_hw *hw,u8 *oem_ver,u16 *oem_build, -u8 *oem_patch,u8 *ver_hi,u8 *ver_lo) -{ -struct ice_nvm_info *nvm = &hw->nvm; - - *oem_ver = (u8)((nvm->oem_ver &ICE_OEM_VER_MASK ) >>ICE_OEM_VER_SHIFT ); - *oem_patch = (u8)(nvm->oem_ver &ICE_OEM_VER_PATCH_MASK ); - *oem_build = (u16)((nvm->oem_ver &ICE_OEM_VER_BUILD_MASK ) >> -ICE_OEM_VER_BUILD_SHIFT ); - *ver_hi = (nvm->ver &ICE_NVM_VER_HI_MASK ) >>ICE_NVM_VER_HI_SHIFT ; - *ver_lo = (nvm->ver &ICE_NVM_VER_LO_MASK ) >>ICE_NVM_VER_LO_SHIFT ; -} -/** * ice_init_hw - main hardware initialization routine * @hw: pointer to the hardware structure
drivers/net/ethernet/intel/ice/ice_common.h +0 -3
@@ -162,9 +162,6 @@ ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,void ice_stat_update32 (struct ice_hw *hw,u32 reg,bool prev_stat_loaded,u64 *prev_stat,u64 *cur_stat); -void -ice_get_nvm_version (struct ice_hw *hw,u8 *oem_ver,u16 *oem_build, -u8 *oem_patch,u8 *ver_hi,u8 *ver_lo);enum ice_status ice_sched_query_elem (struct ice_hw *hw,u32 node_teid,struct ice_aqc_get_elem *buf);
drivers/net/ethernet/intel/ice/ice_ethtool.c +7 -6
@@ -167,11 +167,14 @@ static void ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) { struct ice_netdev_priv *np = netdev_priv(netdev); -u8 oem_ver, oem_patch, nvm_ver_hi, nvm_ver_lo;struct ice_vsi *vsi = np->vsi;struct ice_pf *pf = vsi->back;struct ice_hw *hw = &pf->hw; -u16 oem_build; +struct ice_orom_info *orom; +struct ice_nvm_info *nvm; + + nvm = &hw->nvm; + orom = &nvm->orom;strscpy (drvinfo->driver,KBUILD_MODNAME ,sizeof (drvinfo->driver));strscpy (drvinfo->version, ice_drv_ver,sizeof (drvinfo->version));
@@ -179,11 +182,9 @@ ice_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)/* Display NVM version (from which the firmware version can be * determined) which contains more pertinent information. */ -ice_get_nvm_version (hw, &oem_ver, &oem_build, &oem_patch, - &nvm_ver_hi, &nvm_ver_lo);snprintf (drvinfo->fw_version,sizeof (drvinfo->fw_version), -"%x.%02x 0x%x %d.%d.%d" , nvm_ver_hi, nvm_ver_lo, - hw->nvm.eetrack, oem_ver, oem_build, oem_patch); +"%x.%02x 0x%x %d.%d.%d" , nvm->major_ver, nvm->minor_ver, + nvm->eetrack, orom->major, orom->build, orom->patch);strscpy (drvinfo->bus_info,pci_name (pf->pdev),sizeof (drvinfo->bus_info));
drivers/net/ethernet/intel/ice/ice_nvm.c +62 -32
128 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_type.h +19 -11
@@ -241,12 +241,20 @@ struct ice_fc_info {enum ice_fc_mode req_mode;/* FC mode requested by caller */ }; +/* Option ROM version information */ +struct ice_orom_info { +u8 major;/* Major version of OROM */ +u8 patch;/* Patch version of OROM */ +u16 build;/* Build version of OROM */ +}; +/* NVM Information */ struct ice_nvm_info { -u32 eetrack;/* NVM data version */ -u32 oem_ver;/* OEM version info */ -u16 sr_words;/* Shadow RAM size in words */ -u16 ver;/* NVM package version */ +struct ice_orom_info orom;/* Option ROM version info */ +u32 eetrack;/* NVM data version */ +u16 sr_words;/* Shadow RAM size in words */ +u8 major_ver;/* major version of NVM package */ +u8 minor_ver;/* minor version of dev starter */ u8 blank_nvm_mode;/* is NVM empty (no FW present) */ };
@@ -633,7 +641,7 @@ struct ice_hw_port_stats {/* Checksum and Shadow RAM pointers */ #define ICE_SR_BOOT_CFG_PTR 0x132 -#define ICE_NVM_OEM_VER_OFF 0x02 +#define ICE_NVM_OROM_VER_OFF 0x02#define ICE_SR_NVM_DEV_STARTER_VER 0x18#define ICE_SR_NVM_EETRACK_LO 0x2D#define ICE_SR_NVM_EETRACK_HI 0x2E
@@ -641,12 +649,12 @@ struct ice_hw_port_stats {#define ICE_NVM_VER_LO_MASK (0xff << ICE_NVM_VER_LO_SHIFT)#define ICE_NVM_VER_HI_SHIFT 12#define ICE_NVM_VER_HI_MASK (0xf << ICE_NVM_VER_HI_SHIFT) -#define ICE_OEM_VER_PATCH_SHIFT 0 -#define ICE_OEM_VER_PATCH_MASK (0xff << ICE_OEM_VER_PATCH_SHIFT) -#define ICE_OEM_VER_BUILD_SHIFT 8 -#define ICE_OEM_VER_BUILD_MASK (0xffff << ICE_OEM_VER_BUILD_SHIFT) -#define ICE_OEM_VER_SHIFT 24 -#define ICE_OEM_VER_MASK (0xff << ICE_OEM_VER_SHIFT) +#define ICE_OROM_VER_PATCH_SHIFT 0 +#define ICE_OROM_VER_PATCH_MASK (0xff << ICE_OROM_VER_PATCH_SHIFT) +#define ICE_OROM_VER_BUILD_SHIFT 8 +#define ICE_OROM_VER_BUILD_MASK (0xffff << ICE_OROM_VER_BUILD_SHIFT) +#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_SECTOR_SIZE_IN_WORDS 0x800#define ICE_SR_WORDS_IN_1KB 512
Signature · 1 line
2.24.1
Bowers
PATCH v3 3/9 ice: store NVM version info in extracted format
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 3/9] ice: store NVM version info in extracted format
The NVM version and Option ROM version information is stored within the struct ice_nvm_ver_info structure. The data for the NVM is stored as a 2byte value with the major and minor versions each using one byte from the field. The Option ROM is stored as a 4byte value that contains a major, build, and patch number.
Modify the code to immediately extract the version values and store them in a new struct ice_orom_info. Remove the now unnecessary ice_get_nvm_version function.
Update ice_ethtool.c to use the new fields directly from the structured data.
This reduces complexity of the code that prints these versions in ice_ethtool.c
Update the macro definitions and variable names to use the term "orom"
instead of "oem" for the Option ROM version. This helps increase the clarity of the Option ROM version code.
--- drivers/net/ethernet/intel/ice/ice_common.c | 23 ----- drivers/net/ethernet/intel/ice/ice_common.h | 3 - drivers/net/ethernet/intel/ice/ice_ethtool.c | 13 +-- drivers/net/ethernet/intel/ice/ice_nvm.c | 94 +++++++++++++------- drivers/net/ethernet/intel/ice/ice_type.h | 30 ++++--- 5 files changed, 88 insertions(+), 75 deletions(-)
PATCH v3 4/9 ice: discover and store size of available flash
In reply to Jacob KellerWhen reading from the NVM using a flat address, it is useful to know the upper bound on the size of the flash contents. This value is not stored within the NVM.
We can determine the size by performing a bisection between upper and lower bounds. It is known that the size cannot exceed 16 MB (offset of 0xFFFFFF).
Use a while loop to bisect the upper and lower bounds by reading one byte at a time. On a failed read, lower the maximum bound. On a successful read, increase the lower bound.
Save this as the flash_size in the ice_nvm_info structure that contains data related to the NVM.
The size will be used in a future patch for implementing full NVM read via ethtool's GEEPROM command.
The maximum possible size for the flash is bounded by the size limit for the NVM AdminQ commands. Add a new macro, ICE_AQC_NVM_MAX_OFFSET, which can be used to represent this upper bound.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_nvm.c | 62 ++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_type.h | 1 + 3 files changed, 63 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +2 -0
@@ -1233,6 +1233,7 @@ struct ice_aqc_sff_eeprom {* NVM Update commands (indirect 0x0703) */ struct ice_aqc_nvm { +#define ICE_AQC_NVM_MAX_OFFSET 0xFFFFFF__le16 offset_low;u8 offset_high;u8 cmd_flags;
@@ -1798,6 +1799,7 @@ enum ice_aq_err {ICE_AQ_RC_ENOMEM =9 ,/* Out of memory */ ICE_AQ_RC_EBUSY =12 ,/* Device or resource busy */ ICE_AQ_RC_EEXIST =13 ,/* Object already exists */ +ICE_AQ_RC_EINVAL =14 ,/* Invalid argument */ ICE_AQ_RC_ENOSPC =16 ,/* No space left or allocation failure */ ICE_AQ_RC_ENOSYS =17 ,/* Function not implemented */ ICE_AQ_RC_ENOSEC = 24, /* Missing security manifest */
drivers/net/ethernet/intel/ice/ice_nvm.c +60 -2
80 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
@@ -253,6 +253,7 @@ struct ice_nvm_info {struct ice_orom_info orom;/* Option ROM version info */ u32 eetrack;/* NVM data version */ u16 sr_words;/* Shadow RAM size in words */ +u32 flash_size;/* Size of available flash in bytes */ u8 major_ver;/* major version of NVM package */ u8 minor_ver;/* minor version of dev starter */ u8 blank_nvm_mode;/* is NVM empty (no FW present) */
Signature · 1 line
2.24.1
Bowers
PATCH v3 4/9 ice: discover and store size of available flash
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 4/9] ice: discover and store size of available flash
When reading from the NVM using a flat address, it is useful to know the upper bound on the size of the flash contents. This value is not stored within the NVM.
We can determine the size by performing a bisection between upper and lower bounds. It is known that the size cannot exceed 16 MB (offset of 0xFFFFFF).
Use a while loop to bisect the upper and lower bounds by reading one byte at a time. On a failed read, lower the maximum bound. On a successful read, increase the lower bound.
Save this as the flash_size in the ice_nvm_info structure that contains data related to the NVM.
The size will be used in a future patch for implementing full NVM read via ethtool's GEEPROM command.
The maximum possible size for the flash is bounded by the size limit for the NVM AdminQ commands. Add a new macro, ICE_AQC_NVM_MAX_OFFSET, which can be used to represent this upper bound.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 + drivers/net/ethernet/intel/ice/ice_nvm.c | 62 ++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_type.h | 1 + 3 files changed, 63 insertions(+), 2 deletions(-)
PATCH v3 5/9 ice: implement full NVM read from ETHTOOL_GEEPROM
In reply to Jacob KellerFrom: Jesse Brandeburg <[email protected]>
The current implementation of .get_eeprom only enables reading from the Shadow RAM portion of the NVM contents. Implement support for reading the entire flash contents instead of only the initial portion contained in the Shadow RAM.
A complete dump can take several seconds, but the ETHTOOL_GEEPROM ioctl is capable of reading only a limited portion at a time by specifying the offset and length to read.
In order to perform the reads directly, several functions are made non static. Additionally, the unused ice_read_sr_buf_aq and ice_read_sr_buf functions are removed.
--- drivers/net/ethernet/intel/ice/ice_common.h | 3 - drivers/net/ethernet/intel/ice/ice_ethtool.c | 33 ++-- drivers/net/ethernet/intel/ice/ice_nvm.c | 150 +------------------ drivers/net/ethernet/intel/ice/ice_nvm.h | 4 + 4 files changed, 26 insertions(+), 164 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.h +0 -3
@@ -38,9 +38,6 @@ enum ice_status ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res);enum ice_status ice_free_hw_res (struct ice_hw *hw,u16 type,u16 num,u16 *res); -enum ice_status ice_init_nvm (struct ice_hw *hw); -enum ice_status -ice_read_sr_buf (struct ice_hw *hw,u16 offset,u16 *words,u16 *data); enum ice_status ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries, struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
drivers/net/ethernet/intel/ice/ice_ethtool.c +20 -13
@@ -245,7 +245,7 @@ static int ice_get_eeprom_len(struct net_device *netdev)struct ice_netdev_priv *np =netdev_priv (netdev);struct ice_pf *pf = np->vsi->back; -return (int )(pf->hw.nvm.sr_words *sizeof (u16)); +return (int )pf->hw.nvm.flash_size; } static int
@@ -253,39 +253,46 @@ ice_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, u8 *bytes) {struct ice_netdev_priv *np =netdev_priv (netdev); -u16 first_word, last_word, nwords;struct ice_vsi *vsi = np->vsi;struct ice_pf *pf = vsi->back;struct ice_hw *hw = &pf->hw;enum ice_status status;struct device *dev;int ret =0 ; -u16 *buf; +u8 *buf; dev =ice_pf_to_dev (pf); eeprom->magic = hw->vendor_id | (hw->device_id <<16 ); +netdev_dbg (netdev,"GEEPROM cmd 0x%08x, offset 0x%08x, len 0x%08x\n" , + eeprom->cmd, eeprom->offset, eeprom->len); - first_word = eeprom->offset >>1 ; - last_word = (eeprom->offset + eeprom->len -1 ) >>1 ; - nwords = last_word - first_word +1 ; - - buf =devm_kcalloc (dev, nwords,sizeof (u16),GFP_KERNEL ); + buf =kzalloc (eeprom->len,GFP_KERNEL );if (!buf)return -ENOMEM ; - status =ice_read_sr_buf (hw, first_word, &nwords, buf); + status =ice_acquire_nvm (hw,ICE_RES_READ );if (status) { -dev_err (dev,"ice_read_sr_buf failed, err %d aq_err %d\n" , +dev_err (dev,"ice_acquire_nvm failed, err %d aq_err %d\n" , status, hw->adminq.sq_last_status); - eeprom->len =sizeof (u16) * nwords; ret = -EIO ; goto out; } -memcpy (bytes, (u8 *)buf + (eeprom->offset &1 ), eeprom->len); + status =ice_read_flat_nvm (hw, eeprom->offset, &eeprom->len, buf, + false); +if (status) { +dev_err (dev,"ice_read_flat_nvm failed, err %d aq_err %d\n" , + status, hw->adminq.sq_last_status); + ret = -EIO ; + goto release; + } + +memcpy (bytes, buf, eeprom->len); +release: +ice_release_nvm (hw); out: -devm_kfree (dev, buf); +kfree (buf);return ret; }
drivers/net/ethernet/intel/ice/ice_nvm.c +2 -148
180 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.h +4 -0
@@ -4,8 +4,12 @@#ifndef _ICE_NVM_H_#define _ICE_NVM_H_ +enum ice_status +ice_acquire_nvm (struct ice_hw *hw,enum ice_aq_res_access_type access); +void ice_release_nvm (struct ice_hw *hw);enum ice_status ice_read_flat_nvm (struct ice_hw *hw,u32 offset,u32 *length,u8 *data,bool read_shadow_ram); +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);#endif /* _ICE_NVM_H_ */
Signature · 1 line
2.24.1
Bowers
PATCH v3 5/9 ice: implement full NVM read from ETHTOOL_GEEPROM
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 5/9] ice: implement full NVM read from ETHTOOL_GEEPROM
From: Jesse Brandeburg <[email protected]>
The current implementation of .get_eeprom only enables reading from the Shadow RAM portion of the NVM contents. Implement support for reading the entire flash contents instead of only the initial portion contained in the Shadow RAM.
A complete dump can take several seconds, but the ETHTOOL_GEEPROM ioctl is capable of reading only a limited portion at a time by specifying the offset and length to read.
In order to perform the reads directly, several functions are made non static. Additionally, the unused ice_read_sr_buf_aq and ice_read_sr_buf functions are removed.
--- drivers/net/ethernet/intel/ice/ice_common.h | 3 - drivers/net/ethernet/intel/ice/ice_ethtool.c | 33 ++-- drivers/net/ethernet/intel/ice/ice_nvm.c | 150 +------------------ drivers/net/ethernet/intel/ice/ice_nvm.h | 4 + 4 files changed, 26 insertions(+), 164 deletions(-)
PATCH v3 6/9 ice: enable initial devlink support
In reply to Jacob KellerBegin implementing support for the devlink interface with the ice driver.
The pf structure is currently memory managed through devres, via a devm_alloc. To mimic this behavior, after allocating the devlink pointer, use devm_add_action to add a teardown action for releasing the devlink memory on exit.
The ice hardware is a multi-function PCIe device. Thus, each physical function will get its own devlink instance. This means that each function will be treated independently, with its own parameters and configuration. This is done because the ice driver loads a separate instance for each function.
Due to this, the implementation does not enable devlink to manage device-wide resources or configuration, as each physical function will be treated independently. This is done for simplicity, as managing a devlink instance across multiple driver instances would significantly increase the complexity for minimal gain.
--- drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 4 + drivers/net/ethernet/intel/ice/ice_devlink.c | 117 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_devlink.h | 14 +++ drivers/net/ethernet/intel/ice/ice_main.c | 33 +++++- 6 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_devlink.c create mode 100644 drivers/net/ethernet/intel/ice/ice_devlink.h
drivers/net/ethernet/intel/Kconfig +1 -0
@@ -296,6 +296,7 @@ config ICE default n depends on PCI_MSI select VIRTUAL_BUS + select NET_DEVLINK ---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
@@ -20,6 +20,7 @@ ice-y := ice_main.o \ ice_flex_pipe.o \ ice_flow.o \ ice_idc.o \ + ice_devlink.o \ ice_ethtool.o ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
drivers/net/ethernet/intel/ice/ice.h +4 -0
@@ -35,6 +35,7 @@#include <linux/bpf.h> #include <linux/virtual_bus.h> #include <linux/avf/virtchnl.h> +#include <net/devlink.h> #include <net/ipv6.h> #include <net/xdp_sock.h> #include <net/geneve.h>
@@ -358,6 +359,9 @@ enum ice_pf_flags {struct ice_pf {struct pci_dev *pdev; +/* devlink port data */ +struct devlink_port devlink_port; +/* OS reserved IRQ details */ struct msix_entry *msix_entries;struct ice_res_tracker *irq_tracker;
drivers/net/ethernet/intel/ice/ice_devlink.c new file +117 -0
117 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_devlink.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2019, Intel Corporation. */ + +#ifndef _ICE_DEVLINK_H_ +#define _ICE_DEVLINK_H_ + +struct ice_pf *ice_allocate_pf (struct device *dev); + +int ice_devlink_register (struct ice_pf *pf); +void ice_devlink_unregister (struct ice_pf *pf); +int ice_devlink_create_port (struct ice_pf *pf); +void ice_devlink_destroy_port (struct ice_pf *pf); + +#endif /* _ICE_DEVLINK_H_ */
drivers/net/ethernet/intel/ice/ice_main.c +29 -4
@@ -10,6 +10,7 @@#include "ice_lib.h" #include "ice_dcb_lib.h" #include "ice_dcb_nl.h" +#include "ice_devlink.h" #define DRV_VERSION_MAJOR 0#define DRV_VERSION_MINOR 8
@@ -2391,10 +2392,16 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)u8 mac_addr[ETH_ALEN ];int err; + err =ice_devlink_create_port (pf); +if (err) +return err; + netdev =alloc_etherdev_mqs (sizeof (*np), vsi->alloc_txq, vsi->alloc_rxq); -if (!netdev) -return -ENOMEM ; +if (!netdev) { + err = -ENOMEM ; + goto err_destroy_devlink_port; + } vsi->netdev = netdev; np =netdev_priv (netdev);
@@ -2424,7 +2431,9 @@ static int ice_cfg_netdev(struct ice_vsi *vsi) err =register_netdev (vsi->netdev);if (err) -return err; + goto err_destroy_devlink_port; + +devlink_port_type_eth_set (&pf->devlink_port, vsi->netdev);netif_carrier_off (vsi->netdev);
@@ -2432,6 +2441,11 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)netif_tx_stop_all_queues (vsi->netdev);return 0 ; + +err_destroy_devlink_port: +ice_devlink_destroy_port (pf); + +return err; }/**
@@ -3224,7 +3238,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)return err; } - pf =devm_kzalloc (dev,sizeof (*pf),GFP_KERNEL ); + pf =ice_allocate_pf (dev);if (!pf)return -ENOMEM ;
@@ -3262,6 +3276,12 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) pf->msg_enable =netif_msg_init (debug,ICE_DFLT_NETIF_M ); + err =ice_devlink_register (pf); +if (err) { +dev_err (dev,"ice_devlink_register failed: %d\n" , err); + goto err_exit_unroll; + } +#ifndef CONFIG_DYNAMIC_DEBUG if (debug <-1 ) hw->debug_mask = debug;
@@ -3422,6 +3442,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) } } err_alloc_sw_unroll: +ice_devlink_destroy_port (pf);set_bit (__ICE_SERVICE_DIS, pf->state);set_bit (__ICE_DOWN, pf->state);devm_kfree (dev, pf->first_sw);
@@ -3434,6 +3455,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)ice_deinit_pf (pf);ice_deinit_hw (hw); err_exit_unroll: +ice_devlink_unregister (pf);pci_disable_pcie_error_reporting (pdev);return err; }
@@ -3469,6 +3491,7 @@ static void ice_remove(struct pci_dev *pdev) }set_bit (__ICE_DOWN, pf->state); +ice_devlink_destroy_port (pf);ice_vsi_release_all (pf);if (ice_is_peer_ena (pf)) {ice_for_each_peer (pf,NULL , ice_unreg_peer_device);
@@ -3482,6 +3505,8 @@ static void ice_remove(struct pci_dev *pdev) }ice_deinit_pf (pf);ice_deinit_hw (&pf->hw); +ice_devlink_unregister (pf); +/* Issue a PFR as part of the prescribed driver unload flow. Do not * do it via ice_schedule_reset() since there is no need to rebuild * and the service task is already stopped.
Signature · 1 line
2.24.1
Bowers
PATCH v3 6/9 ice: enable initial devlink support
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 6/9] ice: enable initial devlink support
Begin implementing support for the devlink interface with the ice driver.
The pf structure is currently memory managed through devres, via a devm_alloc. To mimic this behavior, after allocating the devlink pointer, use devm_add_action to add a teardown action for releasing the devlink memory on exit.
The ice hardware is a multi-function PCIe device. Thus, each physical function will get its own devlink instance. This means that each function will be treated independently, with its own parameters and configuration. This is done because the ice driver loads a separate instance for each function.
Due to this, the implementation does not enable devlink to manage device-wide resources or configuration, as each physical function will be treated independently. This is done for simplicity, as managing a devlink instance across multiple driver instances would significantly increase the complexity for minimal gain.
--- drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 4 + drivers/net/ethernet/intel/ice/ice_devlink.c | 117 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_devlink.h | 14 +++ drivers/net/ethernet/intel/ice/ice_main.c | 33 +++++- 6 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_devlink.c create mode 100644 drivers/net/ethernet/intel/ice/ice_devlink.h
PATCH v3 7/9 devlink: promote "fw.bundle_id" to a generic info version
In reply to Jacob KellerThe nfp driver uses ``fw.bundle_id`` to represent a unique identifier of the entire firmware bundle.
A future change is going to introduce a similar notion in the ice driver, so promote ``fw.bundle_id`` into a generic version now.
--- Documentation/networking/devlink/devlink-info.rst | 5 +++++ drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 2 +- include/net/devlink.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-)
Documentation/networking/devlink/devlink-info.rst +5 -0
@@ -98,3 +98,8 @@ fw.roce RoCE firmware version which is responsible for handling roce management. + +fw.bundle_id +------------ + +Unique identifier of the entire firmware bundle.
drivers/net/ethernet/netronome/nfp/nfp_devlink.c +1 -1
@@ -211,7 +211,7 @@ static const struct nfp_devlink_versions {enum nfp_nsp_versions id;const char *key; } nfp_devlink_versions_nsp[] = { - { NFP_VERSIONS_BUNDLE, "fw.bundle_id", }, + { NFP_VERSIONS_BUNDLE, DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID, }, { NFP_VERSIONS_BSP, DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, }, { NFP_VERSIONS_CPLD, "fw.cpld", }, { NFP_VERSIONS_APP, DEVLINK_INFO_VERSION_GENERIC_FW_APP, },
include/net/devlink.h +2 -0
@@ -490,6 +490,8 @@ enum devlink_param_generic_id {#define DEVLINK_INFO_VERSION_GENERIC_FW_PSID "fw.psid"/* RoCE FW version */ #define DEVLINK_INFO_VERSION_GENERIC_FW_ROCE "fw.roce" +/* Firmware bundle identifier */ +#define DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID "fw.bundle_id"struct devlink_region ;struct devlink_info_req ;
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH v3 7/9 devlink: promote "fw.bundle_id" to a generic info version
Quoted 7 lines · On Wed, 11 Mar 2020 18:58:16 -0700 Jacob Keller wrote:
The nfp driver uses ``fw.bundle_id`` to represent a unique identifier of the entire firmware bundle.
A future change is going to introduce a similar notion in the ice driver, so promote ``fw.bundle_id`` into a generic version now.
Signed-off-by Jacob Keller <[email protected]>
Bowers
PATCH v3 7/9 devlink: promote "fw.bundle_id" to a generic info version
In reply to Jacob Keller-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 7/9] devlink: promote "fw.bundle_id" to a generic info version
The nfp driver uses ``fw.bundle_id`` to represent a unique identifier of the entire firmware bundle.
A future change is going to introduce a similar notion in the ice driver, so promote ``fw.bundle_id`` into a generic version now.
--- Documentation/networking/devlink/devlink-info.rst | 5 +++++ drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 2 +- include/net/devlink.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-)
PATCH v3 8/9 ice: add basic handler for devlink .info_get
In reply to Jacob KellerThe devlink .info_get callback allows the driver to report detailed version information. The following devlink versions are reported with this initial implementation:
"fw.mgmt" -> The version of the firmware that controls PHY, link, etc "fw.mgmt.api" -> API version of interface exposed over the AdminQ "fw.mgmt.build" -> Unique build id of the source for the management fw "fw.undi" -> Version of the Option ROM containing the UEFI driver "fw.psid.api" -> Version of the NVM image format. "fw.bundle_id" -> Unique identifier for the combined flash image. "fw.app.name" -> The name of the active DDP package. "fw.app" -> The version of the active DDP package.
With this, devlink dev info can report at least as much information as is reported by ETHTOOL_GDRVINFO.
Compare the output from ethtool vs from devlink:
$ ethtool -i ens785s0 driver: ice version: 0.8.1-k firmware-version: 0.80 0x80002ec0 1.2581.0 expansion-rom-version: bus-info: 0000:3b:00.0 supports-statistics: yes supports-test: yes supports-eeprom-access: yes supports-register-dump: yes supports-priv-flags: yes
$ devlink dev info pci/0000:3b:00.0
pci/0000:3b:00.0:
driver ice
serial number 00-01-ab-ff-ff-ca-05-68
versions:
running:
fw.mgmt 2.1.7
fw.mgmt.api 1.5
fw.mgmt.build 0x305d955f
fw.undi 1.2581.0
fw.psid.api 0.80
fw.bundle_id 0x80002ec0
fw.app.name ICE OS Default Package
fw.app 1.3.1.0More pieces of information can be displayed, each version is kept separate instead of munged together, and each version has an identifier which comes with associated documentation.
--- Documentation/networking/devlink/ice.rst | 67 +++++++ Documentation/networking/devlink/index.rst | 1 + drivers/net/ethernet/intel/ice/ice_devlink.c | 189 +++++++++++++++++++ 3 files changed, 257 insertions(+) create mode 100644 Documentation/networking/devlink/ice.rst
Documentation/networking/devlink/ice.rst new file +67 -0
@@ -0,0 +1,67 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=================== +ice devlink support +=================== + +This document describes the devlink features implemented by the ``ice`` +device driver. + +Info versions +============= + +The ``ice`` driver reports the following versions + +.. list-table:: devlink info versions implemented + :widths: 5 5 5 90 + + * - Name + - Type + - Example + - Description + * - ``fw.mgmt`` + - running + - 2.1.7 + - 3-digit version number of the management firmware that controls the + PHY, link, etc. + * - ``fw.mgmt.api`` + - running + - 1.5 + - 2-digit version number of the API exported over the AdminQ by the + management firmware. Used by the driver to identify what commands + are supported. + * - ``fw.mgmt.build`` + - running + - 0x305d955f + - Unique identifier of the source for the management firmware. + * - ``fw.undi`` + - running + - 1.2581.0 + - Version of the Option ROM containing the UEFI driver. The version is + reported in ``major.minor.patch`` format. The major version is + incremented whenever a major breaking change occurs, or when the + minor version would overflow. The minor version is incremented for + non-breaking changes and reset to 1 when the major version is + incremented. The patch version is normally 0 but is incremented when + a fix is delivered as a patch against an older base Option ROM. + * - ``fw.psid.api`` + - running + - 0.80 + - Version defining the format of the flash contents. + * - ``fw.bundle_id`` + - running + - 0x80002ec0 + - Unique identifier of the firmware image file that was loaded onto + the device. Also referred to as the EETRACK identifier of the NVM. + * - ``fw.app.name`` + - running + - ICE OS Default Package + - The name of the DDP package that is active in the device. The DDP + package is loaded by the driver during initialization. Each varation + of DDP package shall have a unique name. + * - ``fw.app`` + - running + - 1.3.1.0 + - The version of the DDP package that is active in the device. Note + that both the name (as reported by ``fw.app.name``) and version are + required to uniquely identify the package.
Documentation/networking/devlink/index.rst +1 -0
@@ -32,6 +32,7 @@ parameters, info versions, and other features it supports. bnxt ionic + ice mlx4 mlx5 mlxsw
drivers/net/ethernet/intel/ice/ice_devlink.c +189 -0
198 lines not on this page · raw message
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH v3 8/9 ice: add basic handler for devlink .info_get
Quoted 4 lines · On Wed, 11 Mar 2020 18:58:17 -0700 Jacob Keller wrote:
The devlink .info_get callback allows the driver to report detailed version information. The following devlink versions are reported with this initial implementation:
Quoted 8 lines
"fw.mgmt" -> The version of the firmware that controls PHY, link, etc "fw.mgmt.api" -> API version of interface exposed over the AdminQ "fw.mgmt.build" -> Unique build id of the source for the management fw "fw.undi" -> Version of the Option ROM containing the UEFI driver "fw.psid.api" -> Version of the NVM image format. "fw.bundle_id" -> Unique identifier for the combined flash image. "fw.app.name" -> The name of the active DDP package. "fw.app" -> The version of the active DDP package.
Bowers
PATCH v3 8/9 ice: add basic handler for devlink .info_get
In reply to Jacob Keller-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 8/9] ice: add basic handler for devlink .info_get
The devlink .info_get callback allows the driver to report detailed version information. The following devlink versions are reported with this initial implementation:
"fw.mgmt" -> The version of the firmware that controls PHY, link, etc "fw.mgmt.api" -> API version of interface exposed over the AdminQ "fw.mgmt.build" -> Unique build id of the source for the management fw "fw.undi" -> Version of the Option ROM containing the UEFI driver "fw.psid.api" -> Version of the NVM image format. "fw.bundle_id" -> Unique identifier for the combined flash image.
"fw.app.name" -> The name of the active DDP package.
"fw.app" -> The version of the active DDP package.
With this, devlink dev info can report at least as much information as is reported by ETHTOOL_GDRVINFO.
Compare the output from ethtool vs from devlink:
$ ethtool -i ens785s0 driver: ice version: 0.8.1-k firmware-version: 0.80 0x80002ec0 1.2581.0 expansion-rom-version: bus-info: 0000:3b:00.0 supports-statistics: yes supports-test: yes supports-eeprom-access: yes supports-register-dump: yes supports-priv-flags: yes
$ devlink dev info pci/0000:3b:00.0
pci/0000:3b:00.0:
driver ice
serial number 00-01-ab-ff-ff-ca-05-68
versions:
running:
fw.mgmt 2.1.7
fw.mgmt.api 1.5
fw.mgmt.build 0x305d955f
fw.undi 1.2581.0
fw.psid.api 0.80
fw.bundle_id 0x80002ec0
fw.app.name ICE OS Default Package
fw.app 1.3.1.0More pieces of information can be displayed, each version is kept separate instead of munged together, and each version has an identifier which comes with associated documentation.
--- Documentation/networking/devlink/ice.rst | 67 +++++++ Documentation/networking/devlink/index.rst | 1 + drivers/net/ethernet/intel/ice/ice_devlink.c | 189 +++++++++++++++++++ 3 files changed, 257 insertions(+) create mode 100644 Documentation/networking/devlink/ice.rst
PATCH v3 9/9 ice: add board identifier info to devlink .info_get
In reply to Jacob KellerExport a unique board identifier using "board.id" for devlink's .info_get command.
Obtain this by reading the NVM for the PBA identification string.
--- Documentation/networking/devlink/ice.rst | 4 + drivers/net/ethernet/intel/ice/ice_common.c | 66 ---------- drivers/net/ethernet/intel/ice/ice_common.h | 3 - drivers/net/ethernet/intel/ice/ice_devlink.c | 16 ++- drivers/net/ethernet/intel/ice/ice_nvm.c | 125 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_nvm.h | 5 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + 7 files changed, 150 insertions(+), 70 deletions(-)
Documentation/networking/devlink/ice.rst +4 -0
@@ -19,6 +19,10 @@ The ``ice`` driver reports the following versions - Type - Example - Description + * - ``board.id`` + - fixed + - K65390-000 + - The Product Board Assembly (PBA) identifier of the board. * - ``fw.mgmt`` - running - 2.1.7
drivers/net/ethernet/intel/ice/ice_common.c +0 -66
72 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_common.h +0 -3
@@ -15,9 +15,6 @@ 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_get_pfa_module_tlv (struct ice_hw *hw,u16 *module_tlv,u16 *module_tlv_len, -u16 module_type);enum ice_status ice_check_reset (struct ice_hw *hw);enum ice_status ice_reset (struct ice_hw *hw,enum ice_reset_req req);enum ice_status ice_create_all_ctrlq (struct ice_hw *hw);
drivers/net/ethernet/intel/ice/ice_devlink.c +15 -1
@@ -19,6 +19,18 @@ static int ice_info_get_dsn(struct ice_pf *pf, char *buf, size_t len)return 0 ; } +static int ice_info_pba (struct ice_pf *pf,char *buf,size_t len) +{ +struct ice_hw *hw = &pf->hw; +enum ice_status status; + + status =ice_read_pba_string (hw, (u8 *)buf, len); +if (status) +return -EIO ; + +return 0 ; +} +static int ice_info_fw_mgmt (struct ice_pf *pf,char *buf,size_t len) {struct ice_hw *hw = &pf->hw;
@@ -93,6 +105,7 @@ static int ice_info_ddp_pkg_version(struct ice_pf *pf, char *buf, size_t len)return 0 ; } +#define fixed (key, getter) { ICE_VERSION_FIXED, key, getter }#define running (key, getter) { ICE_VERSION_RUNNING, key, getter }enum ice_version_type {
@@ -106,6 +119,7 @@ static const struct ice_devlink_version {const char *key;int (*getter)(struct ice_pf *pf,char *buf,size_t len); } ice_devlink_versions[] = { +fixed (DEVLINK_INFO_VERSION_GENERIC_BOARD_ID , ice_info_pba),running (DEVLINK_INFO_VERSION_GENERIC_FW_MGMT , ice_info_fw_mgmt),running ("fw.mgmt.api" , ice_info_fw_api), running("fw.mgmt.build", ice_info_fw_build),
@@ -125,7 +139,7 @@ static const struct ice_devlink_version {* Callback for the devlink .info_get operation. Reports information about the * device. * -* @returns zero on success or an error code on failure. +* Return: zero on success or an error code on failure. */ static int ice_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
drivers/net/ethernet/intel/ice/ice_nvm.c +125 -0
131 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.h +5 -0
@@ -10,6 +10,11 @@ void ice_release_nvm(struct ice_hw *hw);enum ice_status ice_read_flat_nvm (struct ice_hw *hw,u32 offset,u32 *length,u8 *data,bool read_shadow_ram); +enum ice_status +ice_get_pfa_module_tlv (struct ice_hw *hw,u16 *module_tlv,u16 *module_tlv_len, +u16 module_type); +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);#endif /* _ICE_NVM_H_ */
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
@@ -643,6 +643,7 @@ struct ice_hw_port_stats {/* Checksum and Shadow RAM pointers */ #define ICE_SR_BOOT_CFG_PTR 0x132#define ICE_NVM_OROM_VER_OFF 0x02 +#define ICE_SR_PBA_BLOCK_PTR 0x16#define ICE_SR_NVM_DEV_STARTER_VER 0x18#define ICE_SR_NVM_EETRACK_LO 0x2D#define ICE_SR_NVM_EETRACK_HI 0x2E
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerPATCH v3 9/9 ice: add board identifier info to devlink .info_get
Quoted 7 lines · On Wed, 11 Mar 2020 18:58:18 -0700 Jacob Keller wrote:
Export a unique board identifier using "board.id" for devlink's .info_get command.
Obtain this by reading the NVM for the PBA identification string.
Signed-off-by Jacob Keller <[email protected]>Reviewed-by Jesse Brandeburg <[email protected]>
Bowers
PATCH v3 9/9 ice: add board identifier info to devlink .info_get
In reply to Jacob Keller-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Wednesday, March 11, 2020 6:58 PM
To: Intel Wired LAN <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 9/9] ice: add board identifier info to devlink .info_get
Export a unique board identifier using "board.id" for devlink's .info_get command.
Obtain this by reading the NVM for the PBA identification string.
--- Documentation/networking/devlink/ice.rst | 4 + drivers/net/ethernet/intel/ice/ice_common.c | 66 ---------- drivers/net/ethernet/intel/ice/ice_common.h | 3 - drivers/net/ethernet/intel/ice/ice_devlink.c | 16 ++- drivers/net/ethernet/intel/ice/ice_nvm.c | 125 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_nvm.h | 5 + drivers/net/ethernet/intel/ice/ice_type.h | 1 + 7 files changed, 150 insertions(+), 70 deletions(-)