-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sfputil power enable/disable command #3418
Conversation
if result: | ||
click.echo("OK") | ||
else: | ||
click.echo("Failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnoopKamath Please return result or non-zero error code to distinguish failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mihirpat1 : Since this only api do we need to address this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnoopKamath - Yes - returning non-zero in case of an error will help the caller in knowing if the command was successful or not so that the caller can handle error scenario accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mihirpat1 - The platform handler, which toggles GPIO pin sends TRUE on success. If we need a non-zero in failed case, we should come up with different ERROR codes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnoopKamath Based on my understanding, the set_power API returns False upon error.
The result
variable in the current context already has this info.
The current API can return result
and the caller can return the error code to the user. You can return EXIT_FAIL
to the user as well upon error and EXIT_SUCCESS
upon success.
@click.argument('port_name', metavar='<port_name>') | ||
def disable(port_name): | ||
"""Disable power of SFP transceiver""" | ||
set_power(port_name, False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnoopKamath Please check for the return status of this API and handle error case accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are different error handling at sfputil layer itself. Platform call just tries toggling GPIO pin and on error case there are logs printed on console. EX: power fault detected.. etc. It will still return success
Cherry-pick PR to 202405: #3638 |
What I did
High-speed modules nowadays use a significant amount of power, and having the ability to control each port's optical power enables the disabling of power to ports that are not in use, thus helping to reduce overall power consumption. This feature can also assist in recovering the link in the following scenarios without the need for a physical reseat or OIR.
How I did it
Add new config interface command
sfputil power disable EthernetXX
sfputil power enable EthernetXX
How to verify it
HW team help probe the power pin and confirmed it to be disabled and enabled
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)