Skip to content

Commit c2aac75

Browse files
[SFP-Refactor] Fix LP mode API issue (#247)
* [SFP-Refactor] Fix LP mode API issue * update API
1 parent dba17c8 commit c2aac75

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

sonic_platform_base/sonic_xcvr/api/public/cmis.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,18 @@ def set_lpmode(self, lpmode):
898898
if lpmode_val is not None:
899899
if lpmode is True:
900900
lpmode_val = lpmode_val | (1 << 4)
901+
self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val)
902+
time.sleep(0.1)
903+
return self.get_lpmode()
901904
else:
902905
lpmode_val = lpmode_val & ~(1 << 4)
903-
self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val)
904-
time.sleep(0.1)
905-
return self.get_lpmode()
906+
self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val)
907+
time.sleep(1)
908+
lpmode = self.xcvr_eeprom.read(consts.TRANS_MODULE_STATUS_FIELD)
909+
if lpmode is not None:
910+
if lpmode.get('ModuleState') == 'ModuleReady':
911+
return True
912+
return False
906913
return False
907914

908915
def get_loopback_capability(self):

sonic_platform_base/sonic_xcvr/sfp_optoe_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def set_lpmode(self, lpmode):
144144
vendors has to implement accordingly.
145145
"""
146146
api = self.get_xcvr_api()
147-
return api.set_lp_mode(lpmode) if api is not None else None
147+
return api.set_lpmode(lpmode) if api is not None else None
148148

149149
def set_optoe_write_max(self, write_max):
150150
sys_path = self.get_eeprom_path()

0 commit comments

Comments
 (0)