Dell: S6100 fix xcvrd crash (#10062)

This commit is contained in:
Aravind Mani 2022-03-01 02:43:52 +05:30 committed by GitHub
parent afa18e2856
commit 6c31fc65ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -20,6 +20,7 @@ try:
from sonic_platform.psu import Psu from sonic_platform.psu import Psu
from sonic_platform.thermal import Thermal from sonic_platform.thermal import Thermal
from sonic_platform.watchdog import Watchdog, WatchdogTCO from sonic_platform.watchdog import Watchdog, WatchdogTCO
from sonic_platform.sfp import Sfp
except ImportError as e: except ImportError as e:
raise ImportError(str(e) + "- required module not found") raise ImportError(str(e) + "- required module not found")
@ -76,6 +77,15 @@ class Chassis(ChassisBase):
self._module_list.append(module) self._module_list.append(module)
self._sfp_list.extend(module._sfp_list) self._sfp_list.extend(module._sfp_list)
#SFP ports
sfp_port = 11
for index in range(64,66):
eeprom_path = "/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom".format(sfp_port)
sfp_control = ""
sfp_node = Sfp(index, 'SFP', eeprom_path, sfp_control, index)
self._sfp_list.append(sfp_node)
sfp_port = sfp_port + 1
for i in range(MAX_S6100_FANTRAY): for i in range(MAX_S6100_FANTRAY):
fandrawer = FanDrawer(i) fandrawer = FanDrawer(i)
self._fan_drawer_list.append(fandrawer) self._fan_drawer_list.append(fandrawer)

View File

@ -10,6 +10,7 @@
try: try:
import os import os
import syslog
import time import time
from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase
except ImportError as e: except ImportError as e:
@ -42,6 +43,9 @@ class Sfp(SfpOptoeBase):
""" """
Retrieves the presence of the sfp Retrieves the presence of the sfp
""" """
if self.index > 64:
return False
presence_ctrl = self.sfp_control + 'qsfp_modprs' presence_ctrl = self.sfp_control + 'qsfp_modprs'
try: try:
reg_file = open(presence_ctrl) reg_file = open(presence_ctrl)
@ -69,6 +73,9 @@ class Sfp(SfpOptoeBase):
""" """
Retrieves the reset status of SFP Retrieves the reset status of SFP
""" """
if self.index > 64:
return False
reset_status = None reset_status = None
reset_ctrl = self.sfp_control + 'qsfp_reset' reset_ctrl = self.sfp_control + 'qsfp_reset'
try: try:
@ -100,6 +107,9 @@ class Sfp(SfpOptoeBase):
""" """
Retrieves the lpmode (low power mode) status of this SFP Retrieves the lpmode (low power mode) status of this SFP
""" """
if self.index > 64:
return False
lpmode_ctrl = self.sfp_control + 'qsfp_lpmode' lpmode_ctrl = self.sfp_control + 'qsfp_lpmode'
try: try:
reg_file = open(lpmode_ctrl, "r+") reg_file = open(lpmode_ctrl, "r+")
@ -133,6 +143,9 @@ class Sfp(SfpOptoeBase):
""" """
Reset SFP and return all user module settings to their default srate. Reset SFP and return all user module settings to their default srate.
""" """
if self.index > 64:
return False
reset_ctrl = self.sfp_control + 'qsfp_reset' reset_ctrl = self.sfp_control + 'qsfp_reset'
try: try:
# Open reset_ctrl in both read & write mode # Open reset_ctrl in both read & write mode
@ -178,6 +191,9 @@ class Sfp(SfpOptoeBase):
""" """
Sets the lpmode (low power mode) of SFP Sets the lpmode (low power mode) of SFP
""" """
if self.index > 64:
return False
lpmode_ctrl = self.sfp_control + 'qsfp_lpmode' lpmode_ctrl = self.sfp_control + 'qsfp_lpmode'
try: try:
reg_file = open(lpmode_ctrl, "r+") reg_file = open(lpmode_ctrl, "r+")