From a0d4534810b92fbfb9596ea7e02284d035e9b8b8 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox Date: Wed, 25 Oct 2023 05:06:18 +0300 Subject: [PATCH] Remove flat mode to avoid confusion --- sonic_platform_base/sfp_base.py | 6 ++---- sonic_platform_base/sonic_xcvr/api/public/sff8472.py | 2 +- sonic_platform_base/sonic_xcvr/api/xcvr_api.py | 3 +-- sonic_platform_base/sonic_xcvr/sfp_optoe_base.py | 8 ++++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/sonic_platform_base/sfp_base.py b/sonic_platform_base/sfp_base.py index 8e11d7dac..5c9488cc3 100644 --- a/sonic_platform_base/sfp_base.py +++ b/sonic_platform_base/sfp_base.py @@ -422,7 +422,7 @@ def read_eeprom(self, offset, num_bytes): """ raise NotImplementedError - def read_eeprom_by_page(self, page, offset, size, wire_addr=None, flat=False): + def read_eeprom_by_page(self, page, offset, size, wire_addr=None): """ Read EEPROM by page @@ -431,7 +431,6 @@ def read_eeprom_by_page(self, page, offset, size, wire_addr=None, flat=False): offset: EEPROM page offset. Raise ValueError for invalid offset. size: Number of bytes to be read. Raise ValueError for invalid size. wire_addr: Wire address. Only valid for sff8472. Raise ValueError for invalid wire address. - flat: Read mode. Returns: A string contains the hex format EEPROM data. @@ -456,7 +455,7 @@ def write_eeprom(self, offset, num_bytes, write_buffer): """ raise NotImplementedError - def write_eeprom_by_page(self, page, offset, data, wire_addr=None, flat=False): + def write_eeprom_by_page(self, page, offset, data, wire_addr=None): """ Write EEPROM by page @@ -465,7 +464,6 @@ def write_eeprom_by_page(self, page, offset, data, wire_addr=None, flat=False): offset: EEPROM page offset. Raise ValueError for invalid offset. data: bytearray EEPROM data. wire_addr: Wire address. Only valid for sff8472. Raise ValueError for invalid wire address. - flat: Write mode. Returns: True if write successfully else False diff --git a/sonic_platform_base/sonic_xcvr/api/public/sff8472.py b/sonic_platform_base/sonic_xcvr/api/public/sff8472.py index ff635ee30..29d03a973 100644 --- a/sonic_platform_base/sonic_xcvr/api/public/sff8472.py +++ b/sonic_platform_base/sonic_xcvr/api/public/sff8472.py @@ -307,7 +307,7 @@ def get_power_override_support(self): def is_copper(self): return self.xcvr_eeprom.read(consts.SFP_CABLE_TECH_FIELD) == 'Passive Cable' - def get_overall_offset(self, page, offset, size, wire_addr=None, flat=False): + def get_overall_offset(self, page, offset, size, wire_addr=None): if not wire_addr: raise ValueError("Invalid wire address for sff8472, must a0h or a2h") diff --git a/sonic_platform_base/sonic_xcvr/api/xcvr_api.py b/sonic_platform_base/sonic_xcvr/api/xcvr_api.py index bf38f40ee..06ed2c8f7 100644 --- a/sonic_platform_base/sonic_xcvr/api/xcvr_api.py +++ b/sonic_platform_base/sonic_xcvr/api/xcvr_api.py @@ -645,7 +645,7 @@ def get_error_description(self): """ raise NotImplementedError - def get_overall_offset(self, page, offset, size, wire_addr=None, flat=False): + def get_overall_offset(self, page, offset, size, wire_addr=None): """ Retrieves the overall offset of the given page, offset and size @@ -654,7 +654,6 @@ def get_overall_offset(self, page, offset, size, wire_addr=None, flat=False): offset: The offset within the page size: The size of the data wire_addr: Wire address. Only valid for sff8472. Raise ValueError for invalid wire address. - flat: A boolean, True if flat mode Returns: The overall offset diff --git a/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py b/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py index cc959abbc..dc10cbef3 100644 --- a/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py +++ b/sonic_platform_base/sonic_xcvr/sfp_optoe_base.py @@ -183,9 +183,9 @@ def read_eeprom(self, offset, num_bytes): except (OSError, IOError): return None - def read_eeprom_by_page(self, page, offset, size, wire_addr=None, flat=False): + def read_eeprom_by_page(self, page, offset, size, wire_addr=None): api = self.get_xcvr_api() - overall_offset = api.get_overall_offset(page, offset, size, wire_addr, flat) if api is not None else None + overall_offset = api.get_overall_offset(page, offset, size, wire_addr) if api is not None else None if overall_offset is None: return None return self.read_eeprom(overall_offset, size) @@ -199,9 +199,9 @@ def write_eeprom(self, offset, num_bytes, write_buffer): return False return True - def write_eeprom_by_page(self, page, offset, data, wire_addr=None, flat=False): + def write_eeprom_by_page(self, page, offset, data, wire_addr=None): api = self.get_xcvr_api() - overall_offset = api.get_overall_offset(page, offset, len(data), wire_addr, flat) if api is not None else None + overall_offset = api.get_overall_offset(page, offset, len(data), wire_addr) if api is not None else None if overall_offset is None: return False return self.write_eeprom(overall_offset, len(data), data)