Skip to content
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

[sonic_xcvr/cmis] Tune to set_lpmode status for 400G-ZR #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please get the exact time taken by the module to get into LP mode?.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We test set lpmode to on, need 2sec and can get status=True.
For lpmode=off, it need 3-4sec and can get get status=True. Otherwise , they will get false in current code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jostar-yang please use get_datapath_deinit_duration() to know how much time it take for module to transition to LowPwr mode i.e ModuleDeactivatedT

Copy link
Author

@jostar-yang jostar-yang Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call get_datapath_init_duration until mstate == 'ModuleReady'. It get "60000".
root@sonic:~# sfputil lpmode off Ethernet248
Disabling low-power mode for port Ethernet248 ... 1:spend set_lpmdoe=off ,use 54.217353sec
BB:get dp_init_time=60000.000000

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jostar-yang please update the code to read the timeout value and wait max duration for the advertised timeout

if self.get_lpmode():
break
time.sleep(0.1)

return self.get_lpmode()
else:
# Force transition from LowPwr to HighPower state under SW control.
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModulePwrUp is a transient state. Why do we need to check this state here?.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we try to do retry, it seems need 3-4sec until status=True on ZR. Or can you advise?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait for ModuleReady on ZR will need 3-4sec on ZR, so we try to use ModulePwrUp. And it can get status=True.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must check the steady state of the module. i.e. We will have to wait till the module reaches "ModuleReady" state.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I retest and check spend time for set_lpmode=on. It spend time from 0.24 to 0.4sec on 400G-ZR until it get status=True. For set off, it speed time about 55sec until get ModuleReady.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jostar-yang please try using get_datapath_init_duration() timeout to know how much time module can takes to transition from LowPwr to ModuleReady

Copy link
Author

@jostar-yang jostar-yang Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call self.get_datapath_deinit_duration() after self.get_lpmode()==True. API,get_datapath_init_duration, return "5000". What is unit for the API return code?
root@sonic:~# sfputil lpmode on Ethernet248
Enabling low-power mode for port Ethernet248 ... spend set_lpmdoe=on ,use 0.248994sec
CC:get dp_deinit_time=5000.000000
OK

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jostar-yang Thanks. Please use this timeout value to wait upto max timeout duration.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you means use "dp_deinit_time=5000" to be timeout value? What is it's unit? Is unit ms or us?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Check sonic_xcvr/codes/public/cmis.py and CMIS SPEC. Unit seems is ms. "5000" is from "0111b" that mapping to "1 s <= Tstate < 5 s"


return False

def get_loopback_capability(self):
Expand Down