Skip to content

Commit

Permalink
Remove flat mode to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
Junchao-Mellanox committed Nov 16, 2023
1 parent 1ade0cd commit a0d4534
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
6 changes: 2 additions & 4 deletions sonic_platform_base/sfp_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_xcvr/api/public/sff8472.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
3 changes: 1 addition & 2 deletions sonic_platform_base/sonic_xcvr/api/xcvr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions sonic_platform_base/sonic_xcvr/sfp_optoe_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit a0d4534

Please sign in to comment.