From 0a3a713c4ed033382ceaacf8b033298eda565953 Mon Sep 17 00:00:00 2001 From: Brad House Date: Wed, 27 Nov 2024 17:58:09 -0500 Subject: [PATCH] Workaround for https://github.com/sonic-net/sonic-buildimage/issues/20725 --- syncd/SaiDiscovery.cpp | 67 ++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 42 deletions(-) diff --git a/syncd/SaiDiscovery.cpp b/syncd/SaiDiscovery.cpp index c99a5fbe3..91b8f6e6a 100644 --- a/syncd/SaiDiscovery.cpp +++ b/syncd/SaiDiscovery.cpp @@ -140,6 +140,31 @@ void SaiDiscovery::discover( continue; } + /* Workaround for https://github.com/sonic-net/sonic-buildimage/issues/20725 + * Error: + * `SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST (on SAI_OBJECT_TYPE_PORT RID oid:0x20100000000) got value oid:0x559ac8beda80 objectTypeQuery returned NULL object type` + * > that attribute was recently added in 2024/10/7 + * + * > so what i expect is happening, vendor have some custom/private attribute after + * > SAI_PORT_ATTR_END, on older version of SAI headers which have the same enum value + * > as SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST, which causes syncd think that + * > SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST is implemented when actually this is private + * > internal attribute + * + * Introduced in https://github.com/opencomputeproject/SAI/pull/1941 + * NOTE: attempting to catch ot == SAI_OBJECT_TYPE_NULL is insufficient, we need to actually ignore + * any attributes >= SAI_PORT_ATTR_STATS_COUNT_MODE until broadcom's sai is fixed. + */ + if (md->attrid >= SAI_PORT_ATTR_STATS_COUNT_MODE) { + SWSS_LOG_WARN("Skipping %s(%X) (on %s RID %s) idx %d. Due to Issue sonic-buildimage#20725.", + md->attridname, + (unsigned int)md->attrid, + sai_serialize_object_type(md->objecttype).c_str(), + sai_serialize_object_id(rid).c_str(), + idx); + continue; + } + if (md->attrvaluetype == SAI_ATTR_VALUE_TYPE_OBJECT_ID) { if (md->defaultvaluetype == SAI_DEFAULT_VALUE_TYPE_CONST) @@ -207,27 +232,6 @@ void SaiDiscovery::discover( if (ot == SAI_OBJECT_TYPE_NULL) { - /* Workaround for https://github.com/sonic-net/sonic-buildimage/issues/20725 - * Error: - * `SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST (on SAI_OBJECT_TYPE_PORT RID oid:0x20100000000) got value oid:0x559ac8beda80 objectTypeQuery returned NULL object type` - * > that attribute was recently added in 2024/10/7 - * - * > so what i expect is happening, vendor have some custom/private attribute after - * > SAI_PORT_ATTR_END, on older version of SAI headers which have the same enum value - * > as SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST, which causes syncd think that - * > SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST is implemented when actually this is private - * > internal attribute - */ - if (md->attrid >= SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST) { - SWSS_LOG_WARN("query %s(%X) (on %s RID %s) got value %s, but objectTypeQuery returned NULL. Likely a vendor bug, skipping.", - md->attridname, - (unsigned int)md->attrid, - sai_serialize_object_type(md->objecttype).c_str(), - sai_serialize_object_id(rid).c_str(), - sai_serialize_object_id(attr.value.oid).c_str()); - continue; - } - SWSS_LOG_THROW("when query %s (on %s RID %s) got value %s objectTypeQuery returned NULL object type", md->attridname, sai_serialize_object_type(md->objecttype).c_str(), @@ -285,27 +289,6 @@ void SaiDiscovery::discover( if (ot == SAI_OBJECT_TYPE_NULL) { - /* Workaround for https://github.com/sonic-net/sonic-buildimage/issues/20725 - * Error: - * `SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST (on SAI_OBJECT_TYPE_PORT RID oid:0x20100000000) got value oid:0x559ac8beda80 objectTypeQuery returned NULL object type` - * > that attribute was recently added in 2024/10/7 - * - * > so what i expect is happening, vendor have some custom/private attribute after - * > SAI_PORT_ATTR_END, on older version of SAI headers which have the same enum value - * > as SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST, which causes syncd think that - * > SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST is implemented when actually this is private - * > internal attribute - */ - if (md->attrid >= SAI_PORT_ATTR_SELECTIVE_COUNTER_LIST) { - SWSS_LOG_WARN("query %s(%X) (on %s RID %s) got value %s, but objectTypeQuery returned NULL. Likely a vendor bug, skipping.", - md->attridname, - (unsigned int)md->attrid, - sai_serialize_object_type(md->objecttype).c_str(), - sai_serialize_object_id(rid).c_str(), - sai_serialize_object_id(oid).c_str()); - continue; - } - SWSS_LOG_THROW("when query %s (on %s RID %s) got value %s objectTypeQuery returned NULL object type", md->attridname, sai_serialize_object_type(md->objecttype).c_str(),