Skip to content

Commit

Permalink
[Mellanox] Verify the value of the control type sysfs before changing…
Browse files Browse the repository at this point in the history
… it to FW control (#19046)

- Why I did it
On Mellanox platforms, changing the control type sysfs value is not supported for ports that are set to firmware control. Therefore, attempting to change this value to firmware control will result in an error log, which we want to avoid.

- How I did it
I added a check to ensure that the control sysfs value is set to firmware control only if it is not already in firmware control.

- How to verify it
Ensure that after a warm reboot on the Mellanox platform (an attempt to change the sysfs value from fw_control to fw_control is only applicable in this scenario), the following error does not appear:
sxd_kernel: [error] sx_core_set_module_control: Failed control change: module is dependent (FW control).
  • Loading branch information
tshalvi authored and mssonicbld committed May 29, 2024
1 parent 006f940 commit e316055
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,8 +1493,9 @@ def action_on_sw_control(cls, sfp):

@classmethod
def action_on_fw_control(cls, sfp):
logger.log_info(f'SFP {sfp.sdk_index} is set to firmware control')
sfp.set_control_type(SFP_FW_CONTROL)
if sfp.get_control_type() != SFP_FW_CONTROL:
logger.log_info(f'SFP {sfp.sdk_index} is set to firmware control')
sfp.set_control_type(SFP_FW_CONTROL)

@classmethod
def action_on_cancel_wait(cls, sfp):
Expand Down

0 comments on commit e316055

Please sign in to comment.