Skip to content

[vs] Enable SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED in VS platform sai.profile#25428

Merged
lihuay merged 1 commit intosonic-net:masterfrom
rustiqly:fix/vs-sai-profile-oper-speed
Mar 7, 2026
Merged

[vs] Enable SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED in VS platform sai.profile#25428
lihuay merged 1 commit intosonic-net:masterfrom
rustiqly:fix/vs-sai-profile-oper-speed

Conversation

@rustiqly
Copy link
Copy Markdown
Contributor

What I did

Enable SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED=true in all VS platform sai.profile files.

Why I did it

Virtual NICs (virtio) do not report valid link speed via sysfs — /sys/class/net/ethN/speed returns -1. The VS SAI reads this value and interprets it as 4294967295 (0xFFFFFFFF unsigned), which causes show interfaces status to display 4294967.3G as the port speed for operationally up ports.

The SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED flag (added in sonic-sairedis) makes VS SAI return the configured speed from SAI_PORT_ATTR_SPEED (CONFIG_DB) as the operational speed, bypassing the broken sysfs query entirely.

This is the right default for all VS platforms since virtual switches never have real physical link speeds to report.

How I did it

Added SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED=true to all VS sai.profile files:

  • x86_64-kvm_x86_64-r0/SONiC-VM/sai.profile
  • x86_64-kvm_x86_64-r0/brcm_gearbox_vs/sai.profile
  • x86_64-kvm_x86_64_4_asic-r0/msft_four_asic_vs/0/sai.profile (1/2/3 are symlinks)
  • x86_64-kvm_x86_64_6_asic-r0/msft_multi_asic_vs/0/sai.profile (1-5 are symlinks)

How to verify it

  1. Build SONiC VS image with this change
  2. Boot on KVM with virtio NICs
  3. show interfaces status shows correct configured speed (e.g. 40G) instead of 4294967.3G

Companion PR: sonic-net/sonic-sairedis#1763 (fixes the code to also handle -1 gracefully as fallback)

Signed-off-by: Rustiqly rustiqly@users.noreply.github.com

@rustiqly
Copy link
Copy Markdown
Contributor Author

cc @liushilongbuaa

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from fcf18f7 to e105505 Compare February 11, 2026 04:09
@rustiqly rustiqly requested a review from lguohan as a code owner February 11, 2026 04:09
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@rustiqly
Copy link
Copy Markdown
Contributor Author

Updated to also add SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED=true to src/sonic-device-data/src/sai.vs_profile, which is the template used to generate sai.profile for all VS HwSKUs at build time (including the default Force10-S6000 HwSKU).

Previously the PR only patched device/virtual/ profiles (used by docker-sonic-vs), but missed the sonic-device-data template that generates profiles for the full KVM image. The Makefile in src/sonic-device-data copies sai.vs_profile as sai.profile into every VS HwSKU directory during package build.

Verified on a live VS VM: after adding this flag to the Force10-S6000 sai.profile and restarting syncd, all ports correctly report 40G instead of 4294967295 (0xFFFFFFFF).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lihuay
Copy link
Copy Markdown
Contributor

lihuay commented Feb 12, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables the VS SAI profile flag SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED=true so VS reports operational port speed based on the configured speed (from SAI_PORT_ATTR_SPEED) instead of relying on broken sysfs link speed in virtio environments.

Changes:

  • Add SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED=true to the common VS SAI profile template.
  • Add the same flag to VS platform sai.profile files for SONiC-VM, brcm_gearbox_vs, and MSFT multi-ASIC VS HWSKUs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/sonic-device-data/src/sai.vs_profile Adds configured-speed-as-oper-speed behavior to the common VS SAI profile.
device/virtual/x86_64-kvm_x86_64-r0/SONiC-VM/sai.profile Enables configured speed as oper speed for the default SONiC-VM VS HWSKU profile.
device/virtual/x86_64-kvm_x86_64-r0/brcm_gearbox_vs/sai.profile Enables configured speed as oper speed for the gearbox VS HWSKU profile.
device/virtual/x86_64-kvm_x86_64_4_asic-r0/msft_four_asic_vs/0/sai.profile Enables configured speed as oper speed for 4-ASIC VS (ASIC 0 profile).
device/virtual/x86_64-kvm_x86_64_6_asic-r0/msft_multi_asic_vs/0/sai.profile Enables configured speed as oper speed for 6-ASIC VS (ASIC 0 profile).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from e105505 to 093273a Compare February 13, 2026 05:49
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from 8bfd07d to e053921 Compare February 14, 2026 21:07
@sonicly1g
Copy link
Copy Markdown

Updated to also add SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED=true to sai_mlnx.profile and sai_dpu_2p.profile under device/virtual/ — these are used by docker-sonic-vs/start.sh which copies them over sai.profile for Mellanox-SN2700 and DPU-2P HwSKUs.

Good catch from the Copilot review — without this, the speed flag would be overwritten when start.sh runs on those platforms.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from e053921 to 62be1e4 Compare February 23, 2026 16:58
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from 62be1e4 to 04c02f6 Compare February 24, 2026 15:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from 04c02f6 to 0e5f794 Compare February 24, 2026 17:01
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from 0e5f794 to a236ae6 Compare February 25, 2026 15:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

LGTM. AI agent on behalf of Ying.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

LGTM. AI agent on behalf of Ying.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

AI agent on behalf of Ying.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

AI agent on behalf of Ying. Quick review: [vs]. No issues found.

Copy link
Copy Markdown
Contributor

@yxieca yxieca left a comment

Choose a reason for hiding this comment

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

AI agent on behalf of Ying. Quick review: [vs] Enable SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED in VS platform sai.profile. No issues found.

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from 634a8d7 to cb2f960 Compare March 2, 2026 15:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from cb2f960 to 41ef7aa Compare March 3, 2026 15:02
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from 41ef7aa to 8287c6a Compare March 4, 2026 15:04
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch 2 times, most recently from c910e6c to fcb7214 Compare March 5, 2026 15:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Virtual NICs (virtio) do not report valid link speed via sysfs
(/sys/class/net/ethN/speed returns -1). This causes VS SAI to report
0xFFFFFFFF as the oper speed, displayed as '4294967.3G' in CLI.

Enable SAI_VS_USE_CONFIGURED_SPEED_AS_OPER_SPEED=true in all VS
platform sai.profile files so that VS SAI returns the configured
speed (from CONFIG_DB) as the oper speed instead of querying sysfs.

Updated profiles:
- x86_64-kvm_x86_64-r0/SONiC-VM/sai.profile
- x86_64-kvm_x86_64-r0/brcm_gearbox_vs/sai.profile
- x86_64-kvm_x86_64_4_asic-r0/msft_four_asic_vs/0/sai.profile (+ symlinked 1-3)
- x86_64-kvm_x86_64_6_asic-r0/msft_multi_asic_vs/0/sai.profile (+ symlinked 1-5)

Signed-off-by: Rustiqly <rustiqly@users.noreply.github.com>
@rustiqly rustiqly force-pushed the fix/vs-sai-profile-oper-speed branch from fcb7214 to 5d17d97 Compare March 6, 2026 15:01
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@lihuay lihuay merged commit 4c398f0 into sonic-net:master Mar 7, 2026
25 of 26 checks passed
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.

6 participants