Skip to content

Enhance return code handling for queryEnumCapabilitiesSai()#3778

Closed
justin-wong-ce wants to merge 2 commits intosonic-net:masterfrom
justin-wong-ce:enumQue
Closed

Enhance return code handling for queryEnumCapabilitiesSai()#3778
justin-wong-ce wants to merge 2 commits intosonic-net:masterfrom
justin-wong-ce:enumQue

Conversation

@justin-wong-ce
Copy link

Backport to msft-202412, msft-202503, 202505

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
Tested with 7260CX3 on 202505, new log msg prints in place of previous ERR log

Details if related

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.

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.

Tested with 7260CX3 on 202505
@justin-wong-ce justin-wong-ce requested a review from prsunny as a code owner July 22, 2025 17:15
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@justin-wong-ce
Copy link
Author

/azpw run Azure.sonic-swss

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-swss

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@justin-wong-ce
Copy link
Author

/azpw run Azure.sonic-swss

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-swss

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@dhanasekar-arista
Copy link
Contributor

#3765
This PR has introduced few more errors w.r.t "SAI_SWITCH_ATTR_PACKET_TRIM_*" which should needs to be handled gracefully.

attrCap, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_PACKET_TRIM_QUEUE_RESOLUTION_MODE
);
if (status != SAI_STATUS_SUCCESS)
if (status == SAI_STATUS_NOT_SUPPORTED)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mind to update the other functions in this file?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise this looks good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mind to update the other functions in this file?

done, #3798

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

mList, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_PACKET_TRIM_QUEUE_RESOLUTION_MODE
);
if (status != SAI_STATUS_SUCCESS)
if (status == SAI_STATUS_NOT_SUPPORTED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nazariig please check

if (status != SAI_STATUS_SUCCESS)
if (status == SAI_STATUS_NOT_SUPPORTED)
{
SWSS_LOG_NOTICE(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adyeung @justin-wong-ce we also need to update the

bool SwitchTrimmingCapabilities::isSwitchTrimmingSupported() const

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be addressing this in a separate PR.
(Someone else doing it since I don't have computer access for a bit soon).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kperumalbfn the next SAI 13.2.1 drop will pass the AttrSupported checks required by isSwitchTrimmingSupported(), no need for a change at the func from BRCM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@kperumalbfn kperumalbfn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if (status == SAI_STATUS_NOT_SUPPORTED)
{
SWSS_LOG_NOTICE(
"Attribute not supported(%s)enum value capabilities",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Attribute not supported(%s)enum value capabilities",
"Attribute not supported(%s) to query enum value capabilities",

if (status == SAI_STATUS_NOT_SUPPORTED)
{
SWSS_LOG_NOTICE(
"Attribute not supported(%s)enum value capabilities",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Attribute not supported(%s)enum value capabilities",
"Attribute not supported(%s) to query attr vapabilities",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nazariig Justin is on vacation, i've addressed these in this PR #3808.
Please review and proceed with the merge.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhanasekar-arista the new one is approved. Please close the original one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @nazariig , i wont have permissions to close this one, @justin-wong-ce will close this one once he is back.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhanasekar-arista PR has been closed

@nazariig nazariig closed this Aug 5, 2025
mssonicbld added a commit to mssonicbld/sonic-swss that referenced this pull request Aug 5, 2025
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#3778
mssonicbld added a commit that referenced this pull request Aug 6, 2025
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 #3778
mssonicbld added a commit to mssonicbld/sonic-swss.msft that referenced this pull request Aug 7, 2025
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
mssonicbld added a commit to Azure/sonic-swss.msft that referenced this pull request Aug 7, 2025
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
mssonicbld added a commit to mssonicbld/sonic-swss.msft that referenced this pull request Aug 12, 2025
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
prabhataravind pushed a commit to Azure/sonic-swss.msft that referenced this pull request Aug 12, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants