From 6370d64b3d1fb9be9ee05065bb6bf1f9d3939c5b Mon Sep 17 00:00:00 2001 From: RAMA CHANDRA REDDY GADDAM <45847882+ramachandrareddygaddam@users.noreply.github.com> Date: Wed, 19 Jun 2019 13:55:37 +0530 Subject: [PATCH] [broadcom]: Check for broadcom platform sdk init ready during syncd start. (#2931) - What I did During boot/reload time, wait in a loop to check for bcm initialization. Break the loop, once sdk is ready to process the 'bcmcmd' request (or) loop count reached the maximum value. - How I did it In the existing implementation during syncd start process will sleep for a fixed time (3 secs) for sdk initialization to happen. But the time taken for sdk initialization is varying for different platforms. To fix this issue, the syncd start process wait in a loop and check whether sdk is ready to process 'bcmcmd' command. - How to verify it Check for syncd process status and interface status. Check for syslogs and no failures related to syncd should be present. --- platform/broadcom/docker-syncd-brcm/start.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/platform/broadcom/docker-syncd-brcm/start.sh b/platform/broadcom/docker-syncd-brcm/start.sh index 45c4ab92da..146b2efa74 100755 --- a/platform/broadcom/docker-syncd-brcm/start.sh +++ b/platform/broadcom/docker-syncd-brcm/start.sh @@ -15,7 +15,20 @@ wait_syncd() { done # wait until bcm sdk is ready to get a request - sleep 3 + counter=0 + while true; do + /usr/bin/bcmcmd -t 1 "show unit" | grep BCM >/dev/null 2>&1 + rv=$? + if [ $rv -eq 0 ]; then + break + fi + counter=$((counter+1)) + if [ $counter -ge 60 ]; then + echo "syncd is not ready to take commands after $counter re-tries; Exiting!" + break + fi + sleep 1 + done }