Skip to content

[warmboot]: Add SRv6 MySID warmboot support - #2012

Open
nazariig wants to merge 1 commit into
sonic-net:masterfrom
nazariig:master-warmboot-srv6-mysid-support
Open

[warmboot]: Add SRv6 MySID warmboot support#2012
nazariig wants to merge 1 commit into
sonic-net:masterfrom
nazariig:master-warmboot-srv6-mysid-support

Conversation

@nazariig

Copy link
Copy Markdown
Collaborator

Signed-off-by: Nazarii Hnydyn nazariig@nvidia.com

Description of PR

The bug

During warmboot, syncd builds two ASIC views and reconciles them:

  • current view — objects present in the ASIC after reboot (from ASIC dump)
  • temporary view — objects expected by orchagent (from Redis)

For non-object-id entry types (route, NAT, inseg, …), matching is not a simple OID compare.
The entry key itself embeds other VIDs (e.g. virtual router).
Those VIDs differ between the temporary and current views,
so syncd must translate them via the RID map before it can look the entry up.

SAI_OBJECT_TYPE_MY_SID_ENTRY (SRv6 MySID) was never wired into that path. As a result:

  • AsicView::fromDump / asicCreateObject / asicRemoveObject had no
    m_soMySidEntries map — MySID fell into the unsupported/default branches
  • BestCandidateFinder had no MySID matcher, so warmboot could not reconcile
    existing MySID entries after VID translation
  • ComparisonLogic did not re-serialize the MySID object id after exchanging
    struct VIDs

Warmboot with SRv6 MySID entries programmed therefore fails to match and preserve
those objects (create/remove/throw paths instead of a clean best-candidate match).

Why MySID needs the same treatment as inseg/route

A MySID entry key contains switch_id and vr_id VIDs plus the SID and locator lengths:

SAI_OBJECT_TYPE_MY_SID_ENTRY:{switch_id, vr_id, sid, locator_*, function_len, args_len}

After warmboot, the temporary view may have vr_id = 0x3000000000002 while the
current view has the same VR as vr_id = 0x3000000000001, both mapping to the same RID.
Dictionary lookup on the temporary serialized key will miss unless vr_id is rewritten
to the current VID first — exactly the pattern already used for inseg / route / NAT.

The fix

Teach the warmboot comparison path about SAI_OBJECT_TYPE_MY_SID_ENTRY,
mirroring the existing inseg-entry handling:

  1. AsicView — add m_soMySidEntries; deserialize into it in fromDump;
    maintain it in asicCreateObject / asicRemoveObject
  2. BestCandidateFinder::findCurrentBestMatchForMySidEntry — copy the temporary
    meta key, exchangeTemporaryVidToCurrentVid, serialize, then dictionary-lookup
    in m_soMySidEntries
  3. ComparisonLogic — re-serialize m_str_object_id with
    sai_serialize_my_sid_entry after VID exchange when creating from a temporary object
  4. Unit tests — cover dump/create/remove, successful match after VID exchange,
    missing mapping, missing entry, and already-processed throw
// BestCandidateFinder — match after VID exchange
sai_object_meta_key_t mk = temporaryObj->m_meta_key;

if (!exchangeTemporaryVidToCurrentVid(mk))
{
    return nullptr;
}

std::string str_my_sid_entry =
    sai_serialize_my_sid_entry(mk.objectkey.key.my_sid_entry);

auto currentMySidIt =
    m_currentView.m_soMySidEntries.find(str_my_sid_entry);

With that, warmboot can keep existing MySID entries instead of tearing them down
and recreating them (or failing).

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation update
  • Test improvement

Approach

What is the motivation for this PR?

SRv6 MySID entries must survive warmboot.
Without ASIC-view tracking and VID-aware best-candidate matching,
syncd cannot reconcile SAI_OBJECT_TYPE_MY_SID_ENTRY between the temporary
and current views.

Work item tracking

  • N/A

How did you do it?

  • Added m_soMySidEntries and MySID handling in AsicView
    (fromDump, asicCreateObject, asicRemoveObject)
  • Implemented findCurrentBestMatchForMySidEntry
    (VID exchange → serialize → dictionary lookup), same approach as inseg
  • Wired SAI_OBJECT_TYPE_MY_SID_ENTRY into
    BestCandidateFinder::findCurrentBestMatch and
    ComparisonLogic::createNewObjectFromTemporaryObject
  • Added unittest/syncd/TestMySidWarmboot.cpp covering dump lifecycle
    and best-candidate match / miss / already-processed paths

