Skip to content

Commit b7f208b

Browse files
committed
Enhance return code handling for queryEnumCapabilitiesSai
Backport to msft-202412, msft-202503, 202505 <!-- Please make sure you have read and understood the contribution guildlines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md 1. Make sure your commit includes a signature generted with `git commit -s` 2. Make sure your commit title follows the correct format: [component]: description 3. Make sure your commit message contains enough details about the change and related tests 4. Make sure your pull request adds related reviewers, asignees, labels Please also provide the following information in this pull request: --> **What I did** Change the return code handling such that it does not produce an ERR level syslog in the case that SAI_STATUS_NOT_SUPPORTED is returned. Instead handle it gracefully. **Why I did it** Sonic seems to expect queryEnumCapabilitiesSai() to only be sucessful when it returns SAI_STATUS_SUCCESS. However, SAI_STATUS_NOT_SUPPORTED is also a valid return code if the attribute queried is not supported on a platform. **How I verified it** Verified that the new LOG messages are printed at NOTICE level rather than ERROR level. SONiC Software Version: SONiC.branch.202505-ars.ca6b34cb-buildimage.origin.202505-review.478334.1-2025.07.30.06.38 admin@ldp412:~$ show log "SAI_SWITCH_ATTR_PACKET_TRIM_" 2025 Jul 31 01:24:26.140966 ldp412 NOTICE swss#orchagent: :- queryTrimDscpModeEnumCapabilities: Attribute not supported(SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE) to query enum capabilities 2025 Jul 31 01:24:26.143248 ldp412 NOTICE swss#orchagent: :- queryTrimQueueModeEnumCapabilities: Attribute not supported(SAI_SWITCH_ATTR_PACKET_TRIM_QUEUE_RESOLUTION_MODE)enum value capabilities **Details if related** This is a follow up for sonic-net/sonic-swss#3778
1 parent 9c71357 commit b7f208b

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

orchagent/switch/trimming/capabilities.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,15 @@ void SwitchTrimmingCapabilities::queryTrimDscpModeEnumCapabilities()
324324
auto status = queryEnumCapabilitiesSai(
325325
mList, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE
326326
);
327-
if (status != SAI_STATUS_SUCCESS)
327+
if (status == SAI_STATUS_NOT_SUPPORTED)
328+
{
329+
SWSS_LOG_NOTICE(
330+
"Attribute not supported(%s) to query enum value capabilities",
331+
toStr(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE).c_str()
332+
);
333+
return;
334+
}
335+
else if (status != SAI_STATUS_SUCCESS)
328336
{
329337
SWSS_LOG_ERROR(
330338
"Failed to get attribute(%s) enum value capabilities",
@@ -369,7 +377,15 @@ void SwitchTrimmingCapabilities::queryTrimDscpModeAttrCapabilities()
369377
auto status = queryAttrCapabilitiesSai(
370378
attrCap, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE
371379
);
372-
if (status != SAI_STATUS_SUCCESS)
380+
if (status == SAI_STATUS_NOT_SUPPORTED)
381+
{
382+
SWSS_LOG_NOTICE(
383+
"Attribute not supported(%s) to query attr vapabilities",
384+
toStr(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_PACKET_TRIM_DSCP_RESOLUTION_MODE).c_str()
385+
);
386+
return;
387+
}
388+
else if (status != SAI_STATUS_SUCCESS)
373389
{
374390
SWSS_LOG_ERROR(
375391
"Failed to get attribute(%s) capabilities",

0 commit comments

Comments
 (0)