Skip to content

Commit db03698

Browse files
authored
fix DOM support caoability issues on QSFP and CMIS cables (#12500)
Signed-off-by: Kebo Liu <[email protected]> Signed-off-by: Kebo Liu <[email protected]>
1 parent 67b6541 commit db03698

File tree

1 file changed

+34
-2
lines changed
  • platform/mellanox/mlnx-platform-api/sonic_platform

1 file changed

+34
-2
lines changed

platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py

+34-2
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,26 @@ def _detect_sfp_type(self, sfp_type):
415415
# in this case we treat it as the default type according to the SKU
416416
self.sfp_type = sfp_type
417417

418+
def _is_qsfp_copper(self):
419+
# This function read the specification compliance byte and
420+
# ext specification compliance byte to judge whether the cable is copper or not.
421+
# It is only designed for SFF 8636 cables, SFF 8472 and CMIS cables don't apply.
422+
423+
# copper cables defined in SFF8024 "Extended Specification Compliance Codes"
424+
copper_ext_specification_list = ['08', '0b', '0c', '0d', '19', '30', '32', '40']
425+
426+
offset = PAGE00_HIGH_MEMORY_OFFSET
427+
qsfp_specification_raw = self._read_eeprom_specific_bytes(offset + XCVR_COMPLIANCE_CODE_OFFSET, 1)
428+
qsfp_specification = int(qsfp_specification_raw[0], 16)
429+
# The 4th bit of the specification complaince byte(131) indicate a 40GBASE-CR4 copper cable
430+
if qsfp_specification & 0x8:
431+
return True
432+
433+
qsfp_ext_specification_raw = self._read_eeprom_specific_bytes(offset + XCVR_EXT_SPECIFICATION_COMPLIANCE_OFFSET, XCVR_EXT_SPECIFICATION_COMPLIANCE_WIDTH)
434+
if qsfp_ext_specification_raw[0] in copper_ext_specification_list:
435+
return True
436+
437+
return False
418438

419439
def _dom_capability_detect(self):
420440
if not self.get_presence():
@@ -428,6 +448,16 @@ def _dom_capability_detect(self):
428448
return
429449

430450
if self.sfp_type == QSFP_TYPE:
451+
if self._is_qsfp_copper():
452+
self.dom_supported = False
453+
self.dom_temp_supported = False
454+
self.dom_volt_supported = False
455+
self.dom_rx_power_supported = False
456+
self.dom_tx_power_supported = False
457+
self.calibration = 0
458+
self.qsfp_page3_available = False
459+
return
460+
431461
self.calibration = 1
432462
sfpi_obj = sff8436InterfaceId()
433463
if sfpi_obj is None:
@@ -482,11 +512,11 @@ def _dom_capability_detect(self):
482512
# two types of QSFP-DD cable types supported: Copper and Optical.
483513
qsfp_dom_capability_raw = self._read_eeprom_specific_bytes((offset + XCVR_DOM_CAPABILITY_OFFSET_QSFP_DD), XCVR_DOM_CAPABILITY_WIDTH_QSFP_DD)
484514
if qsfp_dom_capability_raw is not None:
485-
self.dom_temp_supported = True
486-
self.dom_volt_supported = True
487515
dom_capability = sfpi_obj.parse_dom_capability(qsfp_dom_capability_raw, 0)
488516
if dom_capability['data']['Flat_MEM']['value'] == 'Off':
489517
self.dom_supported = True
518+
self.dom_temp_supported = True
519+
self.dom_volt_supported = True
490520
self.second_application_list = True
491521
self.dom_rx_power_supported = True
492522
self.dom_tx_power_supported = True
@@ -495,6 +525,8 @@ def _dom_capability_detect(self):
495525
self.dom_rx_tx_power_bias_supported = True
496526
else:
497527
self.dom_supported = False
528+
self.dom_temp_supported = False
529+
self.dom_volt_supported = False
498530
self.second_application_list = False
499531
self.dom_rx_power_supported = False
500532
self.dom_tx_power_supported = False

0 commit comments

Comments
 (0)