Skip to content

Commit

Permalink
hw-mgmt: scripts: Fix mlxsw_minimal driver init triggered by SDK udev…
Browse files Browse the repository at this point in the history
… event

When mlxsw_minimal driver initialization is triggered by Nvidia SDK udev event
the value of ASIC index passed to hw-mgmt ASIC init code is 0. This special case
was not handled correctly. Additionally, the case of legacy systems was not handled
correctly by hw-mgmt routine mapping ASIC PCI bus ID to I2C bus ID.

Fixes: #3684822

Signed-off-by: Felix Radensky <fradensky@nvidia.com>
  • Loading branch information
felixradensky committed Nov 28, 2023
1 parent 67b6409 commit 6b8ffdb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions usr/usr/bin/hw-management.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2517,12 +2517,17 @@ map_asic_pci_to_i2c_bus()
local bus
local pci_bus
local i2c_bus
local asic_num=1

if [ -z "$1" ]; then
return 255
fi
[ -f "$config_path/asic_num" ] && asic_num=$(< $config_path/asic_num)
if [ "$asic_num" ] && [ "$asic_num" -gt 1 ]; then
if [ $asic_num -eq 1 ]; then
return 255
fi

if [ $asic_num -gt 1 ]; then
pci_bus=`basename $1`
pci_bus="${pci_bus:5}"
for ((i=1; i<=asic_num; i+=1)); do
Expand Down Expand Up @@ -2679,7 +2684,7 @@ do_chip_up_down()
asic_i2c_bus=$?
if [ $asic_i2c_bus -eq 255 ]; then
set_asic_i2c_bus
if [ -n "$asic_index" ]; then
if [ -n "$asic_index" ] && [ $asic_index -gt 0 ]; then
asic_i2c_bus=$(< $config_path/asic${asic_index}_i2c_bus_id)
else
asic_i2c_bus=$(< $config_path/asic_bus)
Expand Down

0 comments on commit 6b8ffdb

Please sign in to comment.