File tree Expand file tree Collapse file tree 1 file changed +35
-1
lines changed
files/image_config/watchdog-control Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change 33VERBOSE=no
44WATCHDOG_UTIL=" /usr/local/bin/watchdogutil"
55
6+ # read SONiC immutable variables
7+ [ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment
8+ PLATFORM=${PLATFORM:- $(sonic-db-cli CONFIG_DB HGET ' DEVICE_METADATA|localhost' platform)}
9+ PLATFORM_JSON=" /usr/share/sonic/device/$PLATFORM /platform.json"
10+
611function debug()
712{
813 /usr/bin/logger " $0 : $1 "
@@ -34,6 +39,19 @@ function getBootType()
3439 echo " ${TYPE} "
3540}
3641
42+ function is_smart_switch_dpu()
43+ {
44+ if [[ ! -f " $PLATFORM_JSON " ]]; then
45+ return 1
46+ fi
47+
48+ if jq -e ' has("DPU")' " $PLATFORM_JSON " > /dev/null; then
49+ return 0
50+ else
51+ return 1
52+ fi
53+ }
54+
3755function disable_watchdog()
3856{
3957 # Obtain boot type from kernel arguments
@@ -44,4 +62,20 @@ function disable_watchdog()
4462 fi
4563}
4664
47- disable_watchdog
65+ function enable_watchdog()
66+ {
67+ if [[ -x ${WATCHDOG_UTIL} ]]; then
68+ debug " Enabling Watchdog"
69+ ${WATCHDOG_UTIL} arm
70+ fi
71+ }
72+
73+ if is_smart_switch_dpu; then
74+ # Keep watchdog enabled for smart switch DPUs
75+ # Smart switch DPUs uses ARM SBSA Generic Watchdog,
76+ # which is capable of monitoring the system in runtime.
77+ enable_watchdog
78+ else
79+ # Disable watchdog for all other platforms
80+ disable_watchdog
81+ fi
You can’t perform that action at this time.
0 commit comments