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

* Adding support for get/set low pwer mode for QSFPs in PDDF common APIs

* Adding support for get/set low pwer mode for QSFPs in PDDF common APIs - Review comments
This commit is contained in:
FuzailBrcm 2022-09-10 03:03:12 +05:30 committed by GitHub
parent 966fe0d210
commit 0a8dd3f4f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,8 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
QSFP_PWR_CTRL_ADDR = 93
class PddfSfp(SfpOptoeBase):
"""
@ -194,8 +196,18 @@ class PddfSfp(SfpOptoeBase):
else:
lpmode = False
else:
# Use common SfpOptoeBase implementation for get_lpmode
lpmode = super().get_lpmode()
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
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
return lpmode
@ -321,8 +333,18 @@ class PddfSfp(SfpOptoeBase):
except IOError as e:
status = False
else:
# Use common SfpOptoeBase implementation for set_lpmode
status = super().set_lpmode(lpmode)
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
if lpmode is True:
self.set_power_override(True, True)
else:
self.set_power_override(True, False)
return status