From f549e3c20a8d8e4bf2b7f214bb3106e6737167fe Mon Sep 17 00:00:00 2001 From: jostar-yang Date: Tue, 22 Nov 2022 14:27:57 +0800 Subject: [PATCH] [sonic_xcvr/cmis] Tune to set_lpmode status for 400G-ZR Signed-off-by: jostar-yang --- sonic_platform_base/sonic_xcvr/api/public/cmis.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sonic_platform_base/sonic_xcvr/api/public/cmis.py b/sonic_platform_base/sonic_xcvr/api/public/cmis.py index b9f3f6723..638789e7f 100644 --- a/sonic_platform_base/sonic_xcvr/api/public/cmis.py +++ b/sonic_platform_base/sonic_xcvr/api/public/cmis.py @@ -965,7 +965,11 @@ def set_lpmode(self, lpmode): # Force module transition to LowPwr under SW control lpmode_val = lpmode_val | (1 << CmisApi.LowPwrRequestSW) self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val) - time.sleep(0.1) + for retries in range(50): + if self.get_lpmode(): + break + time.sleep(0.1) + return self.get_lpmode() else: # Force transition from LowPwr to HighPower state under SW control. @@ -975,7 +979,8 @@ def set_lpmode(self, lpmode): self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val) time.sleep(1) mstate = self.get_module_state() - return True if mstate == 'ModuleReady' else False + return True if mstate == 'ModuleReady' or mstate=='ModulePwrUp' else False + return False def get_loopback_capability(self):