Skip to content

Commit ac5e080

Browse files
committed
hw-mgmt: scripts: Restore asic chipup status on restart
On the SPC1/SPC2 platforms with single asic that uses minimal driver, when the hw-mgmt service is restarted, asic chipup status is not restored. This is because 'systemctl restart' calls stop and start of hw-mgmt. The asic chipup is performed only when the 'hw-management.sh chipup' is called explicitly. When the asic was instantiated before doing a hw-mgmt restart, as part of do_stop, asic chip down is performed and it will not be instantiated back after do_start. This patch adds the support for restoring the asic chipup status on hw-mgmt restarts. Bugs #4662187 Signed-off-by: Ciju Rajan K <crajank@nvidia.com>
1 parent 166f823 commit ac5e080

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

usr/usr/bin/hw-management-helpers.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ vm_sku=`cat $sku_file`
8181
vm_vpd_path="/etc/hw-management-virtual/$vm_sku"
8282
cpldreg_log_file=/var/log/hw-mgmt-cpldreg.log
8383
fixup_hook_script=/usr/local/bin/hw-management-fixup.sh
84+
asic_chipup_status=/run/.asic_chipup_completed
8485

8586
declare -A psu_fandir_vs_pn=(["00KX1W"]=R ["00MP582"]=F ["00MP592"]=R ["00WT061"]=F \
8687
["00WT062"]=R ["00WT199"]=F ["01FT674"]=F ["01FT691"]=F ["01LL976"]=F \
@@ -1037,3 +1038,16 @@ run_fixup_script()
10371038
echo $status > ${config_path}/fixup-status-${stage}
10381039
fi
10391040
}
1041+
1042+
check_asic_chipup_status()
1043+
{
1044+
local chipup_status=0
1045+
1046+
if [ -f "$asic_chipup_status" ]; then
1047+
chipup_status=$(< "$asic_chipup_status")
1048+
if [ $chipup_status -eq 1 ]; then
1049+
return 0
1050+
fi
1051+
fi
1052+
return 1
1053+
}

usr/usr/bin/hw-management.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3951,9 +3951,17 @@ case $ACTION in
39513951
exit 0
39523952
fi
39533953
do_start
3954+
# In SPC1/SPC2 switches that uses minimal driver, re-storing the state
3955+
# of asic chipup for the restart scenario.
3956+
check_asic_chipup_status && do_chip_up_down 1 1
39543957
;;
39553958
stop)
39563959
if [ -d /var/run/hw-management ]; then
3960+
# In SPC1/SPC2 switches that uses minimal driver, storing the state
3961+
# of asic chipup for the restart scenario.
3962+
if [ -f "$config_path/asic_chipup_completed" ]; then
3963+
cp "$config_path/asic_chipup_completed" $asic_chipup_status
3964+
fi
39573965
echo 1 > $config_path/stopping
39583966
if [ ! -f "$config_path/asic_num" ]; then
39593967
asic_num=1
@@ -4035,6 +4043,9 @@ case $ACTION in
40354043
do_stop
40364044
sleep 3
40374045
do_start
4046+
# In SPC1/SPC2 switches that uses minimal driver, re-storing the state
4047+
# of asic chipup for the restart scenario.
4048+
check_asic_chipup_status && do_chip_up_down 1 1
40384049
;;
40394050
reset-cause)
40404051
for f in $system_path/reset_*;

0 commit comments

Comments
 (0)