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

Adding support for get/set low power mode for QSFPs in PDDF common APIs #11786

Merged
merged 2 commits into from
Sep 9, 2022

Conversation

FuzailBrcm
Copy link
Contributor

Why I did it

Issue#11785

Unable to get/set low power mode for QSFP28 and QSFP+

Platforms which use PDDF have common PDDF platform APIs. Since sfp_refactor framework takes care of only CMIS transceivers and platform APIs are supposed to take care of the low power mode for QSFPs.

How I did it

Modified pddf_sfp.py to include get/set APIs for lpmode in case of QSFP

How to verify it

sfputil show lpmode
sfputil lpmode on/off <>

LOGS:

>>> platform_chassis.get_sfp(55).set_lpmode(True)

True

>>> 

>>> platform_chassis.get_sfp(55).get_lpmode()

True

>>> platform_chassis.get_sfp(55).set_lpmode(False)

True

>>> 

>>> platform_chassis.get_sfp(55).get_lpmode()

False

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 19, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@FuzailBrcm
Copy link
Contributor Author

@prgeor
Can you review this?

Copy link
Contributor

@jostar-yang jostar-yang left a comment

Choose a reason for hiding this comment

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

It is fine to me

@FuzailBrcm
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zhangyanzhao
Copy link
Collaborator

@prgeor can you please help to take a look and merge? Thanks.

Comment on lines 199 to 210
xcvr_id = self._xcvr_api_factory._get_id()
if xcvr_id is not None:
if xcvr_id == 0x18 or xcvr_id == 0x19 or xcvr_id == 0x1e:
# QSFP-DD or OSFP
# Use common SfpOptoeBase implementation for get_lpmode
lpmode = super().get_lpmode()
elif xcvr_id == 0x11 or xcvr_id == 0x0d or xcvr_id == 0x0c:
# QSFP28, QSFP+, QSFP
val = self.read_eeprom(QSFP_PWR_CTRL_ADDR, 1)
if val is not None:
if (ord(val) & 0x3) == 0x3:
lpmode = True
Copy link
Contributor

@prgeor prgeor Sep 2, 2022

Choose a reason for hiding this comment

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

use get_power_override for QSFP28/QSFP+. For eg see here

Comment on lines 336 to 349
xcvr_id = self._xcvr_api_factory._get_id()
if xcvr_id is not None:
if xcvr_id == 0x18 or xcvr_id == 0x19 or xcvr_id == 0x1e:
# QSFP-DD or OSFP
# Use common SfpOptoeBase implementation for set_lpmode
status = super().set_lpmode(lpmode)
elif xcvr_id == 0x11 or xcvr_id == 0x0d or xcvr_id == 0x0c:
# QSFP28, QSFP+, QSFP
val = self.read_eeprom(QSFP_PWR_CTRL_ADDR, 1)
if val is not None:
val = ord(val) & 0xf0
val |= 0x3 if lpmode else 0xd
buf = bytearray([val])
status = self.write_eeprom(QSFP_PWR_CTRL_ADDR, 1, buf)
Copy link
Contributor

Choose a reason for hiding this comment

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

use set_power_override for QSFP28/QSFP+. For eg see here

power_set = self.get_power_set()
power_override = self.get_power_override()
# By default the lpmode pin is pulled high as mentioned in the sff community
return power_set if power_override else True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check this line. We are returning True in case the power_override is not set.

SFF_8436

4.1.1.3 LPMode
The LPMode pin shall be pulled up to Vcc in the QSFP+ module. This function is affected
by the LPMode pin and the combination of the Power_over-ride and Power_set software
control bits (Address A0h, byte 93 bits 0,1).

SFF_8636

QSFP+ and QSFP28 modules have the LPMode input signal (see SFF-8679) that can be used by the host system to
force the module into Low Power Mode. Low Power Mode for those modules is defined as maximum power
consumption of 1.5W. If the LPMode input signal is pulled low by the host system, the module is then capable of
entering High Power Mode. The maximum power consumption in High Power Mode depends on the module Power
Class as advertised in the Extended Identifier (see 6.3.2), Page 00h, byte 129, bits 1-0 and 7-6.
The operation of the LPMode input signal can be overridden by the host writing a ‘1’ to byte 93, bit 0. In that case,
the function of the LPMode input signal is replaced by byte 93, bit 1.
SFF-8436 has 4 power classes from 1.5 to 3.5 W. Only bits 7-6 are used to define those power classes. At revision
1.9 of this specification, 3 new higher power classes, 4.0 W, 4.5 W, and 5.0 W were added. These power classes,
designated power classes 5, 6 and 7, are designated using bits 1-0 of the Extended Identifier byte, page 00h byte
129. In order to protect legacy host systems designed to support only the original 4 power classes, the High Power
Class Enable control was defined at byte 93, bit 2. Modules in power classes 5, 6, 7 or 8 are required to limit power
consumption to no more than a power class 4 module if the High Power Class Enable, byte 93 bit 2 control is not
set. They are not required to be functional in this situation.

@FuzailBrcm
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FuzailBrcm
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FuzailBrcm
Copy link
Contributor Author

@jostar-yang , @prgeor , @ds952811

Can you review it again?

@prgeor prgeor merged commit 0a8dd3f into sonic-net:master Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants