Skip to content

Commit

Permalink
[xcvr_api_factory]Enhance the code in new sfp refinement to distingui…
Browse files Browse the repository at this point in the history
…sh 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]>
  • Loading branch information
hantienEdgecore committed Aug 19, 2022
1 parent e601d0e commit d9bcba3
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions sonic_platform_base/sonic_xcvr/xcvr_api_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def _get_id(self):
return None
return id_byte_raw[0]

def _get_id1(self):
id_byte1_raw = self.reader(1,1)
if id_byte1_raw is None:
return None
return id_byte1_raw[0]

def create_xcvr_api(self):
# TODO: load correct classes from id_mapping file
id = self._get_id()
Expand All @@ -58,10 +64,21 @@ def create_xcvr_api(self):
api = Sff8636Api(xcvr_eeprom)
# QSFP+
elif id == 0x0D:
codes = Sff8436Codes
mem_map = Sff8436MemMap(codes)
xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map)
api = Sff8436Api(xcvr_eeprom)
# Check page 0 offset 1 'revision compliance' according to table 6-3 in
# SFF-8636 Revision2.10a
id1 = self._get_id1()
if id1 >= 0 or id1 <= 0x02:
codes = Sff8436Codes
mem_map = Sff8436MemMap(codes)
xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map)
api = Sff8436Api(xcvr_eeprom)
elif id1 >= 0x03 and id1 <= 0x08:
codes = Sff8636Codes
mem_map = Sff8636MemMap(codes)
xcvr_eeprom = XcvrEeprom(self.reader, self.writer, mem_map)
api = Sff8636Api(xcvr_eeprom)
else:
api = None
elif id == 0x03:
codes = Sff8472Codes
mem_map = Sff8472MemMap(codes)
Expand Down

0 comments on commit d9bcba3

Please sign in to comment.