Skip to content

Add libsai RedisInterface for link event damping.#1331

Open
Ashish1805 wants to merge 1 commit into
sonic-net:masterfrom
Ashish1805:ledamping_sairedis
Open

Add libsai RedisInterface for link event damping.#1331
Ashish1805 wants to merge 1 commit into
sonic-net:masterfrom
Ashish1805:ledamping_sairedis

Conversation

@Ashish1805

Copy link
Copy Markdown
Contributor
  • This supports the link event damping config and algorithm set API.
  • Sends the link event damping config from libsai to syncd main thread.

HLD: sonic-net/SONiC#1071

Comment thread syncd/Syncd.cpp
@Ashish1805

Copy link
Copy Markdown
Contributor Author

@Junchao-Mellanox for review.

@Ashish1805

Copy link
Copy Markdown
Contributor Author

@kcudnik looks like swss pytest is failing - it seems unrelated to my changes. Any idea how to fix the swss pytest?

@kcudnik

kcudnik commented Dec 13, 2023

Copy link
Copy Markdown
Collaborator

those vstests are sometime flaky so dont worry about that

@Ashish1805

Copy link
Copy Markdown
Contributor Author

@kcudnik I have updated the PR as per review comment. can you please review it when you get a chance? Thank you.

@kcudnik

kcudnik commented Jan 16, 2024

Copy link
Copy Markdown
Collaborator

please fix build erros and code coverage

@Ashish1805 Ashish1805 force-pushed the ledamping_sairedis branch 2 times, most recently from 2399261 to ec5cf30 Compare May 10, 2024 23:02
@Ashish1805

Copy link
Copy Markdown
Contributor Author

@kcudnik Added the code coverage but I see PR is failing for 2 tests during Update rsyslog.conf test. The test failure log doesn't give much info, can you suggest where can I find the helpful debug log to figure out what exactly failed and why?

@kcudnik

kcudnik commented May 13, 2024

Copy link
Copy Markdown
Collaborator

@kcudnik Added the code coverage but I see PR is failing for 2 tests during Update rsyslog.conf test. The test failure log doesn't give much info, can you suggest where can I find the helpful debug log to figure out what exactly failed and why?

rsyslogd: pidfile '/run/rsyslogd.pid' and pid 18837 already exist.
If you want to run multiple instances of rsyslog, you need to specify

in ~/sonic-sairedis/.azure-pipelines/build-template.yml

68   - script: |
169       sudo cp azsyslog.conf /etc/rsyslog.conf
170       sudo service rsyslog restart
171     displayName: "Update rsyslog.conf"

seems like syslog service restart failed but why, no clue, we would need to look into syslog on pipeline but i dont know how :D maybe update buitld template to do "tail -n 100 /var/log/syslog ? after restaret command ?

@Ashish1805 Ashish1805 force-pushed the ledamping_sairedis branch 2 times, most recently from 6aa7b5a to 5dfe7bf Compare May 20, 2024 23:59
@Ashish1805

Copy link
Copy Markdown
Contributor Author

/AzurePipelines run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 1331 in repo sonic-net/sonic-sairedis

@kcudnik

kcudnik commented May 22, 2024

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

- This supports the link event damping config and algorithm set API.
- Sends the link event damping config from libsai to syncd main thread.

HLD: sonic-net/SONiC#1071

Signed-off-by: Ashish Singh <ashishksingh@google.com>
@Ashish1805 Ashish1805 force-pushed the ledamping_sairedis branch from 5dfe7bf to 6f5b983 Compare May 28, 2024 20:01
Comment on lines +1883 to +1888
if ((objectType != SAI_OBJECT_TYPE_PORT) || (attr == nullptr) || (attr->id < SAI_PORT_ATTR_CUSTOM_RANGE_START))
{
return false;
}

return true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you can turn this to 1 single line by reversing condition

Comment on lines +507 to +515
if (m_syncMode)
{
swss::KeyOpFieldsValuesTuple kco;
auto status = m_communicationChannel->wait(REDIS_ASIC_STATE_COMMAND_DAMPING_CONFIG_SET, kco);

m_recorder->recordGenericSetResponse(status);

return status;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

make this api always synchronous, async mode is just for create/remove/set operations all other apis should be synchronous

@DendroLabs

Copy link
Copy Markdown
Contributor

Hi @Ashish1805 and @kcudnik,

This PR has been inactive for nearly 2 years. I'm picking up the link event damping feature and plan to open a new PR that supersedes this one, addressing all outstanding review comments:

  • Make the damping config API always synchronous (not respect m_syncMode flag), per @kcudnik's feedback
  • Simplify condition (reverse and single-line)
  • Rebase onto current master

Will credit @Ashish1805 as original author. See also my comment on #1334 regarding the overall design clarification.

@kcudnik

kcudnik commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

you have conflicts and didnt address comments last time

@DendroLabs

Copy link
Copy Markdown
Contributor

@kcudnik Thanks for the note. We're picking up this feature from scratch — our superseding PRs address all outstanding review comments and have no conflicts.

We've already opened 3 PRs with all CI green:

The remaining two sairedis PRs (superseding this one and #1334) are pending your feedback on the design question we posted on #1334. Would appreciate your review when you get a chance.

lolyu pushed a commit that referenced this pull request Jun 6, 2026
Summary
Supersedes #1323 by @Ashish1805. Adds the SelectablesTracker class for tracking selectable timers used by the link event damper in syncd.

This is part of the Link Event Damping feature (HLD: sonic-net/SONiC#1071).

All review feedback from #1323 has been addressed:

Moved class members to private (@kcudnik)
Replaced raw pointers with shared_ptr for memory safety (@kcudnik)
Fixed code ordering -- null checks before getFd() call (@Junchao-Mellanox)
Added empty line before if() blocks (@kcudnik)
CodeQL constexpr fix already present on master
Changes:

syncd/SelectablesTracker.h -- Header with private members, shared_ptr interface
syncd/SelectablesTracker.cpp -- Implementation with proper null checking order
unittest/syncd/TestSelectablesTracker.cpp -- 11 unit test cases
unittest/syncd/MockSelectablesTracker.h -- Mock class in separate file
Build integration in both syncd/Makefile.am and unittest/syncd/Makefile.am
Dependency chain: This PR is a prerequisite for the per-port link event damper (#1334) and the libsai RedisInterface (#1331).

Test plan
 11 new unit tests covering add/remove/get operations, null handling, duplicate detection
 Existing syncd unit tests pass (no regressions)
 Azure Pipelines CI green
🤖 Generated with Claude Code

Co-Authored-By: Ashish Singh ashish.singh@google.com
@DendroLabs

Copy link
Copy Markdown
Contributor

The superseding PR for this one is now open: #1935

It addresses all review feedback from this PR:

  • setLinkEventDampingConfig is always synchronous (never checks m_syncMode), per @kcudnik's review
  • isRedisPortAttribute simplified to single boolean expression, per @kcudnik's review
  • Syncd response is always sent (no m_enableSyncMode guard)
  • Uses a dedicated response command (link_event_damping_config_response) to avoid collision with GETRESPONSE
  • Clean rebase on current master, no conflicts

@Ashish1805 credited as original author in the PR description.

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.

3 participants