sonic-buildimage/platform/broadcom/sonic-platform-modules-dell/s6100/scripts
Hua Liu e17e4fc4c0
[S6100] Improve S6100 serial-getty monitor, wait and re-check when getty not running to avoid false alert. (#14402)
[S6100] Improve S6100 serial-getty monitor, wait and re-check when getty not running to avoid false alert. 

#### Why I did it
On S6100, the serial-getty service some time can't auto-restart by systemd. So there is a monit unit to check serial-getty service status and restart it.

However, this monit will report false alert, because in most case when serial-getty not running, systemd can restart it successfully.

To avoid the false alert, improve the monitor to wait and re-check.

Steps to reproduce this issue:
1. User login to device via console, and keep the connection.
2. User login to device via SSH, check the serial-getty@ttyS1.service service, it's running.
3. Run 'monit reload' from SSH connection.
4. Check syslog 1 minutes later, there will be false alert: ' 'serial-getty' process is not running'

#### How I did it
Add check-getty.sh script to recheck again later when getty service not running.
And update monit unit to check serial-getty service status with this script to avoid false alert.

#### How to verify it
Pass all UT.
Manually check fixed code work correctly:


```
admin@***:~$ sudo systemctl stop  serial-getty@ttyS1.service
admin@***:~$ sudo /usr/local/bin/check-getty.sh 
admin@***:~$ echo $?
1
admin@***:~$ sudo systemctl status serial-getty@ttyS1.serviceserial-getty@ttyS1.service - Serial Getty on ttyS1
     Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled-runtime; vendor preset: enabled)
     Active: inactive (dead) since Tue 2023-03-28 07:15:21 UTC; 1min 13s ago

admin@***:~$ sudo /usr/local/bin/check-getty.sh 
admin@***:~$ echo $?
0
admin@***:~$ sudo systemctl status serial-getty@ttyS1.serviceserial-getty@ttyS1.service - Serial Getty on ttyS1
     Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled-runtime; vendor preset: enabled)
```

syslog:
```
Mar 28 07:10:37.597458 *** INFO systemd[1]: serial-getty@ttyS1.service: Succeeded.
Mar 28 07:12:43.010550 *** ERR monit[593]: 'serial-getty' status failed (1) -- no output
Mar 28 07:12:43.010744 *** INFO monit[593]: 'serial-getty' trying to restart
Mar 28 07:12:43.010846 *** INFO monit[593]: 'serial-getty' stop: '/bin/systemctl stop serial-getty@ttyS1.service'
Mar 28 07:12:43.132172 *** INFO monit[593]: 'serial-getty' start: '/bin/systemctl start serial-getty@ttyS1.service'
Mar 28 07:13:43.286276 *** INFO monit[593]: 'serial-getty' status succeeded (0) -- no output
```

#### Description for the changelog
[S6100] Improve S6100 serial-getty monitor.

#### Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
2023-04-05 21:34:31 -07:00
..
check-getty.sh [S6100] Improve S6100 serial-getty monitor, wait and re-check when getty not running to avoid false alert. (#14402) 2023-04-05 21:34:31 -07:00
fast-reboot_plugin DellEMC: S6100, Z9332f - Include ONIE version in 'show platform firmware status' (#10493) 2022-05-12 09:24:06 -07:00
hw-management-generate-dump.sh [Dell] S6100 S6000 - Show techsupport enhancement (#6410) 2021-03-09 15:49:24 -08:00
iom_power_off.sh Dell S6100 fix mux issue (#5414) 2020-09-22 15:27:32 -07:00
iom_power_on.sh Dell S6100 fix mux issue (#5414) 2020-09-22 15:27:32 -07:00
iSMART_64 DellEMC S6100 SSD Monitor Porting Changes in master (#7289) 2021-08-31 07:17:54 -07:00
override.conf [sonic-platform-modules-dell] Graceful platform reboot (#2912) 2019-07-23 15:26:58 -07:00
pcisysfs.py [DellEMC]: Platform modules Python3 compliance and other changes (#5609) 2020-10-17 12:31:55 -07:00
platform_fw_au_reboot_handle [DellEMC] S6100 - Adding SSD component and introducing platform_fw_au_handle for auto-update (#9208) 2021-12-06 23:22:35 -08:00
platform_reboot_override [DellEMC] S6100 Reboot cause determining CPU reset in fast-reboot (#8024) 2021-08-04 14:35:36 -07:00
platform_reboot_pre_check DellEMC S6100 SSD Monitor Porting Changes in master (#7289) 2021-08-31 07:17:54 -07:00
platform_sensors.py [DellEMC]: Platform modules Python3 compliance and other changes (#5609) 2020-10-17 12:31:55 -07:00
platform_watchdog_disable.sh [devices]: DellEMC S6100 Watchdog support (#2835) 2019-06-28 23:47:36 -07:00
platform_watchdog_enable.sh [devices]: DellEMC S6100 Watchdog support (#2835) 2019-06-28 23:47:36 -07:00
README [platform]: move dell platform modules into buildimage repo 2018-08-13 10:39:07 +00:00
reboot_plugin Refactoring DELL platform init to reduce rc.local processing time porting changes in master (#10318) 2022-03-24 11:14:37 -07:00
s6100_bitbang_reset.sh DellEMC S6100: Add script files to executable directory (#5012) 2020-07-21 19:25:24 -07:00
s6100_platform_startup.sh Refactoring DELL platform init to reduce rc.local processing time porting changes in master (#10318) 2022-03-24 11:14:37 -07:00
s6100_platform.sh [DellEMC] S6100 Platform Service optimization porting in master (#11330) 2022-08-02 09:56:17 -07:00
s6100_serial_getty_monitor [S6100] Improve S6100 serial-getty monitor, wait and re-check when getty not running to avoid false alert. (#14402) 2023-04-05 21:34:31 -07:00
s6100_ssd_mon.sh DellEMC S6100 SSD Monitor Porting Changes in master (#7289) 2021-08-31 07:17:54 -07:00
s6100_ssd_upgrade_status.sh [DellEMC] S6100 - Adding logger to fetch SSD FW Upgrade status (#14247) 2023-04-04 10:19:47 -07:00
sensors [devices]: DellEMC S6100/Z9100 sensor.conf update (#2861) 2019-05-09 00:22:18 -07:00
soft-reboot_plugin DellEMC S6100 SSD Monitor Porting Changes in master (#7289) 2021-08-31 07:17:54 -07:00
ssd-fw-upgrade ssd firmware upgrade for S6100 3IE3 devices with cold-reboot/warm-reboot/fast-reboot. (#4911) 2020-08-11 11:16:29 -07:00
track_reboot_reason.sh [DellEMC] S6100 - iTCO watchdog support and reboot cause determination changes (#9149) 2021-12-06 21:52:20 -08:00
warm-reboot_plugin [DellEMC] S6100 Last Reboot Reason Thermal Support (#3767) 2020-02-18 00:02:33 -08:00

Dell S6100 64x40G support 
------------------------

summary:-
S6100 has 64 x 40G port capacity
S6100 supports 4 IO Modules which are pluggable. Below section covers how to power on IO modules
and initialize the device drivers and configure necessary mux to send traffic.


Necessary drivers and scripts to package 

1) Users are expected to build necessary drivers for kernel and package to acess it on the target

    a) Mgmt phy driver  
      This supports BCM 54616 phy driver ( enable CONFIG_IGB in kernel config)
    b) driver-support-sff-8436-eeprom.patch 
    c) driver-support-sff-8436-eeprom-update.patch
    This driver supports QSFP EEPROM
    d) dell_s6100_iom_cpld.ko   
    This driver provides support for cpld on 4 x 40Gig-IOM modules
    e) i2c_mux_pca954x.ko
    This driver provides support for i2c mux/switch (pca954x)
    f) dell_s6100_lpc.ko
    This driver porivide support for reading all the platform info from SMF. 


2) Users are also expected to package below scripts for platform initialization and i2c tree creation 

    a) iom_power.sh
    This script is used to power on IO modules on S6100
    b) io_rd_wr.py
This script is generic LPC/io read/write utility (can also access system cpld)

steps to platform initialization (Tested with 3.16)

1) After power up of S6100 

     a) power up the io modules by executing (./iom_power.sh)
     b) insert i2c_mux_pca954x.ko,dell_s6100_iom_cpld.ko,dell_s6100_lpc.ko 

    Above 2 steps can be called by including them in below 2 step

2) Build i2c device tree/device initialization by calling below script

    ./s6100_platform_init.sh

3) IOM cpld devices are created under "/sys/bus/i2c/drivers/dell_s6100_iom_cpld/"
   QSFP handles via sysfs i2c bus #( 15,16,17,18-003e)
   iom_cpld_vers -- Displays CPLD version(RO)
   qsfp_lpmode   -- lpmode settings(RW)
   qsfp_modprs   -- modules presence (RO)
   qsfp_reset    -- reset settings (RW)

    ls /sys/bus/i2c/drivers/dell_s6100_iom_cpld/15-003e/
    driver/        iom_cpld_vers  modalias       name           power/         qsfp_lpmode    qsfp_modprs    qsfp_reset     subsystem/     uevent

4) step 2 script also builds/attach sfp device tress in sysfs
   
    Example for reading EEPROM data
        
            cat  /sys/bus/i2c/devices/19-0050/eeprom | hexdump -C
            00000000  0d 00 00 0f 00 00 00 00  00 00 00 00 00 00 00 00  |................|
            00000010  00 00 00 00 00 00 18 1b  00 00 82 20 00 00 00 00  |........... ....|
            00000020  00 00 00 00 00 00 00 00  00 00 16 4d 16 4d 16 4d  |...........M.M.M|
            00000030  16 4d 34 bf 44 bf 54 bf  64 bf 00 00 00 00 00 00  |.M4.D.T.d.......|
            00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
            *
            00000070  00 00 00 00 00 00 00 ff  ff ff ff ff ff ff ff 00  |................|
            00000080  0d 00 0c 04 00 00 00 40  40 02 d5 05 69 00 00 32  |.......@@...i..2|
            00000090  00 00 00 00 46 49 4e 49  53 41 52 20 43 4f 52 50  |....FINISAR CORP|
            000000a0  20 20 20 20 07 00 90 65  46 54 4c 34 31 30 51 45  |    ...eFTL410QE|
            000000b0  31 43 20 20 20 20 20 20  41 33 42 68 07 d0 46 70  |1C      A3Bh..Fp|
            000000c0  00 01 04 d0 4d 4c 54 30  30 51 33 20 20 20 20 20  |....MLT00Q3     |
            000000d0  20 20 20 20 31 32 30 31  31 35 20 20 08 00 00 38  |    120115  ...8|
            000000e0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
            000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
            *
            00000200  4b 00 fb 00 46 00 00 00  00 00 00 00 00 00 00 00  |K...F...........|
            00000210  94 70 6e f0 86 c4 7b 0c  00 00 00 00 00 00 00 00  |.pn...{.........|
            00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
            *
            00000260  00 00 11 11 00 00 00 00  00 00 00 00 00 00 22 22  |..............""|
            00000270  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
            00000280

5)SMF driver details/Readme are as below
  
   S6100 SMF
   ---------

   S6100 has one SMF soc on CPU board. This is via LPC interface, provide access to all the below functionality

   a) Read sensors details on the system
   b) Read PSU details on the system
   c) Read fans/Fan tray details on the system
   d) Read/Write to system led

   dell_s6100_lpc create entry for all the above necessary platform components as attributes in below path.

   /sys/devices/platform/dell_s6100_lpc/


   LED:-
   ----

   Get /set operations on sys_led

   Get operation
   cat /sys/devices/platform/dell_s6100_lpc/sys_led
   0x80

   Set operation
   echo 83 >  sys/devices/platform/dell_s6100_lpc/sys_led

   Sensors:-
   --------

   Max no of sensors on the system ( 11 sensors are available on fully loaded system)

   cat /sys/devices/platform/dell_s6100_lpc/max_num_temp_sensors
   b

   cat /sys/devices/platform/dell_s6100_lpc/temp_sensor_1    ( temp_sensor_1 <85>.temp_sensor_11)

   Fan tray speed:-
   --------------

   /sys/devices/platform/dell_s6100_lpc/fan_tray_1_speed  (fan_tray_1_speed  - fan_tray_4_speed)
   13700

   cat /sys/devices/platform/dell_s6100_lpc/psu1_max_pwr
   110
   cat /sys/devices/platform/dell_s6100_lpc/psu2_max_pwr
   110

   cat /sys/devices/platform/dell_s6100_lpc/psu_total_pwr
   232