Skip to content

Commit d9bcba3

Browse files
[xcvr_api_factory]Enhance the code in new sfp refinement to distinguish sff8436 and sff8636
Check page 0 offset 1 'revision compliance' according to table 6-3 in SFF8636 Revision2.10a Signed-off-by: [email protected] <[email protected]>
1 parent e601d0e commit d9bcba3

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

sonic_platform_base/sonic_xcvr/xcvr_api_factory.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ def _get_id(self):
3636
return None
3737
return id_byte_raw[0]
3838

39+
def _get_id1(self):
40+
id_byte1_raw = self.reader(1,1)
41+
if id_byte1_raw is None:
42+
return None
43+
return id_byte1_raw[0]
44+
3945
def create_xcvr_api(self):
4046
# TODO: load correct classes from id_mapping file
4147
id = self._get_id()
@@ -58,10 +64,21 @@ def create_xcvr_api(self):
5864
api = Sff8636Api(xcvr_eeprom)
5965
# QSFP+
6066
elif id == 0x0D:
61-
codes = Sff8436Codes
62-
mem_map = Sff8436MemMap(codes)
63-
xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map)
64-
api = Sff8436Api(xcvr_eeprom)
67+
# Check page 0 offset 1 'revision compliance' according to table 6-3 in
68+
# SFF-8636 Revision2.10a
69+
id1 = self._get_id1()
70+
if id1 >= 0 or id1 <= 0x02:
71+
codes = Sff8436Codes
72+
mem_map = Sff8436MemMap(codes)
73+
xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map)
74+
api = Sff8436Api(xcvr_eeprom)
75+
elif id1 >= 0x03 and id1 <= 0x08:
76+
codes = Sff8636Codes
77+
mem_map = Sff8636MemMap(codes)
78+
xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map)
79+
api = Sff8636Api(xcvr_eeprom)
80+
else:
81+
api = None
6582
elif id == 0x03:
6683
codes = Sff8472Codes
6784
mem_map = Sff8472MemMap(codes)

0 commit comments

Comments
 (0)