From 8ca053092025b5715eedbebf70f84036aeddaf04 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak <38952541+stepanblyschak@users.noreply.github.com> Date: Tue, 6 Dec 2022 11:23:46 +0200 Subject: [PATCH] [swss.sh] optimize macsec feature state query (#12946) - Why I did it There's a slowdown in bootup related to the execution of a show command during startup of swss service. show is a pretty heavy command and takes long time to execute ~2 sec. - How I did it I replaced show with sonic-db-cli which takes a ms to run. - How to verify it Boot the switch and verify swss is active. Signed-off-by: Stepan Blyschak --- files/scripts/swss.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index ba0437a25e..d344f6d0da 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -304,7 +304,7 @@ function check_peer_gbsyncd() function check_macsec() { - MACSEC_STATE=`show feature status | grep macsec | awk '{print $2}'` + MACSEC_STATE=`$SONIC_DB_CLI CONFIG_DB hget 'FEATURE|macsec' state` if [[ ${MACSEC_STATE} == 'enabled' ]]; then if [ "$DEV" ]; then