From d46fd9189c8f5eddeed1ad43b891c5829ae5ac2c Mon Sep 17 00:00:00 2001 From: Yair Raviv Date: Sun, 2 Aug 2026 09:58:58 +0300 Subject: [PATCH] [orchagent]: Extend syncd response timeout for APPLY_VIEW Signed-off-by: Yair Raviv --- orchagent/main.cpp | 21 +++++++++++++++++++++ orchagent/saihelper.cpp | 5 ----- orchagent/saihelper.h | 6 ++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/orchagent/main.cpp b/orchagent/main.cpp index 5b4285b6c27..77146d8552e 100644 --- a/orchagent/main.cpp +++ b/orchagent/main.cpp @@ -193,10 +193,31 @@ void syncd_apply_view() sai_status_t status; sai_attribute_t attr; + char *platform = getenv("platform"); + + /* syncd runs the view comparison and the ASIC_DB rewrite inside this single + * notification. Both scale with the number of objects and exceed the default + * response timeout at high route scale, so allow the long timeout here. */ + if (platform && strstr(platform, MLNX_PLATFORM_SUBSTRING)) + { + SWSS_LOG_NOTICE("Set SAI REDIS response timeout to %d for Mellanox platform, to extend the timeout for apply view", SAI_REDIS_SYNC_OPERATION_RESPONSE_TIMEOUT); + attr.id = SAI_REDIS_SWITCH_ATTR_SYNC_OPERATION_RESPONSE_TIMEOUT; + attr.value.u64 = SAI_REDIS_SYNC_OPERATION_RESPONSE_TIMEOUT; + sai_switch_api->set_switch_attribute(gSwitchId, &attr); + } + attr.id = SAI_REDIS_SWITCH_ATTR_NOTIFY_SYNCD; attr.value.s32 = SAI_REDIS_NOTIFY_SYNCD_APPLY_VIEW; status = sai_switch_api->set_switch_attribute(gSwitchId, &attr); + if (platform && strstr(platform, MLNX_PLATFORM_SUBSTRING)) + { + SWSS_LOG_NOTICE("Set SAI REDIS response timeout to %d for Mellanox platform, to restore the default timeout", SAI_REDIS_DEFAULT_SYNC_OPERATION_RESPONSE_TIMEOUT); + attr.id = SAI_REDIS_SWITCH_ATTR_SYNC_OPERATION_RESPONSE_TIMEOUT; + attr.value.u64 = SAI_REDIS_DEFAULT_SYNC_OPERATION_RESPONSE_TIMEOUT; + sai_switch_api->set_switch_attribute(gSwitchId, &attr); + } + if (status != SAI_STATUS_SUCCESS) { SWSS_LOG_ERROR("Failed to notify syncd APPLY_VIEW %d", status); diff --git a/orchagent/saihelper.cpp b/orchagent/saihelper.cpp index f0458ec18ae..c9dbffecd24 100644 --- a/orchagent/saihelper.cpp +++ b/orchagent/saihelper.cpp @@ -32,11 +32,6 @@ using namespace swss; #define STR(s) _STR(s) #define CONTEXT_CFG_FILE "/usr/share/sonic/hwsku/context_config.json" -#if defined(__arm__) -#define SAI_REDIS_SYNC_OPERATION_RESPONSE_TIMEOUT ((480*1000)*2) -#else -#define SAI_REDIS_SYNC_OPERATION_RESPONSE_TIMEOUT (480*1000) -#endif // hwinfo = "INTERFACE_NAME/PHY ID", mii_ioctl_data->phy_id is a __u16 #define HWINFO_MAX_SIZE IFNAMSIZ + 1 + 5 diff --git a/orchagent/saihelper.h b/orchagent/saihelper.h index c149b45ed89..be416e584f5 100644 --- a/orchagent/saihelper.h +++ b/orchagent/saihelper.h @@ -16,6 +16,12 @@ extern "C" { #define IS_ATTR_ID_IN_RANGE(attrId, objectType, attrPrefix) \ ((attrId) >= SAI_ ## objectType ## _ATTR_ ## attrPrefix ## _START && (attrId) <= SAI_ ## objectType ## _ATTR_ ## attrPrefix ## _END) +#if defined(__arm__) +#define SAI_REDIS_SYNC_OPERATION_RESPONSE_TIMEOUT ((480*1000)*2) +#else +#define SAI_REDIS_SYNC_OPERATION_RESPONSE_TIMEOUT (480*1000) +#endif + void initFlexCounterTables(); void initSaiApi(); void initSaiRedis();