sonic-buildimage/platform/mellanox/mlnx-platform-api/sonic_platform
Stephen Sun 9f0dce0313
[Mellanox] Optimize SFP modules initialization (#7537)
Originally, SFP modules were always accessed from platform daemons, and arbitrary SFP modules can be accessed in the daemon. So all SFP modules were initialized in one shot once one of the following chassis APIs called
- get_all_sfps
- get_sfp_numbers
- get_sfp

Recently, we noticed that SFP modules can also be accessed from CLI, eg. the latest refactor of `sfputil`.

In this case, only one SFP module is accessed in the chassis object's life cycle.
To initialize all SFP modules in one shot is waste of time and causes the CLI to take much more time to finish.
So we would like to optimize the initialization flow by introducing a two-phase initialization approach:
- Partial initialization, which means the `chassis._sfp_list` has been initialized with proper length and all elements being `None`
- Full initialization, which means all elements in `chassis._sfp_list` are created

If the relevant function is called,
- `get_sfp`, only partial initialization will be done, and then the specific SFP module is initialized.
- `get_all_sfps` or `get_num_sfps`, full initialization will be done, which means all SFP modules are initialized.

Signed-off-by: Stephen Sun <stephens@nvidia.com>
2021-05-06 10:14:48 -07:00
..
__init__.py Add thermal control support for SONiC (#3949) 2020-03-09 10:41:10 -07:00
chassis.py [Mellanox] Optimize SFP modules initialization (#7537) 2021-05-06 10:14:48 -07:00
component.py [Mellanox] Ensure concrete platform API classes call base class initializer (#6854) 2021-02-25 11:06:22 -08:00
device_data.py [Mellanox] Adopt single way to get fan direction for all ASIC types (#7386) 2021-05-03 17:10:18 -07:00
eeprom.py [mellanox][platform api] fix a missing import time module (#6458) 2021-01-15 08:01:11 -08:00
fan_drawer.py [Mellanox] Adopt single way to get fan direction for all ASIC types (#7386) 2021-05-03 17:10:18 -07:00
fan.py [Mellanox] Adopt single way to get fan direction for all ASIC types (#7386) 2021-05-03 17:10:18 -07:00
led.py Fix issue: should not initialize led color in __init__ file as platform API will be called by multiple daemons (#7114) 2021-03-25 14:28:33 +02:00
platform.py [Mellanox] Initialize PSU API on both host and docker side (#7016) 2021-03-15 12:43:18 -07:00
psu.py [platform] Add serial number and model number to Mellanox PSU platform implementation (#7382) 2021-05-04 13:07:00 -07:00
sfp_event.py [Mellanox] [platform API] Fix “local variable 'label_port' referenced before assignment” error (#6419) 2021-01-12 10:43:57 -08:00
sfp.py [Mellanox] Fixes issue: CLI sfputil does not work based on sonic platform API (#7018) 2021-03-11 18:54:33 -08:00
thermal_actions.py [Mellanox] Never disable kernel thermal algorithm at real-time (#4638) 2020-05-26 10:46:29 -07:00
thermal_conditions.py Fix dynamic minimum fan table issue caused by python3 (#6690) 2021-02-07 11:21:44 +02:00
thermal_infos.py [Mellanox] thermal control enhancement for dynamic minimum fan speed and PSU fan speed policy (#4403) 2020-04-21 08:09:53 -07:00
thermal_manager.py [Mellanox] thermal control enhancement for dynamic minimum fan speed and PSU fan speed policy (#4403) 2020-04-21 08:09:53 -07:00
thermal.py [Mellanox] Ensure concrete platform API classes call base class initializer (#6854) 2021-02-25 11:06:22 -08:00
utils.py [Mellanox] Fixes issue: CLI sfputil does not work based on sonic platform API (#7018) 2021-03-11 18:54:33 -08:00
watchdog.py [Mellanox] Ensure concrete platform API classes call base class initializer (#6854) 2021-02-25 11:06:22 -08:00