Skip to content

Commit

Permalink
[sfputil] Simplify the loopback condition to make it more compact and…
Browse files Browse the repository at this point in the history
… clean

Signed-off-by: xinyu <xinyu0123@gmail.com>
  • Loading branch information
xinyulin committed Aug 19, 2024
1 parent 4d85d22 commit af0508c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions sfputil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,10 +1469,10 @@ def is_fw_switch_done(port_name):
status = -1 # Abnormal status.
elif (ImageARunning == 1) and (ImageACommitted == 0): # ImageA is running, but not committed.
click.echo("FW images switch successful : ImageA is running")
status = 1 # run_firmware is done.
status = 1 # run_firmware is done.
elif (ImageBRunning == 1) and (ImageBCommitted == 0): # ImageB is running, but not committed.
click.echo("FW images switch successful : ImageB is running")
status = 1 # run_firmware is done.
status = 1 # run_firmware is done.
else: # No image is running, or running and committed image is same.
click.echo("FW info error : Failed to switch into uncommitted image!")
status = -1 # Failure for Switching images.
Expand Down Expand Up @@ -2021,11 +2021,9 @@ def loopback(port_name, loopback_mode):
click.echo("Failed to connect to STATE_DB")
sys.exit(EXIT_FAIL)

if loopback_mode in ("host-side-input", "host-side-output",
"host-side-input-none", "host-side-output-none"):
if 'host-side' in loopback_mode:
lane_mask = ((1 << host_lane_count) - 1) << ((subport - 1) * host_lane_count)
elif loopback_mode in ("media-side-input", "media-side-output",
"media-side-input-none", "media-side-output-none"):
elif 'media-side' in loopback_mode:
lane_mask = ((1 << media_lane_count) - 1) << ((subport - 1) * media_lane_count)
else:
lane_mask = 0
Expand Down

0 comments on commit af0508c

Please sign in to comment.