Skip to content

Commit

Permalink
[Mellanox] Fix typo "xSFP_VLOT_OFFSET" (#3118)
Browse files Browse the repository at this point in the history
Variables SFP_VLOT_OFFSET and QSFP_VLOT_OFFSET containing the typo are originally defined in repo sonic-platform-common. The typo has been fixed in PR #33. However, some Mellanox-specific code hasn't updated correspondingly, which results in xcvrd fail to start.
This PR updates the variable name in Mellanox-specific code correspondingly to fix that.
  • Loading branch information
stephenxs authored and lguohan committed Jul 5, 2019
1 parent cf063bd commit 20e4547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def get_transceiver_dom_info_dict(self, port_num):
else:
return transceiver_dom_info_dict

dom_voltage_raw = self._read_eeprom_specific_bytes_via_ethtool(port_num, (offset + QSFP_VLOT_OFFSET), QSFP_VOLT_WIDTH)
dom_voltage_raw = self._read_eeprom_specific_bytes_via_ethtool(port_num, (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH)
if dom_voltage_raw is not None:
dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0)
else:
Expand Down Expand Up @@ -533,7 +533,7 @@ def get_transceiver_dom_info_dict(self, port_num):
dom_temperature_raw = eeprom_domraw[SFP_TEMPE_OFFSET:SFP_TEMPE_OFFSET+SFP_TEMPE_WIDTH]
dom_temperature_data = sfpd_obj.parse_temperature(dom_temperature_raw, 0)

dom_voltage_raw = eeprom_domraw[SFP_VLOT_OFFSET:SFP_VLOT_OFFSET+SFP_VOLT_WIDTH]
dom_voltage_raw = eeprom_domraw[SFP_VOLT_OFFSET:SFP_VOLT_OFFSET+SFP_VOLT_WIDTH]
dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0)

dom_channel_monitor_raw = eeprom_domraw[SFP_CHANNL_MON_OFFSET:SFP_CHANNL_MON_OFFSET+SFP_CHANNL_MON_WIDTH]
Expand Down
12 changes: 6 additions & 6 deletions platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
QSFP_DOM_REV_WIDTH = 1
QSFP_TEMPE_OFFSET = 22
QSFP_TEMPE_WIDTH = 2
QSFP_VLOT_OFFSET = 26
QSFP_VOLT_OFFSET = 26
QSFP_VOLT_WIDTH = 2
QSFP_VERSION_COMPLIANCE_OFFSET = 1
QSFP_VERSION_COMPLIANCE_WIDTH = 1
Expand All @@ -102,7 +102,7 @@

SFP_TEMPE_OFFSET = 96
SFP_TEMPE_WIDTH = 2
SFP_VLOT_OFFSET = 98
SFP_VOLT_OFFSET = 98
SFP_VOLT_WIDTH = 2
SFP_CHANNL_MON_OFFSET = 100
SFP_CHANNL_MON_WIDTH = 6
Expand Down Expand Up @@ -617,7 +617,7 @@ def get_transceiver_bulk_status(self):
transceiver_dom_info_dict['temperature'] = 'N/A'

if self.dom_volt_supported:
dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_VLOT_OFFSET), QSFP_VOLT_WIDTH)
dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH)
if dom_voltage_raw is not None:
dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0)
volt = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value'])
Expand Down Expand Up @@ -677,7 +677,7 @@ def get_transceiver_bulk_status(self):
else:
return None

dom_voltage_raw = self._read_eeprom_specific_bytes((offset + SFP_VLOT_OFFSET), SFP_VOLT_WIDTH)
dom_voltage_raw = self._read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH)
if dom_voltage_raw is not None:
dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0)
else:
Expand Down Expand Up @@ -979,7 +979,7 @@ def get_voltage(self):
return None

if self.dom_volt_supported:
dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_VLOT_OFFSET), QSFP_VOLT_WIDTH)
dom_voltage_raw = self._read_eeprom_specific_bytes((offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH)
if dom_voltage_raw is not None:
dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0)
voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value'])
Expand All @@ -996,7 +996,7 @@ def get_voltage(self):

sfpd_obj._calibration_type = self.calibration

dom_voltage_raw = self._read_eeprom_specific_bytes((offset + SFP_VLOT_OFFSET), SFP_VOLT_WIDTH)
dom_voltage_raw = self._read_eeprom_specific_bytes((offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH)
if dom_voltage_raw is not None:
dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0)
voltage = self._convert_string_to_num(dom_voltage_data['data']['Vcc']['value'])
Expand Down

0 comments on commit 20e4547

Please sign in to comment.