Skip to content

Sfputil: Add the optional use-lpmode-pin flag to lpmode #4511

Open
abhi-nexthop wants to merge 12 commits into
sonic-net:masterfrom
nexthop-ai:add-ability-to-do-hardware-lpmode-via
Open

Sfputil: Add the optional use-lpmode-pin flag to lpmode #4511
abhi-nexthop wants to merge 12 commits into
sonic-net:masterfrom
nexthop-ai:add-ability-to-do-hardware-lpmode-via

Conversation

@abhi-nexthop

@abhi-nexthop abhi-nexthop commented May 1, 2026

Copy link
Copy Markdown

What I did

Added the ability to use the --lpmode-pin flag.

How I did it

This will pass the flag down to sfp.get_lpmode and set_lpmode, only when it is explicitly certified and throws an error if the flag is not supported by the sfp class.
The default functionality (without the new flag) will not change whatsoever.

How to verify it

Replace your sfputil main.py and run as usual. The behavior, CMIS register values should remain exactly the same.
When this flag is provided, if your platform supports the software and hardware distinction, it should assert/deassert hardware lpmode on the transceiver.
This PR is gated on sonic-net/sonic-platform-common#663 being submitted

One such implementation has been made in pddf sfp here: sonic-net/sonic-buildimage#27278

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

When flag is not supported:
LPMode pin flag not implemented for this platform

When supported: It remains the same

Signed-off-by: abhi-nexthop <abhi@nexthop.ai>
@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: Abhi Singh <abhi@nexthop.ai>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Comment thread sfputil/main.py Outdated
Comment thread sfputil/main.py Outdated
Signed-off-by: Abhi Singh <abhi@nexthop.ai>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@abhi-nexthop abhi-nexthop changed the title Sfputil: Add the optional use-hardware-control flag to lpmode Sfputil: Add the optional use-lpmode-pin flag to lpmode May 8, 2026
Signed-off-by: Abhi Singh <abhi@nexthop.ai>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Comment thread sfputil/main.py Outdated
Comment thread sfputil/main.py Outdated
Comment thread sfputil/main.py

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 the sfputil CLI to optionally control/report low-power mode via the transceiver LPMode pin instead of the EEPROM-based method, while keeping the existing default behavior unchanged.

Changes:

  • Add --use-lpmode-pin flag to show lpmode to call get_lpmode_via_pin() when requested.
  • Add --use-lpmode-pin flag to lpmode on/off to call set_lpmode_via_pin() when requested.
  • Add unit tests covering the new flag behavior (including NotImplementedError handling).

Reviewed changes

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

File Description
sfputil/main.py Adds the --use-lpmode-pin flag to show/set LPMode flows and wires it into platform SFP APIs.
tests/sfputil_test.py Adds test coverage for the new CLI flag paths for both show and set operations.

Comment thread sfputil/main.py Outdated
Comment thread sfputil/main.py
Signed-off-by: Abhi Singh <abhi@nexthop.ai>
Signed-off-by: Abhi Singh <abhi@nexthop.ai>
Comment thread sfputil/main.py
Comment thread sfputil/main.py Outdated
@prgeor prgeor closed this May 18, 2026
@prgeor prgeor reopened this May 18, 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: Abhi Singh <abhi@nexthop.ai>
@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: Abhi Singh <abhi@nexthop.ai>
@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: Abhi Singh <abhi@nexthop.ai>
@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: Abhi Singh <abhi@nexthop.ai>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

mihirpat1
mihirpat1 previously approved these changes May 21, 2026
Signed-off-by: Abhi Singh <abhi@nexthop.ai>
@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).

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