Skip to content

Commit

Permalink
[Mellanox] Upgrade HW-MGMT to 7.0030.2008 and update platform-api (#1…
Browse files Browse the repository at this point in the history
…7134)

Why I did it
Add platform support for Debian 12 (Bookworm) on Mellanox Platform

How I did it
Update hw-management to v7.0030.2008
Deprecate the sfp_count == module_count approach in favour of asic init completion
Ref: Mellanox/hw-mgmt@bf4f593
Add xxd package to base image which is required by hw-management scripts
Add the non-upstream flag into linux kernel cache options
Update the thermalctl logic based on new sysfs attributes
Fix the integrate-mlnx-hw-mgmt script to not populate the arm64 Kconfig
How to verify it
Build kernel and run platform tests

Signed-off-by: Vivek Reddy <[email protected]>
Co-authored-by: Junchao-Mellanox <[email protected]>
Co-authored-by: Junchao-Mellanox <[email protected]>
  • Loading branch information
3 people authored and yxieca committed Nov 22, 2023
1 parent bd3572e commit 787dd72
Show file tree
Hide file tree
Showing 204 changed files with 2,253 additions and 44,844 deletions.
1 change: 1 addition & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
resolvconf \
lsof \
sysstat \
xxd \
zstd

# Have systemd create the auditd log directory
Expand Down
33 changes: 16 additions & 17 deletions device/mellanox/x86_64-mlnx_msn2700-r0/platform_wait
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ declare -r SYSLOG_INFO="info"

declare -r HW_MGMT_CONFIG="/var/run/hw-management/config"

declare -r MODULE_COUNTER="${HW_MGMT_CONFIG}/module_counter"
declare -r SFP_COUNTER="${HW_MGMT_CONFIG}/sfp_counter"
declare -r ASIC_INIT_DONE="${HW_MGMT_CONFIG}/asics_init_done"
declare -r NUM_ASICS="${HW_MGMT_CONFIG}/asic_num"
declare -r ASIC_CHIPUP_COMPLETED="${HW_MGMT_CONFIG}/asic_chipup_completed"

declare -r EXIT_SUCCESS="0"
declare -r EXIT_TIMEOUT="1"
Expand All @@ -26,44 +27,42 @@ function log_info() {
eval "${SYSLOG_LOGGER} -t ${SYSLOG_IDENTIFIER} -p ${SYSLOG_INFO} $@"
}

