Skip to content

Extract serdes programming logic into dedicated function#4285

Merged
prsunny merged 18 commits intosonic-net:masterfrom
nexthop-ai:bgallagher.copilot-review-feedback
Mar 20, 2026
Merged

Extract serdes programming logic into dedicated function#4285
prsunny merged 18 commits intosonic-net:masterfrom
nexthop-ai:bgallagher.copilot-review-feedback

Conversation

@bgallagher-nexthop
Copy link
Copy Markdown
Contributor

In the below pull request, Copilot suggested two improvements that were not resolved before the PR was merged.

Addressing those two suggestions with this commit.

#4113

What I did

  • Refactored programming of signal integrity serdes settings for a port into a lambda helper function so the same logic can be re-used for both gearbox line-side, gearbox system-side and non-gearbox ports.
  • Augmented a unit test mock stub to correctly clear state.

Why I did it

Copilot's comments were valid.

How I verified it

Ran the portsorch unit tests in tests/mock_tests/portsorch_ut.cpp.

In the below pull request, Copilot suggested two improvements that were
not resolved before the PR was merged.

Addressing those two suggestions with this commit.

sonic-net#4113

Signed-off-by: Brian Gallagher <[email protected]>
@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

@bgallagher-nexthop bgallagher-nexthop marked this pull request as ready for review March 3, 2026 05:04
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

prgeor
prgeor previously approved these changes Mar 3, 2026
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 PR follows up on prior review feedback by refactoring serdes (signal integrity) programming in PortsOrch::doPortTask() to reuse a single helper for ASIC and gearbox cases, and by fixing a unit-test SAI stub to correctly clear port→serdes state on serdes removal.

Changes:

  • Refactor serdes programming into a local helper lambda to share admin-down + programming logic across ASIC and gearbox line/system sides.
  • Update the unit-test SAI remove_port_serdes stub to erase any port→serdes mappings referencing the removed serdes OID.

Reviewed changes

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

File Description
orchagent/portsorch.cpp Introduces a reusable helper lambda to program serdes attributes consistently across ASIC/gearbox paths.
tests/mock_tests/portsorch_ut.cpp Fixes the mock SAI behavior so serdes removal is reflected in subsequent SAI_PORT_ATTR_PORT_SERDES_ID queries.

Signed-off-by: Brian Gallagher <[email protected]>
Signed-off-by: Brian Gallagher <[email protected]>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Brian Gallagher <[email protected]>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny
Copy link
Copy Markdown
Collaborator

prsunny commented Mar 4, 2026

@bgallagher-nexthop , could you provide title to reflect the changes in PR? you can add copilot review etc in description.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@bgallagher-nexthop bgallagher-nexthop changed the title Address Copilot review feedback from previous PR Extract serdes programming logic into dedicated function Mar 4, 2026
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Brian Gallagher <[email protected]>
@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).

Signed-off-by: Brian Gallagher <[email protected]>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Brian Gallagher <[email protected]>
@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).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@bgallagher-nexthop
Copy link
Copy Markdown
Contributor Author

@prsunny do you think this is good to merge?

Copy link
Copy Markdown
Collaborator

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

approved by @prgeor , merging

@prsunny prsunny merged commit 53bf005 into sonic-net:master Mar 20, 2026
19 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.

5 participants