How did you verify/test it?

  1. Run syncd unit tests:
make -C unittest/syncd check
  1. Confirm TestMySidWarmboot cases pass:
    • asicView_fromDump_deserializes_my_sid_entry
    • asicView_create_and_remove_my_sid_entry
    • my_sid_entry_serializes_with_exchanged_vr_vid
    • bestCandidateFinder_matches_my_sid_entry_after_vid_exchange
    • bestCandidateFinder_returns_null_when_vid_mapping_missing
    • bestCandidateFinder_returns_null_when_entry_missing_in_current_view
    • bestCandidateFinder_throws_when_entry_already_processed
  2. On a DUT with SRv6 MySID programmed: warm-reboot and confirm MySID entries
    remain in ASIC/APPL_DB without recreate storms in syncd logs

Any platform specific information?

  • N/A

Documentation

  • N/A

A picture of a cute animal (not mandatory but encouraged)

      .---.        .-----------
     /     \  __  /    ------
    / /     \(  )/    -----
   //////   ' \/ `   ---
  //// / // :    : ---
 // /   /  /`    '--
//          //..\\
       ====UU====UU====
           '//||\\`
             ''``

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

This PR has backport request label(s) for branch(es): 202605, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202605: <test result>) in the Test result section as well in your PR description.

---Powered by SONiC BuildBot

@rookie-who

Copy link
Copy Markdown

Hi — this PR is flagged for cherry-pick to the 202605 branch, but it appears to be a new feature/enhancement rather than a bug fix. The 202605 branch is in stabilization, so we're limiting cherry-picks to bug fixes and critical platform support.

Could you please retarget this to the next release branch? If there's a specific customer requirement driving this for 202605, please comment with the justification and we can reconsider.

Comment by @vaibhavhd via automated tooling

Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
@nazariig
nazariig force-pushed the master-warmboot-srv6-mysid-support branch from 77c5070 to 924e666 Compare August 4, 2026 09:41
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@nazariig nazariig added the Tested for 202605 branch Tested for 202605 branch label Aug 4, 2026
@BYGX-wcr
BYGX-wcr requested review from BYGX-wcr and a lite review from Copilot August 5, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends syncd warmboot reconciliation to properly support SAI_OBJECT_TYPE_MY_SID_ENTRY (SRv6 MySID) by tracking MySID entries in AsicView, enabling VID-aware best-candidate matching, and re-serializing the entry key after VID exchange. This prevents warmboot from mis-matching existing MySID entries and taking erroneous create/remove paths.

Changes:

  • Add m_soMySidEntries tracking in AsicView and maintain it across dump/create/remove flows.
  • Add BestCandidateFinder matching for MySID entries via VID-exchange + serialized-key dictionary lookup.
  • Update ComparisonLogic to re-serialize MySID entry object IDs after struct VID exchange; add dedicated unit tests.

Reviewed changes

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

Show a summary per file
File Description
syncd/AsicView.h Adds a dedicated map to track MySID entries in the ASIC view.
syncd/AsicView.cpp Deserializes, stores, creates, and removes MySID entries in the view’s indexes.
syncd/BestCandidateFinder.h Declares MySID-specific best-candidate matcher.
syncd/BestCandidateFinder.cpp Implements VID-aware MySID dictionary lookup and wires it into best-match dispatch.
syncd/ComparisonLogic.cpp Re-serializes MySID entry IDs after VID exchange when cloning from temporary objects.
unittest/syncd/TestMySidWarmboot.cpp Adds unit coverage for MySID dump lifecycle and best-candidate match/miss paths.
unittest/syncd/Makefile.am Registers the new unit test source in the syncd test binary.
tests/aspell.en.pws Adds “sid” to the aspell personal word list.

* can indicate a bug or somehow duplicated entries.
*/

SWSS_LOG_THROW("found my sid entry %s in current view, but it status is %d, FATAL",

@BYGX-wcr BYGX-wcr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix The PR is a bug fix PR Cherry Pick Conflict_202605 Tested for 202605 branch Tested for 202605 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: SRv6 MySID entries are not reconciled during warmboot

6 participants