Skip to content

Commit b506241

Browse files
Volodymyr Samotiylguohan
Volodymyr Samotiy
authored andcommitted
[syncd]: Fix reload flow for Mellanox platforms (#2386)
* Perform stop/start of Mellanox driver tools for all types of reboot * Don't set Mellanox FAST_BOOT option for "cold" reboot * Don't send "syncd_request_shutdown" event for "cold" reboot on Mellanox platforms Signed-off-by: Volodymyr Samotiy <[email protected]>
1 parent 011ede9 commit b506241

File tree

1 file changed

+48
-19
lines changed

1 file changed

+48
-19
lines changed

files/scripts/syncd.sh

+48-19
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ function wait_for_database_service()
5252
done
5353
}
5454

55+
function getBootType()
56+
{
57+
case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in
58+
warm*)
59+
TYPE='warm'
60+
;;
61+
fastfast)
62+
TYPE='fastfast'
63+
;;
64+
fast*)
65+
TYPE='fast'
66+
;;
67+
*)
68+
TYPE='cold'
69+
esac
70+
echo "${TYPE}"
71+
}
72+
5573
start() {
5674
debug "Starting ${SERVICE} service..."
5775

@@ -74,17 +92,23 @@ start() {
7492
/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
7593

7694
# platform specific tasks
77-
if [ x$sonic_asic_platform == x'mellanox' ]; then
78-
export FAST_BOOT=1
79-
/usr/bin/mst start
80-
/usr/bin/mlnx-fw-upgrade.sh
81-
/etc/init.d/sxdkernel start
82-
/sbin/modprobe i2c-dev
83-
elif [ x$sonic_asic_platform == x'cavium' ]; then
95+
if [ x$sonic_asic_platform == x'cavium' ]; then
8496
/etc/init.d/xpnet.sh start
8597
fi
8698
fi
8799

100+
# platform specific tasks
101+
if [ x"$sonic_asic_platform" == x"mellanox" ]; then
102+
BOOT_TYPE=`getBootType`
103+
if [[ x"$WARM_BOOT" == x"true" || x"$BOOT_TYPE" == x"fast" ]]; then
104+
export FAST_BOOT=1
105+
fi
106+
/usr/bin/mst start
107+
/usr/bin/mlnx-fw-upgrade.sh
108+
/etc/init.d/sxdkernel start
109+
/sbin/modprobe i2c-dev
110+
fi
111+
88112
# start service docker
89113
/usr/bin/${SERVICE}.sh start
90114
debug "Started ${SERVICE} service..."
@@ -106,32 +130,37 @@ stop() {
106130
TYPE=cold
107131
fi
108132

109-
debug "${TYPE} shutdown syncd process ..."
110-
/usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --${TYPE}
133+
if [[ x$sonic_asic_platform != x"mellanox" ]] || [[ x$TYPE != x"cold" ]]; then
134+
debug "${TYPE} shutdown syncd process ..."
135+
/usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --${TYPE}
111136

112-
# wait until syncd quits gracefully
113-
while docker top syncd | grep -q /usr/bin/syncd; do
114-
sleep 0.1
115-
done
137+
# wait until syncd quits gracefully
138+
while docker top syncd | grep -q /usr/bin/syncd; do
139+
sleep 0.1
140+
done
116141

117-
/usr/bin/docker exec -i syncd /bin/sync
118-
debug "Finished ${TYPE} shutdown syncd process ..."
142+
/usr/bin/docker exec -i syncd /bin/sync
143+
debug "Finished ${TYPE} shutdown syncd process ..."
144+
fi
119145

120146
/usr/bin/${SERVICE}.sh stop
121147
debug "Stopped ${SERVICE} service..."
122148

123149
# if warm start enabled, don't stop peer service docker
124150
if [[ x"$WARM_BOOT" != x"true" ]]; then
125151
# platform specific tasks
126-
if [ x$sonic_asic_platform == x'mellanox' ]; then
127-
/etc/init.d/sxdkernel stop
128-
/usr/bin/mst stop
129-
elif [ x$sonic_asic_platform == x'cavium' ]; then
152+
if [ x$sonic_asic_platform == x'cavium' ]; then
130153
/etc/init.d/xpnet.sh stop
131154
/etc/init.d/xpnet.sh start
132155
fi
133156
fi
134157

158+
# platform specific tasks
159+
if [ x"$sonic_asic_platform" == x"mellanox" ]; then
160+
/etc/init.d/sxdkernel stop
161+
/usr/bin/mst stop
162+
fi
163+
135164
unlock_service_state_change
136165
}
137166

0 commit comments

Comments
 (0)