Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ice: add CGU info to devlink info callback

If Clock Generation Unit is present on NIC board user shall know its
details.
Provide the devlink info callback with a new:
- fixed type object (cgu.id) indicating hardware variant of onboard CGU,
- running type object (fw.cgu) consisting of CGU id, config and firmware
versions.
These information shall be known for debugging purposes.

Test (on NIC board with CGU)
$ devlink dev info <bus_name>/<dev_name> | grep cgu
cgu.id 36
fw.cgu 8032.16973825.6021

Test (on NIC board without CGU)
$ devlink dev info <bus_name>/<dev_name> | grep cgu -c
0

Reviewed-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Arkadiusz Kubalewski and committed by
Paolo Abeni
b86455a1 4da71a77

+29
+9
Documentation/networking/devlink/ice.rst
··· 38 38 - fixed 39 39 - K65390-000 40 40 - The Product Board Assembly (PBA) identifier of the board. 41 + * - ``cgu.id`` 42 + - fixed 43 + - 36 44 + - The Clock Generation Unit (CGU) hardware revision identifier. 41 45 * - ``fw.mgmt`` 42 46 - running 43 47 - 2.1.7 ··· 108 104 - running 109 105 - 0xee16ced7 110 106 - The first 4 bytes of the hash of the netlist module contents. 107 + * - ``fw.cgu`` 108 + - running 109 + - 8032.16973825.6021 110 + - The version of Clock Generation Unit (CGU). Format: 111 + <CGU type>.<configuration version>.<firmware version>. 111 112 112 113 Flash Update 113 114 ============
+20
drivers/net/ethernet/intel/ice/ice_devlink.c
··· 193 193 snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", netlist->hash); 194 194 } 195 195 196 + static void ice_info_cgu_fw_build(struct ice_pf *pf, struct ice_info_ctx *ctx) 197 + { 198 + u32 id, cfg_ver, fw_ver; 199 + 200 + if (!ice_is_feature_supported(pf, ICE_F_CGU)) 201 + return; 202 + if (ice_aq_get_cgu_info(&pf->hw, &id, &cfg_ver, &fw_ver)) 203 + return; 204 + snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", id, cfg_ver, fw_ver); 205 + } 206 + 207 + static void ice_info_cgu_id(struct ice_pf *pf, struct ice_info_ctx *ctx) 208 + { 209 + if (!ice_is_feature_supported(pf, ICE_F_CGU)) 210 + return; 211 + snprintf(ctx->buf, sizeof(ctx->buf), "%u", pf->hw.cgu_part_number); 212 + } 213 + 196 214 #define fixed(key, getter) { ICE_VERSION_FIXED, key, getter, NULL } 197 215 #define running(key, getter) { ICE_VERSION_RUNNING, key, getter, NULL } 198 216 #define stored(key, getter, fallback) { ICE_VERSION_STORED, key, getter, fallback } ··· 253 235 running("fw.app.bundle_id", ice_info_ddp_pkg_bundle_id), 254 236 combined("fw.netlist", ice_info_netlist_ver, ice_info_pending_netlist_ver), 255 237 combined("fw.netlist.build", ice_info_netlist_build, ice_info_pending_netlist_build), 238 + fixed("cgu.id", ice_info_cgu_id), 239 + running("fw.cgu", ice_info_cgu_fw_build), 256 240 }; 257 241 258 242 /**