cfa14ce1a6
* [device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py] purpose and restrictions 1. reading eeprom via ethtool. 2. avoid changing common codes shared by all the manufacture (sonic-platform-common), contrain all the modifications with Mellanox-specific code. current implementation A new class based on SfpUtilBase and a new method _read_eeprom_specific_bytes_via_ethtool have been introduced in order to change the way the eprom DOM data is read. Typically the best practice to do this kind of thing is to contrain the modification within the function which execute reading operations only and keep other stuffs (especially the interface) untouched. However, this can hardly be achieved since the original reading function takes the file object as input parameter to represent the port. It is done by having the file object to point to /var/run/hwmanagement files, which will not be maintained in the future. As a result, a new interface has to be introduced with a port number/name as input parameter in order to get rid of the dependency on the those files: _read_eeprom_specific_bytes_via_ethtool Since the interface changed, all methods that call the interface should also be overwritten in order to call the new interface, including: _read_eeprom_devid get_transceiver_info_dict get_transceiver_dom_info_dict Only interface used to read eeprom DOM has been replaced and the main logic has not been changed except the following mentioned. 1. reading DOM data for sfp port, which is implementioned in get_transceiver_dom_info_dict. In this case a "calibration" should be firstly read from eeprom before other values like temperature, voltage, rx/tx power, can be parsed. However, this has been ignored in the original code, resulting in that the data cann't be parsed. 2. In the original implemention the data area containing the data are read from DOM separatedly in order to avoid read uncessary data and achieve a better performance. Having used ethtool to read DOM data, the performance gap between reading all the area and reading the spot data separatedly has been narrowed to almost zero. To make the code neat and readable, we change the way to read this data. * [sfputil] Returns dict with all data set to N/A for ports without dom support Currently, the way in which dom data is read has been changed from using sysfs to using ethtool. The ethtool returns None for ports without dom support, resulting in None being returned. However, this fails xcvrd to add the TRANSCEIVER_DOM_SENSOR table entry of associated port to CONFIG_DB and then causes SNMP fail. To address this issue a default dict is initialized with all data set to 'N/A' and is returned is the above case. BTW, in the original implementation which sysfs is used to read dom data, even though non-None data is returned for ports without dom support, it does not contain valid data. This can result in wrong data in TRANSCEIVER_DOM_SENSOR table. * [sfputil] removing unnecessary empty lines removing redundent code replacing hardcoding strings/numbers with predefined const variables |
||
---|---|---|
.. | ||
ACS-MSN2700 | ||
Mellanox-SN2700-C28D8 | ||
Mellanox-SN2700-D48C8 | ||
plugins | ||
default_sku | ||
installer.conf | ||
Mellanox-SN2700 | ||
platform_reboot | ||
platform_wait | ||
pmon_daemon_control.json | ||
sensors.conf |