Skip to content

[SRv6] add MySID counters support#3601

Merged
prsunny merged 2 commits intosonic-net:masterfrom
Yakiv-Huryk:SRv6_counters
Jun 5, 2025
Merged

[SRv6] add MySID counters support#3601
prsunny merged 2 commits intosonic-net:masterfrom
Yakiv-Huryk:SRv6_counters

Conversation

@Yakiv-Huryk
Copy link
Copy Markdown
Contributor

What I did
Extended srv6orch to support SRv6 MySID counters (utilizing flex counter infrastructure)

Why I did it
To support SRv6 MySID counters

How I verified it
New test in test_flex_counters.py

Details if related

@Yakiv-Huryk Yakiv-Huryk requested a review from prsunny as a code owner April 9, 2025 15:28
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Yakiv-Huryk Yakiv-Huryk changed the title SRv6: add MySID counters support [SRv6] add MySID counters support Apr 9, 2025
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Yakiv-Huryk
Copy link
Copy Markdown
Contributor Author

Depends on: sonic-net/sonic-swss-common#1005

return IpAddress(ip_addr);
}

string Srv6Orch::getMySidCounterKey(const sai_my_sid_entry_t& sai_entry) const
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.

The MY_SID entry in SAI already has block_len/node_len/func_len, why do we need to collect them from locator_cfg?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's correct. This is the getMySidEntryLocatorCfg():

MySidLocatorCfg Srv6Orch::getMySidEntryLocatorCfg(const sai_my_sid_entry_t& sai_entry) const
{
return {
sai_entry.locator_block_len,
sai_entry.locator_node_len,
sai_entry.function_len,
sai_entry.args_len,
};
}

Copy link
Copy Markdown
Contributor

@BYGX-wcr BYGX-wcr left a comment

Choose a reason for hiding this comment

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

LGTM

@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

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@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

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@zhangyanzhao zhangyanzhao requested a review from Copilot May 11, 2025 20:07
Copy link
Copy Markdown

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

This pull request extends the SRv6 orchestration functionality to support MySID counters using the flex counter infrastructure. Key changes include new test functions for MySID counters in tests/test_flex_counters.py, added methods and members in Srv6Orch to manage MySID counters in orchagent/srv6orch.{h,cpp}, and updates to flex counter mappings in orchagent/flexcounterorch.cpp and related flex counter manager files.

Reviewed Changes

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

Show a summary per file
File Description
tests/test_flex_counters.py Added pre/post test functions for SRv6 MySID counters
orchagent/srv6orch.h Introduced new method prototypes and a counter member for MySID entries
orchagent/srv6orch.cpp Implemented MySID counter functions, timer-based updates, and counter state management
orchagent/flexcounterorch.cpp Updated counter mapping to include SRv6 and trigger SRv6 counter state changes
orchagent/flex_counter/flex_counter_manager.h Added SRV6 as a new counter type
orchagent/flex_counter/flex_counter_manager.cpp Mapped the new SRV6 counter type to its corresponding counter ID list macro

initializeCounters();
}

Srv6Orch::~Srv6Orch()
Copy link

Copilot AI May 11, 2025

Choose a reason for hiding this comment

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

Consider freeing m_counter_update_timer (allocated on line 138) in the destructor to prevent a potential memory leak. Alternatively, using a smart pointer for managing the timer could improve resource management.

Copilot uses AI. Check for mistakes.
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

* query SAI capability to check if SRv6 MySID counter is supported
* support for SRv6 MySID counter utilizing flex counter infrastructure
* extend vs test test_flex_counters.py
Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny prsunny merged commit f05e8e9 into sonic-net:master Jun 5, 2025
14 of 15 checks passed
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202412:

@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #3684

divyagayathri-hcl pushed a commit to divyagayathri-hcl/sonic-swss that referenced this pull request Jun 23, 2025
* SRv6: add MySID counters support
What I did
Extended srv6orch to support SRv6 MySID counters (utilizing flex counter infrastructure)

Why I did it
To support SRv6 MySID counters
Janetxxx pushed a commit to Janetxxx/sonic-swss that referenced this pull request Nov 10, 2025
* SRv6: add MySID counters support
What I did
Extended srv6orch to support SRv6 MySID counters (utilizing flex counter infrastructure)

Why I did it
To support SRv6 MySID counters
balanokia pushed a commit to balanokia/sonic-swss that referenced this pull request Nov 17, 2025
* SRv6: add MySID counters support
What I did
Extended srv6orch to support SRv6 MySID counters (utilizing flex counter infrastructure)

Why I did it
To support SRv6 MySID counters
baorliu pushed a commit to baorliu/sonic-swss that referenced this pull request Feb 23, 2026
* SRv6: add MySID counters support
What I did
Extended srv6orch to support SRv6 MySID counters (utilizing flex counter infrastructure)

Why I did it
To support SRv6 MySID counters

Signed-off-by: Baorong Liu <96146196+baorliu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants