From 5e38ca0e0ac0f58ba89533315b516a76e71386e9 Mon Sep 17 00:00:00 2001 From: noaOrMlnx Date: Sun, 25 Feb 2024 08:54:49 +0000 Subject: [PATCH] [Mellanox] Fix timing issue in lpmode change --- platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py | 5 +++-- 1 file changed, 3 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 f6a9380bf6aa..8c2006cfb3d1 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. +# Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. # Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -640,7 +640,8 @@ def set_lpmode(self, lpmode): if api.get_lpmode() == lpmode: return True api.set_lpmode(lpmode) - return api.get_lpmode() == lpmode + check_lpmode = lambda api, lpmode: api.get_lpmode() == lpmode + return utils.wait_until(check_lpmode, 2, 1, api=api, lpmode=lpmode) elif DeviceDataManager.is_independent_mode(): # FW control under CMIS host management mode. # Currently, we don't support set LPM under this mode.