Skip to content

Commit 7b04c69

Browse files
authoredApr 2, 2024··
[E1031] Update sonic_platform.sfp.Sfp class to fix xcvrd crash issue (#18495)
* [E1031] Update sonic_platform class Sfp * Add implementation for get_eeprom_path
1 parent aea7d55 commit 7b04c69

File tree

1 file changed

+8
-5
lines changed
  • device/celestica/x86_64-cel_e1031-r0/sonic_platform

1 file changed

+8
-5
lines changed
 

‎device/celestica/x86_64-cel_e1031-r0/sonic_platform/sfp.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
try:
1010
import time
1111
from ctypes import c_char
12-
from sonic_platform_base.sfp_base import SfpBase
12+
from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase
1313
from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId
1414
from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom
1515
from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId
@@ -157,7 +157,7 @@
157157
PORT_END = 55
158158

159159

160-
class Sfp(SfpBase):
160+
class Sfp(SfpOptoeBase):
161161
"""Platform-specific Sfp class"""
162162

163163
# Port I2C number
@@ -172,7 +172,7 @@ class Sfp(SfpBase):
172172
PRS_PATH = "/sys/devices/platform/e1031.smc/SFP/sfp_modabs"
173173

174174
def __init__(self, sfp_index, sfp_name):
175-
SfpBase.__init__(self)
175+
SfpOptoeBase.__init__(self)
176176

177177
# Init common function
178178
self._api_common = Common()
@@ -235,7 +235,7 @@ def _read_eeprom_specific_bytes(self, offset, num_bytes):
235235
for i in range(0, num_bytes):
236236
eeprom_raw.append("0x00")
237237

238-
sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num]
238+
sysfs_sfp_i2c_client_eeprom_path = self.get_eeprom_path()
239239
try:
240240
sysfsfile_eeprom = open(
241241
sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0)
@@ -355,6 +355,9 @@ def _dom_capability_detect(self):
355355
self.dom_rx_power_supported = False
356356
self.dom_tx_power_supported = False
357357

358+
def get_eeprom_path(self):
359+
return self.port_to_eeprom_mapping[self.port_num]
360+
358361
def get_transceiver_info(self):
359362
"""
360363
Retrieves transceiver info of this SFP
@@ -1176,7 +1179,7 @@ def tx_disable(self, tx_disable):
11761179
if self.dom_tx_disable_supported:
11771180
# SFP status/control register at address A2h, byte 110
11781181
offset = 256
1179-
sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num]
1182+
sysfs_sfp_i2c_client_eeprom_path = self.get_eeprom_path()
11801183
status_control_raw = self._read_eeprom_specific_bytes(
11811184
(offset + SFP_STATUS_CONTROL_OFFSET), SFP_STATUS_CONTROL_WIDTH)
11821185
if status_control_raw is not None:

0 commit comments

Comments
 (0)
Please sign in to comment.