Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mellanox] fix the issue that failing to test whether dom supported prior to reading dom data #3120

Merged
merged 3 commits into from
Jul 6, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))

#sfp supports dom
stephenxs marked this conversation as resolved.
Show resolved Hide resolved
XCVR_DOM_CAPABILITY_DOM_SUPPORT_BIT = 0x40

# parameters for DB connection
REDIS_HOSTNAME = "localhost"
REDIS_PORT = 6379
Expand Down Expand Up @@ -517,10 +520,15 @@ def get_transceiver_dom_info_dict(self, port_num):
offset = 256

eeprom_raw = ['0'] * 256
stephenxs marked this conversation as resolved.
Show resolved Hide resolved
eeprom_raw[92:92+16] = self._read_eeprom_specific_bytes_via_ethtool(port_num, 92, 16)
eeprom_raw[XCVR_DOM_CAPABILITY_OFFSET : XCVR_DOM_CAPABILITY_OFFSET + XCVR_DOM_CAPABILITY_WIDTH] = \
self._read_eeprom_specific_bytes_via_ethtool(port_num, XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH)
sfp_obj = sff8472InterfaceId()
calibration_type = sfp_obj._get_calibration_type(eeprom_raw)

dom_supported = (int(eeprom_raw[XCVR_DOM_CAPABILITY_OFFSET], 16) & XCVR_DOM_CAPABILITY_DOM_SUPPORT_BIT != 0)
if not dom_supported:
return transceiver_dom_info_dict

eeprom_domraw = self._read_eeprom_specific_bytes_via_ethtool(port_num, offset, 256)
stephenxs marked this conversation as resolved.
Show resolved Hide resolved
if eeprom_domraw is None:
return transceiver_dom_info_dict
Expand Down