Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jostar-yang opened this issue Nov 11, 2022 · 1 comment
Open
Assignees
Labels
BRCM Triaged this issue has been triaged

Comments

@jostar-yang
Copy link
Contributor

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: 4216f34
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):

@azure-pipelines-wrapper
Copy link

Thanks for opening this issue!

@judyjoseph judyjoseph added YANG YANG model related changes Triaged this issue has been triaged BRCM and removed YANG YANG model related changes labels Nov 23, 2022
@adyeung adyeung assigned jostar-yang and unassigned adyeung Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BRCM Triaged this issue has been triaged
Projects
None yet
Development

No branches or pull requests

3 participants