function wait_for_sfp() {
local -r _NUM_MATCH="^[0-9]+$"
local -r _NUM_ZERO="0"
function wait_for_asic_chipup() {

local _MODULE_CNT="0"
local _SFP_CNT="0"
local _ASIC_INIT="0"
local _ASIC_COUNT="0"
local _ASICS_CHIPUP="0"

local -i _WDOG_CNT="1"
local -ir _WDOG_MAX="300"

local -r _TIMEOUT="1s"

while [[ "${_WDOG_CNT}" -le "${_WDOG_MAX}" ]]; do
_MODULE_CNT="$(cat ${MODULE_COUNTER} 2>&1)"
_SFP_CNT="$(cat ${SFP_COUNTER} 2>&1)"
_ASIC_INIT="$(cat ${ASIC_INIT_DONE} 2>&1)"
_ASIC_COUNT="$(cat ${NUM_ASICS} 2>&1)"
_ASICS_CHIPUP="$(cat ${ASIC_CHIPUP_COMPLETED} 2>&1)"

if [[ "${_MODULE_CNT}" =~ ${_NUM_MATCH} && "${_SFP_CNT}" =~ ${_NUM_MATCH} ]]; then
if [[ "${_SFP_CNT}" -gt "${_NUM_ZERO}" && "${_MODULE_CNT}" -eq "${_SFP_CNT}" ]]; then
return "${EXIT_SUCCESS}"
fi
if [[ "${_ASIC_INIT}" -eq 1 && "${_ASIC_COUNT}" -eq "${_ASICS_CHIPUP}" ]]; then
return "${EXIT_SUCCESS}"
fi

let "_WDOG_CNT++"
sleep "${_TIMEOUT}"
done

log_error "Mellanox ASIC is not ready: INIT: ${_ASIC_INIT}, NUM_ASIC: ${_ASIC_COUNT}, CHIPUP: ${_ASICS_CHIPUP} timeout...."
return "${EXIT_TIMEOUT}"
}

log_info "Wait for SFP interfaces to be ready"
log_info "Wait for Mellanox ASIC to be ready"

wait_for_sfp
wait_for_asic_chipup
EXIT_CODE="$?"
if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then
log_error "SFP interfaces are not ready: timeout"
exit "${EXIT_CODE}"
fi

log_info "SFP interfaces are ready"
log_notice "Mellanox ASIC is ready"

exit "${EXIT_SUCCESS}"
2 changes: 1 addition & 1 deletion platform/mellanox/hw-management.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# Mellanox HW Management

MLNX_HW_MANAGEMENT_VERSION = 7.0030.1011
MLNX_HW_MANAGEMENT_VERSION = 7.0030.2008

export MLNX_HW_MANAGEMENT_VERSION

Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/hw-management/hw-mgmt
Submodule hw-mgmt updated 266 files
198 changes: 31 additions & 167 deletions platform/mellanox/hw-management/hwmgmt_nonup_patches
Original file line number Diff line number Diff line change
@@ -1,169 +1,33 @@
# Current non-upstream patch list, should be updated by hwmgmt_kernel_patches.py script
0049-leds-mlxreg-Provide-conversion-for-hardware-LED-colo.patch
0042-hwmon-mlxreg-fan-Add-support-for-new-flavour-of-capa.patch
0044-leds-mlxreg-Add-support-for-new-flavour-of-capabilit.patch
0045-leds-mlxreg-Remove-code-for-amber-LED-colour.patch
0046-Extend-driver-to-support-Infineon-Digital-Multi-phas.patch
0047-dt-bindings-trivial-devices-Add-infineon-xdpe1a2g7.patch
0048-hwmon-pmbus-Add-support-for-MPS-Multi-phase-mp2891-c.patch
0049-dt-bindings-trivial-devices-Add-mps-mp2891.patch
0050-leds-mlxreg-Skip-setting-LED-color-during-initializa.patch
0051-leds-mlxreg-Allow-multi-instantiation-of-same-name-L.patch
0098-1-Revert-mlxsw-Use-u16-for-local_port-field.patch
0098-2-Revert-mlxsw-i2c-Fix-chunk-size-setting.patch
0098-3-Revert-mlxsw-core_hwmon-Adjust-module-label-names.patch
0099-mlxsw-core_hwmon-Fix-variable-names-for-hwmon-attrib.patch
0100-mlxsw-core_thermal-Rename-labels-according-to-naming.patch
0101-mlxsw-core_thermal-Remove-obsolete-API-for-query-res.patch
0102-mlxsw-reg-Add-mgpir_-prefix-to-MGPIR-fields-comments.patch
0103-mlxsw-core-Remove-unnecessary-asserts.patch
0104-mlxsw-reg-Extend-MTMP-register-with-new-slot-number-.patch
0105-mlxsw-reg-Extend-MTBR-register-with-new-slot-number-.patch
0106-mlxsw-reg-Extend-MCIA-register-with-new-slot-number-.patch
0107-mlxsw-reg-Extend-MCION-register-with-new-slot-number.patch
0108-mlxsw-reg-Extend-PMMP-register-with-new-slot-number-.patch
0109-mlxsw-reg-Extend-MGPIR-register-with-new-slot-fields.patch
0110-mlxsw-core_env-Pass-slot-index-during-PMAOS-register.patch
0111-mlxsw-reg-Add-new-field-to-Management-General-Periph.patch
0112-mlxsw-core-Extend-interfaces-for-cable-info-access-w.patch
0113-mlxsw-core-Extend-port-module-data-structures-for-li.patch
0114-mlxsw-core-Move-port-module-events-enablement-to-a-s.patch
0115-mlxsw-core_hwmon-Split-gearbox-initialization.patch
0116-mlxsw-core_hwmon-Extend-internal-structures-to-suppo.patch
0117-mlxsw-core_hwmon-Introduce-slot-parameter-in-hwmon-i.patch
0118-mlxsw-core_hwmon-Extend-hwmon-device-with-gearbox-ma.patch
0119-mlxsw-core_thermal-Extend-internal-structures-to-sup.patch
0120-mlxsw-core_thermal-Split-gearbox-initialization.patch
0121-mlxsw-core_thermal-Extend-thermal-area-with-gearbox-.patch
0122-mlxsw-core_thermal-Add-line-card-id-prefix-to-line-c.patch
0123-mlxsw-core_thermal-Use-exact-name-of-cooling-devices.patch
0124-mlxsw-core_thermal-Use-common-define-for-thermal-zon.patch
0125-devlink-add-support-to-create-line-card-and-expose-t.patch
0126-devlink-implement-line-card-provisioning.patch
0127-devlink-implement-line-card-active-state.patch
0128-devlink-add-port-to-line-card-relationship-set.patch
0129-devlink-introduce-linecard-info-get-message.patch
0130-devlink-introduce-linecard-info-get-message.patch
0131-mlxsw-reg-Add-Ports-Mapping-event-Configuration-Regi.patch
0132-mlxsw-reg-Add-Management-DownStream-Device-Query-Reg.patch
0133-mlxsw-reg-Add-Management-DownStream-Device-Control-R.patch
0134-mlxsw-reg-Add-Management-Binary-Code-Transfer-Regist.patch
0135-mlxsw-core_linecards-Add-line-card-objects-and-imple.patch
0136-mlxsw-core_linecards-Implement-line-card-activation-.patch
0137-mlxsw-core-Extend-driver-ops-by-remove-selected-port.patch
0138-mlxsw-spectrum-Add-port-to-linecard-mapping.patch
0139-mlxsw-reg-Introduce-Management-Temperature-Extended-.patch
0140-mlxsw-core-Add-APIs-for-thermal-sensor-mapping.patch
0141-mlxsw-reg-Add-Management-DownStream-Device-Tunneling.patch
0142-mlxsw-core_linecards-Probe-devices-for-provisioned-l.patch
0143-mlxsw-core_linecards-Expose-device-FW-version-over-d.patch
0144-mlxsw-core-Introduce-flash-update-components.patch
0145-mlxfw-Get-the-PSID-value-using-op-instead-of-passing.patch
0146-mlxsw-core_linecards-Implement-line-card-device-flas.patch
0147-mlxsw-core_linecards-Introduce-ops-for-linecards-sta.patch
0148-mlxsw-core-Add-interfaces-for-line-card-initializati.patch
0149-mlxsw-core_thermal-Add-interfaces-for-line-card-init.patch
0150-mlxsw-core_hwmon-Add-interfaces-for-line-card-initia.patch
0151-mlxsw-minimal-Prepare-driver-for-modular-system-supp.patch
0152-mlxsw-core-Extend-bus-init-function-with-event-handl.patch
0153-mlxsw-i2c-Add-support-for-system-events-handling.patch
0154-mlxsw-core-Export-line-card-API.patch
0155-mlxsw-minimal-Add-system-event-handler.patch
0156-mlxsw-minimal-Add-interfaces-for-line-card-initializ.patch
0167-DS-lan743x-Add-support-for-fixed-phy.patch
0168-TMP-mlxsw-minimal-Ignore-error-reading-SPAD-register.patch
0171-platform-mellanox-mlxreg-lc-Fix-cleanup-on-failure-a.patch
0172-DS-platform-mlx-platform-Add-SPI-path-for-rack-switc.patch
0174-DS-mlxsw-core_linecards-Skip-devlink-and-provisionin.patch
0181-Revert-Fix-out-of-bounds-memory-accesses-in-thermal.patch
0182-platform-mellanox-Introduce-support-of-new-Nvidia-L1.patch
0183-platform-mellanox-Split-initialization-procedure.patch
0184-platform-mellanox-Split-logic-in-init-and-exit-flow.patch
0185-platform-mellanox-Extend-all-systems-with-I2C-notifi.patch
0187-platform_data-mlxreg-Add-field-with-mapped-resource-.patch
0188-i2c-mux-Add-register-map-based-mux-driver.patch
0189-i2c-mlxcpld-Allow-driver-to-run-on-ARM64-architectur.patch
0190-i2c-mlxcpld-Modify-base-address-type.patch
0191-i2c-mlxcpld-Allow-to-configure-base-address-of-regis.patch
0192-i2c-mlxcpld-Add-support-for-extended-transaction-len.patch
0193-platform-mellanox-mlx-platform-Add-mux-selection-reg.patch
0194-platform-mellanox-mlx-platform-Move-bus-shift-assign.patch
0195-platform-mellanox-Add-support-for-dynamic-I2C-channe.patch
0196-platform-mellanox-Relocate-mlx-platform-driver.patch
0197-platform-mellanox-Add-initial-support-for-PCIe-based.patch
0198-platform-mellanox-Introduce-support-for-switches-bas.patch
0199-platform-mellanox-mlx-platform-Add-reset-and-extend-.patch
0200-dt-bindings-i2c-mellanox-i2c-mlxbf-convert-txt-to-YA.patch
0203-i2c-mlxbf-remove-IRQF_ONESHOT.patch
0206-i2c-mlxbf-add-multi-slave-functionality.patch
0207-i2c-mlxbf-support-BlueField-3-SoC.patch
0208-i2c-mlxbf-remove-device-tree-support.patch
0209-UBUNTU-SAUCE-i2c-mlxbf.c-Add-driver-version.patch
0210-platform-mellanox-Typo-fix-in-the-file-mlxbf-bootctl.patch
0211-UBUNTU-SAUCE-platform-mellanox-Updates-to-mlxbf-boot.patch
0212-platform-mellanox-mlxbf-pmc-Add-Mellanox-BlueField-P.patch
0213-platform-mellanox-mlxbf-pmc-fix-kernel-doc-notation.patch
0214-platform-mellanox-mlxbf-pmc-Fix-an-IS_ERR-vs-NULL-bu.patch
0215-UBUNTU-SAUCE-platform-mellanox-Updates-to-mlxbf-pmc.patch
0216-UBUNTU-SAUCE-mlxbf_pmc-Fix-references-to-sprintf.patch
0217-UBUNTU-SAUCE-mlxbf-pmc-Fix-error-when-reading-unprog.patch
0218-UBUNTU-SAUCE-platform-mellanox-Add-mlx-trio-driver.patch
0219-UBUNTU-SAUCE-platform-mellanox-mlxbf-tmfifo-Add-Blue.patch
0220-UBUNTU-SAUCE-pka-Add-pka-driver.patch
0221-UBUNTU-SAUCE-platform-mellanox-Add-mlxbf-livefish-dr.patch
0222-workqueue-Add-resource-managed-version-of-delayed-wo.patch
0223-devm-helpers-Fix-devm_delayed_work_autocancel-kernel.patch
0224-devm-helpers-Add-resource-managed-version-of-work-in.patch
0225-UBUNTU-SAUCE-Add-support-to-pwr-mlxbf.c-driver.patch
0226-Add-Mellanox-BlueField-Gigabit-Ethernet-driver.patch
0227-mlxbf_gige-clear-valid_polarity-upon-open.patch
0228-net-mellanox-mlxbf_gige-Replace-non-standard-interru.patch
0229-mlxbf_gige-increase-MDIO-polling-rate-to-5us.patch
0230-mlxbf_gige-remove-driver-managed-interrupt-counts.patch
0231-mlxbf_gige-remove-own-module-name-define-and-use-KBU.patch
0232-UBUNTU-SAUCE-mlxbf_gige-add-ethtool-mlxbf_gige_set_r.patch
0233-UBUNTU-SAUCE-Fix-OOB-handling-RX-packets-in-heavy-tr.patch
0234-UBUNTU-SAUCE-mlxbf_gige-add-validation-of-ACPI-table.patch
0235-UBUNTU-SAUCE-mlxbf_gige-set-driver-version-to-1.27.patch
0236-UBUNTU-SAUCE-mlxbf_gige-clear-MDIO-gateway-lock-afte.patch
0237-mlxbf_gige-compute-MDIO-period-based-on-i1clk.patch
0238-net-mlxbf_gige-Fix-an-IS_ERR-vs-NULL-bug-in-mlxbf_gi.patch
0239-UBUNTU-SAUCE-mlxbf_gige-add-MDIO-support-for-BlueFie.patch
0240-UBUNTU-SAUCE-mlxbf_gige-support-10M-100M-1G-speeds-o.patch
0241-UBUNTU-SAUCE-mlxbf_gige-add-BlueField-3-Serdes-confi.patch
0242-UBUNTU-SAUCE-mlxbf_gige-add-BlueField-3-ethtool_ops.patch
0243-UBUNTU-SAUCE-bluefield_edac-Add-SMC-support.patch
0244-UBUNTU-SAUCE-bluefield_edac-Update-license-and-copyr.patch
0245-gpio-mlxbf2-Convert-to-device-PM-ops.patch
0246-gpio-mlxbf2-Drop-wrong-use-of-ACPI_PTR.patch
0247-gpio-mlxbf2-Use-devm_platform_ioremap_resource.patch
0248-gpio-mlxbf2-Use-DEFINE_RES_MEM_NAMED-helper-macro.patch
0249-gpio-mlxbf2-Introduce-IRQ-support.patch
0250-UBUNTU-SAUCE-gpio-mlxbf2.c-support-driver-version.patch
0251-mmc-sdhci-of-dwcmshc-add-rockchip-platform-support.patch
0252-mmc-sdhci-of-dwcmshc-add-ACPI-support-for-BlueField-.patch
0253-mmc-sdhci-of-dwcmshc-fix-error-return-code-in-dwcmsh.patch
0254-mmc-sdhci-of-dwcmshc-set-MMC_CAP_WAIT_WHILE_BUSY.patch
0255-mmc-sdhci-of-dwcmshc-Re-enable-support-for-the-BlueF.patch
0256-UBUNTU-SAUCE-Support-BlueField-3-GPIO-driver.patch
0257-regmap-debugfs-Enable-writing-to-the-regmap-debugfs-.patch
0258-UBUNTU-SAUCE-mlx-bootctl-support-icm-carveout-eeprom.patch
0259-mmc-sdhci-of-dwcmshc-Enable-host-V4-support-for-Blue.patch
0260-UBUNTU-SAUCE-mlxbf-pka-Fix-kernel-crash-with-pka-TRN.patch
0261-mlxbf-ptm-power-and-thermal-management-debugfs-drive.patch
0262-UBUNTU-SAUCE-mlxbf-pmc-Fix-event-string-typo.patch
0263-UBUNTU-SAUCE-mlxbf-pmc-Support-for-BlueField-3-perfo.patch
0264-UBUNTU-SAUCE-platform-mellanox-Add-ctrl-message-and-.patch
0266-UBUNTU-SAUCE-mlxbf-pmc-Bug-fix-for-BlueField-3-count.patch
0267-UBUNTU-SAUCE-mmc-sdhci-of-dwcmshc-add-the-missing-de.patch
0268-DS-mlxsw-core_linecards-Disable-firmware-bundling-ma.patch
0269-platform-mellanox-Cosmetic-changes.patch
0270-platform-mellanox-Fix-order-in-exit-flow.patch
0271-platform-mellanox-Add-new-attributes.patch
0272-platform-mellanox-Change-register-offset-addresses.patch
0273-platform-mellanox-Add-field-upgrade-capability-regis.patch
0274-platform-mellanox-Modify-reset-causes-description.patch
0275-mlxsw-Use-u16-for-local_port-field-instead-of-u8.patch
0276-mlxsw-minimal-Change-type-for-local-port.patch
0277-mlxsw-i2c-Fix-chunk-size-setting-in-output-mailbox-b.patch
0278-platform-mellanox-mlx-platform-Modify-graceful-shutd.patch
0279-platform-mellanox-mlx-platform-Fix-signals-polarity-.patch
0280-platform-mellanox-mlxreg-hotplug-Extend-condition-fo.patch
0281-platform-mellanox-mlx-platform-Modify-health-and-pow.patch
0282-platform-mellanox-mlx-platform-add-support-of-5th-CP.patch
0283-mlxsw-core_hwmon-Align-modules-label-name-assignment.patch
0284-platform-mellanox-mlx-platform-fix-CPLD4-PN-report.patch
9002-TMP-fix-for-fan-minimum-speed.patch
0053-platform-mellanox-Add-support-for-dynamic-I2C-channe.patch
0054-platform-mellanox-Introduce-support-for-switches-equ.patch
0055-mellanox-Relocate-mlx-platform-driver.patch
0066-UBUNTU-SAUCE-sdhci-of-dwcmshc-Enable-host-V4-support.patch
0067-UBUNTU-SAUCE-mmc-sdhci-of-dwcmshc-add-the-missing-de.patch
0068-UBUNTU-SAUCE-mmc-sdhci-of-dwcmshc-Add-runtime-PM-ope.patch
0069-UBUNTU-SAUCE-mlxbf_gige-add-ethtool-mlxbf_gige_set_r.patch
0070-UBUNTU-SAUCE-Fix-OOB-handling-RX-packets-in-heavy-tr.patch
0071-UBUNTU-SAUCE-mlxbf-gige-Fix-intermittent-no-ip-issue.patch
0072-mlxbf_gige-add-MDIO-support-for-BlueField-3.patch
0073-mlxbf_gige-support-10M-100M-1G-speeds-on-BlueField-3.patch
0074-mlxbf_gige-add-set_link_ksettings-ethtool-callback.patch
0075-UBUNTU-SAUCE-mlxbf-gige-Fix-kernel-panic-at-shutdown.patch
0076-UBUNTU-SAUCE-platform-mellanox-Updates-to-mlxbf-boot.patch
0077-UBUNTU-SAUCE-mlx-bootctl-support-icm-carveout-eeprom.patch
0078-UBUNTU-SAUCE-mlxbf-bootctl-support-SMC-call-for-sett.patch
0079-UBUNTU-SAUCE-mlxbf-ptm-power-and-thermal-management-.patch
0080-UBUNTU-SAUCE-mlxbf-ptm-update-license.patch
0081-UBUNTU-SAUCE-mlxbf-ptm-use-0444-instead-of-S_IRUGO.patch
0082-UBUNTU-SAUCE-mlxbf-ptm-add-atx-debugfs-nodes.patch
0083-UBUNTU-SAUCE-mlxbf-ptm-update-module-version.patch
0084-UBUNTU-SAUCE-mlxbf-bootctl-Fix-kernel-panic-due-to-b.patch
8000-mlxsw-Use-weak-reverse-dependencies-for-firmware-fla.patch
8004-mlxsw-minimal-Downstream-Ignore-error-reading-SPAD-r.patch
19 changes: 10 additions & 9 deletions platform/mellanox/integration-scripts.mk
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ endif
--kernel_version $(KERNEL_VERSION) \
--hw_mgmt_ver ${MLNX_HW_MANAGEMENT_VERSION} $(LOG_SIMPLE)

$(BUILD_WORKDIR)/$($(MLNX_HW_MANAGEMENT)_SRC_PATH)/hw-mgmt/recipes-kernel/linux/deploy_kernel_patches.py \
--dst_accepted_folder $(PTCH_DIR) \
--dst_candidate_folder $(NON_UP_PTCH_DIR) \
--series_file $(PTCH_LIST) \
--config_file $(KCFG_LIST_ARM) \
--config_file_downstream $(KCFG_DOWN_LIST_ARM) \
--kernel_version $(KERNEL_VERSION) \
--arch arm64 \
--os_type sonic $(LOG_SIMPLE)
# Disable Writing KConfigs for arm64 platform
# $(BUILD_WORKDIR)/$($(MLNX_HW_MANAGEMENT)_SRC_PATH)/hw-mgmt/recipes-kernel/linux/deploy_kernel_patches.py \
# --dst_accepted_folder $(PTCH_DIR) \
# --dst_candidate_folder $(NON_UP_PTCH_DIR) \
# --series_file $(PTCH_LIST) \
# --config_file $(KCFG_LIST_ARM) \
# --config_file_downstream $(KCFG_DOWN_LIST_ARM) \
# --kernel_version $(KERNEL_VERSION) \
# --arch arm64 \
# --os_type sonic $(LOG_SIMPLE)

$(BUILD_WORKDIR)/$($(MLNX_HW_MANAGEMENT)_SRC_PATH)/hw-mgmt/recipes-kernel/linux/deploy_kernel_patches.py \
--dst_accepted_folder $(PTCH_DIR) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def is_psu_hotswapable(cls):
@classmethod
@utils.read_only_cache()
def get_sfp_count(cls):
return utils.read_int_from_file('/run/hw-management/config/sfp_counter')
return utils.read_int_from_file('/run/hw-management/config/module_counter')

@classmethod
def get_linecard_sfp_count(cls, lc_index):
Expand Down
5 changes: 4 additions & 1 deletion platform/mellanox/mlnx-platform-api/sonic_platform/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ def get_target_speed(self):
"""
try:
# Get PSU fan target speed according to current system cooling level
cooling_level = utils.read_int_from_file('/run/hw-management/thermal/cooling_cur_state', log_func=None)
pwm = utils.read_int_from_file('/run/hw-management/thermal/pwm1', log_func=None)
if pwm >= PWM_MAX:
pwm = PWM_MAX - 1
cooling_level = int(pwm / PWM_MAX * 10)
return int(self.PSU_FAN_SPEED[cooling_level], 16)
except Exception:
return self.get_speed()
Expand Down
4 changes: 2 additions & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ def __init__(self, psu_index):

self.psu_power_max_capacity = os.path.join(PSU_PATH, "config/psu{}_power_capacity".format(self.index))

self.psu_temp = os.path.join(PSU_PATH, 'thermal/psu{}_temp'.format(self.index))
self.psu_temp_threshold = os.path.join(PSU_PATH, 'thermal/psu{}_temp_max'.format(self.index))
self.psu_temp = os.path.join(PSU_PATH, 'thermal/psu{}_temp1'.format(self.index))
self.psu_temp_threshold = os.path.join(PSU_PATH, 'thermal/psu{}_temp1_max'.format(self.index))

self.psu_power_slope = os.path.join(PSU_PATH, self.PSU_POWER_SLOPE.format(self.index))

Expand Down
Loading

0 comments on commit 787dd72

Please sign in to comment.