sonic-buildimage icon indicating copy to clipboard operation
sonic-buildimage copied to clipboard

[sonic_xcvr/cmis] set_lpmdoe status get false on some 400G transceiver

Open jostar-yang opened this issue 2 years ago • 1 comments

Description

When we insert 400G-ZR transceiver to machine(accton as9716), we find sfputil setlpmode will get status false. Check sfputil show lpmode is fine and make sure eeprom can be set. We trace code and find it happen on /usr/local/lib/python3.9/dist-packages/sonic_platform_base/sonic_xcvr/api/public/cmis.py

def set_lpmode(self, lpmode): if lpmode is True: # 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) return self.get_lpmode() else: # Force transition from LowPwr to HighPower state under SW control. # This will transition LowPwrS signal to False. (see Table 6-12 CMIS v5.0) lpmode_val = lpmode_val & ~(1 << CmisApi.LowPwrRequestSW) lpmode_val = lpmode_val & ~(1 << CmisApi.LowPwrAllowRequestHW) 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

We test to modify sleep to time.sleep(2) when lpmode=on(True), return status is true. We test to modify sleep to time.sleep(4) when lpmode=off(Fasle), return status is true. Can we improve set_lpmode() in cmis.py? For example, modify as below for set lpmode=on, lpmode_val = lpmode_val | (1 << CmisApi.LowPwrRequestSW) self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val) for retries in range(50): if self.get_lpmode(): break time.sleep(0.1) return self.get_lpmode()

modify as below for set lpmode=off, return True if mstate == 'ModuleReady' or mstate=='ModulePwrUp' else False

Steps to reproduce the issue:

1.sfputil lpmode on Ethernet248 2. sfputil lpmode off Ethernet248 3. sfputil show lpmode

Describe the results you received:

sfputil lpmode on Ethernet248

Enabling low-power mode for port Ethernet248 ... Failed

sfputil lpmode off Ethernet248

Disabling low-power mode for port Ethernet248 ... Failed

Describe the results you expected:

sfputil lpmode on Ethernet248

Enabling low-power mode for port Ethernet248 ... OK

sfputil lpmode off Ethernet248

Disabling low-power mode for port Ethernet248 ... OK

Output of show version:

root@sonic:~# show version

SONiC Software Version: SONiC.master.0-4216f3445 Distribution: Debian 11.5 Kernel: 5.10.0-12-2-amd64 Build commit: 4216f3445 Build date: Tue Nov 1 09:38:39 UTC 2022

(paste your output here)

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

jostar-yang avatar Nov 11 '22 07:11 jostar-yang

Thanks for opening this issue!