Refactoring DELL platform init to reduce rc.local processing time porting changes in master (#10318)

Why I did it
To reduce the processing time of rc.local, refactoring s6100 platform initialization.
Porting changes from 202012 branch [202012] Refactoring DELL platform init to reduce rc.local processing time #10171
This commit is contained in:
Santhosh Kumar T 2022-03-24 23:44:37 +05:30 committed by GitHub
parent 7eb321c376
commit e2502edefd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 67 additions and 53 deletions

View File

@ -225,11 +225,10 @@ if [ ! -e /host/machine.conf ]; then
grub_installation_needed="TRUE"
fi
migrate_nos_configuration
umount /mnt/onie-boot
fi
migrate_nos_configuration
. /host/machine.conf
program_console_speed

View File

@ -1,6 +1,6 @@
s6100/scripts/iom_power_*.sh usr/local/bin
s6100/scripts/s6100_platform.sh usr/local/bin
s6100/scripts/s6100_i2c_enumeration.sh usr/local/bin
s6100/scripts/s6100_platform_startup.sh usr/local/bin
s6100/scripts/s6100_bitbang_reset.sh usr/local/bin
s6100/scripts/pcisysfs.py usr/bin
common/dell_i2c_utils.sh usr/local/bin
@ -33,7 +33,7 @@ s6100/systemd/s6100-ssd-monitor.service etc/systemd/system
s6100/systemd/s6100-ssd-monitor.timer etc/systemd/system
s6100/systemd/s6100-ssd-upgrade-status.service etc/systemd/system
s6100/systemd/s6100-reboot-cause.service etc/systemd/system
s6100/systemd/s6100-i2c-enumerate.service etc/systemd/system
s6100/systemd/s6100-platform-startup.service etc/systemd/system
s6100/scripts/s6100_serial_getty_monitor etc/monit/conf.d
common/fw-updater usr/local/bin
common/onie_mode_set usr/local/bin

View File

@ -8,4 +8,4 @@ fi
io_rd_wr.py --set --val 40 --offset 0x131
io_rd_wr.py --set --val 06 --offset 210; io_rd_wr.py --set --val 0B --offset 211; io_rd_wr.py --set --val aa --offset 213
/usr/local/bin/s6100_i2c_enumeration.sh deinit & > /dev/null
/usr/local/bin/s6100_platform_startup.sh deinit & > /dev/null

View File

@ -5,4 +5,4 @@ if [[ -d /sys/devices/platform/SMF.512/hwmon/ ]]; then
echo 0xcc > mb_poweron_reason
fi
/usr/local/bin/s6100_i2c_enumeration.sh deinit & > /dev/null
/usr/local/bin/s6100_platform_startup.sh deinit & > /dev/null

View File

@ -2,20 +2,6 @@
#platform init script for Dell S6100
install_python_api_package() {
device="/usr/share/sonic/device"
platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl)
}
remove_python_api_package() {
rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null)
if [ $? -eq 0 ]; then
rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null)
fi
}
if [[ "$1" == "init" ]]; then
pericom="/sys/bus/pci/devices/0000:08:00.0"
@ -38,30 +24,31 @@ if [[ "$1" == "init" ]]; then
systemctl start --no-block s6100-ssd-upgrade-status.service
is_fast_warm=$(cat /proc/cmdline | grep SONIC_BOOT_TYPE | wc -l)
case "$(cat /proc/cmdline)" in
*SONIC_BOOT_TYPE=warm*)
TYPE='warm'
;;
*SONIC_BOOT_TYPE=fastfast*)
TYPE='fastfast'
;;
*SONIC_BOOT_TYPE=fast*|*fast-reboot*)
TYPE='fast'
;;
*SONIC_BOOT_TYPE=soft*)
TYPE='soft'
;;
*)
TYPE='cold'
esac
if [[ "$is_fast_warm" == "1" ]]; then
systemctl start --no-block s6100-i2c-enumerate.service
if [[ "$TYPE" == "cold" ]]; then
systemctl start s6100-platform-startup.service
else
systemctl start s6100-i2c-enumerate.service
systemctl start --no-block s6100-platform-startup.service
fi
echo -2 > /sys/bus/i2c/drivers/pca954x/0-0070/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/4-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/6-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/6-0072/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/7-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/7-0072/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/8-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/8-0072/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/9-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/9-0072/idle_state
install_python_api_package
monit reload
elif [[ "$1" == "deinit" ]]; then
/usr/local/bin/s6100_i2c_enumeration.sh deinit
/usr/local/bin/s6100_platform_startup.sh deinit
modprobe -r dell_s6100_lpc
modprobe -r dell_s6100_iom_cpld
@ -69,7 +56,6 @@ elif [[ "$1" == "deinit" ]]; then
modprobe -r i2c-dev
modprobe -r dell_ich
modprobe -r nvram
remove_python_api_package
else
echo "s6100_platform : Invalid option !"
fi

View File

@ -1,9 +1,22 @@
#!/bin/bash
### DellEMC S6100 I2C MUX Enumeration script
### DellEMC S6100 Platform Startup script
source dell_i2c_utils.sh
install_python_api_package() {
device="/usr/share/sonic/device"
platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl)
}
remove_python_api_package() {
rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null)
if [ $? -eq 0 ]; then
rv=$(pip3 uninstall -y sonic-platform > /dev/null 2>/dev/null)
fi
}
init_devnum() {
found=0
for devnum in 0 1; do
@ -292,6 +305,20 @@ if [[ "$1" == "init" ]]; then
switch_board_qsfp_lpmode "disable"
/usr/local/bin/s6100_bitbang_reset.sh
xcvr_presence_interrupts "enable"
echo -2 > /sys/bus/i2c/drivers/pca954x/0-0070/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/4-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/6-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/6-0072/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/7-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/7-0072/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/8-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/8-0072/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/9-0071/idle_state
echo -2 > /sys/bus/i2c/drivers/pca954x/9-0072/idle_state
install_python_api_package
monit reload
elif [[ "$1" == "deinit" ]]; then
xcvr_presence_interrupts "disable"
switch_board_sfp "delete_device"
@ -302,4 +329,6 @@ elif [[ "$1" == "deinit" ]]; then
switch_board_qsfp "delete_device"
switch_board_qsfp_mux "delete_device"
cpu_board_mux "delete_device"
remove_python_api_package
fi

View File

@ -1,12 +0,0 @@
[Unit]
Description=Dell S6100 I2C MUX Enumeration
Before=pmon.service
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/usr/local/bin/s6100_i2c_enumeration.sh init
RemainAfterExit=no
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=Dell S6100 Platform Startup Service
Before=pmon.service determine-reboot-cause.service
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/usr/local/bin/s6100_platform_startup.sh init
RemainAfterExit=no
[Install]
WantedBy=multi-user.target