From 514412dede2f423d651ce57dc281e0b6a9f4a43b Mon Sep 17 00:00:00 2001 From: Andriy Yurkiv Date: Wed, 13 Apr 2022 11:45:44 +0000 Subject: [PATCH] [Mellanox] Credo Y-cable | add more log info, checks, fix exception message --- platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 7ebe9d5e5e57..efaf3479b6ed 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -187,7 +187,7 @@ def write_mlxreg_eeprom(self, num_bytes, dword, device_address, page): --set {} -y".format(self.mst_pci_device, self.slot_id, self.sdk_index, device_address, page, num_bytes, dword) subprocess.check_call(cmd, shell=True, universal_newlines=True, stdout=subprocess.DEVNULL) except subprocess.CalledProcessError as e: - logger.log_error("Error! Unable to write data for {} port, page {} offset {}, rc = {}, err msg: {}".format(self.sdk_index, page, device_address, e.returncode, e.output)) + logger.log_error("Error! Unable to write data dword={} for {} port, page {} offset {}, rc = {}, err msg: {}".format(dword, self.sdk_index, page, device_address, e.returncode, e.output)) return False return True @@ -198,11 +198,14 @@ def read_mlxred_eeprom(self, offset, page, num_bytes): --get".format(self.mst_pci_device, self.slot_id, self.sdk_index, offset, page, num_bytes) result = subprocess.check_output(cmd, universal_newlines=True, shell=True) except subprocess.CalledProcessError as e: - logger.log_error("Error! Unable to write data for {} port, page {} offset {}, rc = {}, err msg: {}".format(self.sdk_index, page, device_address, e.returncode, e.output)) + logger.log_error("Error! Unable to read data for {} port, page {} offset {}, rc = {}, err msg: {}".format(self.sdk_index, page, offset, e.returncode, e.output)) return None return result def parse_mlxreg_read_output(self, read_output, num_bytes): + if not read_output: + return None + res = "" dword_num = num_bytes // BYTES_IN_DWORD used_bytes_in_dword = num_bytes % BYTES_IN_DWORD