Skip to content

Commit

Permalink
[syncd]: Fix reload flow for Mellanox platforms (#2386)
Browse files Browse the repository at this point in the history
* 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 <volodymyrs@mellanox.com>
  • Loading branch information
Volodymyr Samotiy authored and lguohan committed Dec 15, 2018
1 parent 011ede9 commit b506241
Showing 1 changed file with 48 additions and 19 deletions.
67 changes: 48 additions & 19 deletions files/scripts/syncd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ function wait_for_database_service()
done
}

function getBootType()
{
case "$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)" in
warm*)
TYPE='warm'
;;
fastfast)
TYPE='fastfast'
;;
fast*)
TYPE='fast'
;;
*)
TYPE='cold'
esac
echo "${TYPE}"
}

start() {
debug "Starting ${SERVICE} service..."

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

# platform specific tasks
if [ x$sonic_asic_platform == x'mellanox' ]; then
export FAST_BOOT=1
/usr/bin/mst start
/usr/bin/mlnx-fw-upgrade.sh
/etc/init.d/sxdkernel start
/sbin/modprobe i2c-dev
elif [ x$sonic_asic_platform == x'cavium' ]; then
if [ x$sonic_asic_platform == x'cavium' ]; then
/etc/init.d/xpnet.sh start
fi
fi

# platform specific tasks
if [ x"$sonic_asic_platform" == x"mellanox" ]; then
BOOT_TYPE=`getBootType`
if [[ x"$WARM_BOOT" == x"true" || x"$BOOT_TYPE" == x"fast" ]]; then
export FAST_BOOT=1
fi
/usr/bin/mst start
/usr/bin/mlnx-fw-upgrade.sh
/etc/init.d/sxdkernel start
/sbin/modprobe i2c-dev
fi

# start service docker
/usr/bin/${SERVICE}.sh start
debug "Started ${SERVICE} service..."
Expand All @@ -106,32 +130,37 @@ stop() {
TYPE=cold
fi

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

# wait until syncd quits gracefully
while docker top syncd | grep -q /usr/bin/syncd; do
sleep 0.1
done
# wait until syncd quits gracefully
while docker top syncd | grep -q /usr/bin/syncd; do
sleep 0.1
done

/usr/bin/docker exec -i syncd /bin/sync
debug "Finished ${TYPE} shutdown syncd process ..."
/usr/bin/docker exec -i syncd /bin/sync
debug "Finished ${TYPE} shutdown syncd process ..."
fi

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

# if warm start enabled, don't stop peer service docker
if [[ x"$WARM_BOOT" != x"true" ]]; then
# platform specific tasks
if [ x$sonic_asic_platform == x'mellanox' ]; then
/etc/init.d/sxdkernel stop
/usr/bin/mst stop
elif [ x$sonic_asic_platform == x'cavium' ]; then
if [ x$sonic_asic_platform == x'cavium' ]; then
/etc/init.d/xpnet.sh stop
/etc/init.d/xpnet.sh start
fi
fi

# platform specific tasks
if [ x"$sonic_asic_platform" == x"mellanox" ]; then
/etc/init.d/sxdkernel stop
/usr/bin/mst stop
fi

unlock_service_state_change
}

Expand Down

0 comments on commit b506241

Please sign in to comment.