diff --git a/dockers/docker-orchagent/critical_processes.j2 b/dockers/docker-orchagent/critical_processes.j2 index 10828b3fab20..b9bad74089b6 100644 --- a/dockers/docker-orchagent/critical_processes.j2 +++ b/dockers/docker-orchagent/critical_processes.j2 @@ -12,6 +12,7 @@ program:fdbsyncd program:vlanmgrd program:intfmgrd program:portmgrd +program:fabricmgrd program:buffermgrd program:vrfmgrd program:nbrmgrd diff --git a/dockers/docker-orchagent/supervisord.conf.j2 b/dockers/docker-orchagent/supervisord.conf.j2 index 6c822f464a8d..026958197fb3 100644 --- a/dockers/docker-orchagent/supervisord.conf.j2 +++ b/dockers/docker-orchagent/supervisord.conf.j2 @@ -190,6 +190,19 @@ environment=ASAN_OPTIONS="log_path=/var/log/asan/portmgrd-asan.log{{ asan_extra_ {% endif %} {%- endif %} +[program:fabricmgrd] +command=/usr/bin/fabricmgrd +priority=10 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog +dependent_startup=true +dependent_startup_wait_for=swssconfig:exited +{% if ENABLE_ASAN == "y" %} +environment=ASAN_OPTIONS="log_path=/var/log/asan/fabricmgrd-asan.log{{ asan_extra_options }}" +{% endif %} + {% if is_fabric_asic == 0 %} [program:buffermgrd] command=/usr/bin/buffermgrd.sh diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py b/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py index ae7064f3a560..ddc5ac599e03 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py @@ -66,9 +66,13 @@ SYSFS_INDEPENDENT_FD_FREQ = os.path.join(SYSFS_INDEPENDENT_FD_PREFIX, "frequency") SYSFS_INDEPENDENT_FD_FREQ_SUPPORT = os.path.join(SYSFS_INDEPENDENT_FD_PREFIX, "frequency_support") IS_INDEPENDENT_MODULE = 'is_independent_module' +PROC_CMDLINE = "/proc/cmdline" +CMDLINE_STR_TO_LOOK_FOR = 'SONIC_BOOT_TYPE=' +CMDLINE_VAL_TO_LOOK_FOR = 'fastfast' MAX_EEPROM_ERROR_RESET_RETRIES = 4 + class ModulesMgmtTask(threading.Thread): def __init__(self, namespaces=None, main_thread_stop_event=None, q=None): @@ -93,6 +97,8 @@ def __init__(self, namespaces=None, main_thread_stop_event=None, q=None): self.delete_ports_and_reset_states_dict = {} self.setName("ModulesMgmtTask") self.register_hw_present_fds = [] + self.is_warm_reboot = False + self.port_control_dict = {} # SFPs state machine def get_sm_func(self, sm, port): @@ -146,13 +152,35 @@ def run(self): num_of_ports = DeviceDataManager.get_sfp_count() # create the modules sysfs fds poller self.poll_obj = select.poll() + # read cmdline to check if warm reboot done. cannot use swsscommon warmstart since this code runs after + # warm-reboot is finished. if done, need to read control sysfs per port and act accordingly since modules are + # not reset in warm-reboot + cmdline_dict = {} + proc_cmdline_str = utils.read_str_from_file(PROC_CMDLINE) + if CMDLINE_STR_TO_LOOK_FOR in proc_cmdline_str: + cmdline_dict[CMDLINE_STR_TO_LOOK_FOR] = proc_cmdline_str.split(CMDLINE_STR_TO_LOOK_FOR)[1] + if CMDLINE_STR_TO_LOOK_FOR in cmdline_dict.keys(): + self.is_warm_reboot = cmdline_dict[CMDLINE_STR_TO_LOOK_FOR] == CMDLINE_VAL_TO_LOOK_FOR + logger.log_info(f"system was warm rebooted is_warm_reboot: {self.is_warm_reboot}") for port in range(num_of_ports): # check sysfs per port whether it's independent mode or legacy temp_module_sm = ModuleStateMachine(port_num=port, initial_state=STATE_HW_NOT_PRESENT , current_state=STATE_HW_NOT_PRESENT) module_fd_indep_path = SYSFS_INDEPENDENT_FD_PRESENCE.format(port) logger.log_info("system in indep mode: {} port {}".format(self.is_supported_indep_mods_system, port)) - if self.is_supported_indep_mods_system and os.path.isfile(module_fd_indep_path): + if self.is_warm_reboot: + logger.log_info("system was warm rebooted is_warm_reboot: {} trying to read control sysfs for port {}" + .format(self.is_warm_reboot, port)) + port_control_file = SYSFS_INDEPENDENT_FD_FW_CONTROL.format(port) + try: + port_control = utils.read_int_from_file(port_control_file, raise_exception=True) + self.port_control_dict[port] = port_control + logger.log_info(f"port control sysfs is {port_control} for port {port}") + except Exception as e: + logger.log_error("exception {} for port {} trying to read port control sysfs {}" + .format(e, port, port_control_file)) + if (self.is_supported_indep_mods_system and os.path.isfile(module_fd_indep_path)) \ + and not (self.is_warm_reboot and 0 == port_control): logger.log_info("system in indep mode: {} port {} reading file {}".format(self.is_supported_indep_mods_system, port, module_fd_indep_path)) temp_module_sm.set_is_indep_modules(True) temp_module_sm.set_module_fd_path(module_fd_indep_path) @@ -380,7 +408,7 @@ def check_if_hw_present(self, port, module_sm_obj, dynamic=False): elif 1 == val_int: logger.log_info("returning {} for val {}".format(STATE_HW_PRESENT, val_int)) retval_state = STATE_HW_PRESENT - if not self.is_supported_indep_mods_system: + if not self.is_supported_indep_mods_system or (self.is_warm_reboot and 0 == self.port_control_dict[port] and not dynamic): module_sm_obj.set_final_state(retval_state, detection_method) self.register_fd_for_polling(module_sm_obj, module_sm_obj.module_fd, 'presence') return retval_state diff --git a/src/sonic-dash-api b/src/sonic-dash-api index ec15bc76c243..da6899b8962d 160000 --- a/src/sonic-dash-api +++ b/src/sonic-dash-api @@ -1 +1 @@ -Subproject commit ec15bc76c2435ae20c5034aa3fa01e05b5e59bc1 +Subproject commit da6899b8962d8823e315eae0ce563d9d6cf50f41 diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 538ec672b3bf..888075d7a8ec 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 538ec672b3bfd789559c6c3c750db6f35e8770f6 +Subproject commit 888075d7a8ec40867269a523c1771b3c2d50523a diff --git a/src/sonic-sairedis b/src/sonic-sairedis index e5b8d4e56735..a5049331b05f 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit e5b8d4e567352b96f70a00cb08d60b864b11b9e8 +Subproject commit a5049331b05f52f73eb8ab3f0a87245739180112 diff --git a/src/sonic-swss b/src/sonic-swss index d566e15a86b4..b3b6a8384aa2 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit d566e15a86b4064a2abdb0b2b3edf3ef56bdb666 +Subproject commit b3b6a8384aa2cfc2e6cb1c08312af1cbeac5c0c5 diff --git a/src/sonic-utilities b/src/sonic-utilities index b54873575fc4..a3cf5c0241f5 160000 --- a/src/sonic-utilities +++ b/src/sonic-utilities @@ -1 +1 @@ -Subproject commit b54873575fc446afdbd8f2fd6fa721e3e60398a5 +Subproject commit a3cf5c0241f5d0ea2e1e634b0a894510ff1b78b7