From 54823dc68be65708b76c265b42ec014af0cb6d63 Mon Sep 17 00:00:00 2001 From: davidza Date: Tue, 13 Aug 2024 11:13:44 +0300 Subject: [PATCH 1/4] Fix the SAI status check for unsupported API on SAI_SWITCH_ATTR_SUPPORTED_OBJECT_TYPE_LIST --- orchagent/portsorch.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 14b6d17847..f660937dd2 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -440,7 +440,8 @@ static bool isPathTracingSupported() } } } - else if (status == SAI_STATUS_ATTR_NOT_IMPLEMENTED_0) + else if (SAI_STATUS_IS_ATTR_NOT_SUPPORTED(status) || SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(status) + || status == SAI_STATUS_NOT_SUPPORTED || status == SAI_STATUS_NOT_IMPLEMENTED) { SWSS_LOG_INFO("Querying OBJECT_TYPE_LIST is not supported on this platform"); return false; @@ -448,7 +449,7 @@ static bool isPathTracingSupported() else { SWSS_LOG_ERROR( - "Failed to get a list of supported switch capabilities. Error=%d", status + "Failed to get a list of supported switch capabilities. Error= 0x%x", status ); return false; } From 2e6b284d7bc02f029e1d7c5cd954fd28c594d415 Mon Sep 17 00:00:00 2001 From: davidza Date: Tue, 13 Aug 2024 16:28:56 +0300 Subject: [PATCH 2/4] Update type of status --- orchagent/portsorch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index f660937dd2..d12a5c48df 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -424,7 +424,7 @@ static bool isPathTracingSupported() attr.value.s32list.list = switchCapabilities.data(); bool is_tam_supported = false; - auto status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr); + sai_status_t status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr); if (status == SAI_STATUS_SUCCESS) { for (std::uint32_t i = 0; i < attr.value.s32list.count; i++) From fbc63c27adbe5d7096871f35d37e35dfb8af9a93 Mon Sep 17 00:00:00 2001 From: davidza Date: Thu, 5 Sep 2024 14:11:11 +0300 Subject: [PATCH 3/4] Change status type back to auto --- orchagent/portsorch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index d12a5c48df..f660937dd2 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -424,7 +424,7 @@ static bool isPathTracingSupported() attr.value.s32list.list = switchCapabilities.data(); bool is_tam_supported = false; - sai_status_t status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr); + auto status = sai_switch_api->get_switch_attribute(gSwitchId, 1, &attr); if (status == SAI_STATUS_SUCCESS) { for (std::uint32_t i = 0; i < attr.value.s32list.count; i++) From b9b8cafd74b3b1d44546b16e2619df2e3ffafca4 Mon Sep 17 00:00:00 2001 From: davidza Date: Thu, 5 Sep 2024 15:59:10 +0300 Subject: [PATCH 4/4] Change status error print back to decimal --- orchagent/portsorch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index f660937dd2..09caa28a5d 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -449,7 +449,7 @@ static bool isPathTracingSupported() else { SWSS_LOG_ERROR( - "Failed to get a list of supported switch capabilities. Error= 0x%x", status + "Failed to get a list of supported switch capabilities. Error=%d", status ); return false; }