Skip to content

Commit

Permalink
Don't read AUX_MON_TYPE if memory model is flat (sonic-net#339)
Browse files Browse the repository at this point in the history
Description
Add error handling to get_aux_mon_type API

Motivation and Context
get_aux_mon_type reads field consts.AUX_MON_TYPE in eeprom on page 1 address 145
If memory model is flat, there is no page 1 in eeprom, only 0_lower and 0_upper
Here get_aux_mon_type doesn't check whether memory model is not flat, this causes errors in running xcvrd

How Has This Been Tested?
Tested on testbed, assured that logs of failed eeprom reading disappeared
  • Loading branch information
dmytroxIntel committed Jan 5, 2023
1 parent 676b329 commit 9df998b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def get_aux_mon_type(self):
'''
This function returns the aux monitor types
'''
result = self.xcvr_eeprom.read(consts.AUX_MON_TYPE)
result = self.xcvr_eeprom.read(consts.AUX_MON_TYPE) if not self.is_flat_memory() else None
if result is None:
return None
aux1_mon_type = result & 0x1
Expand Down

0 comments on commit 9df998b

Please sign in to comment.