Skip to content

[sfputil] Add loopback sub-command for debugging and module diagnosti…#3369

Merged
prgeor merged 2 commits intosonic-net:masterfrom
xinyulin:sfputil_loopback
Jul 12, 2024
Merged

[sfputil] Add loopback sub-command for debugging and module diagnosti…#3369
prgeor merged 2 commits intosonic-net:masterfrom
xinyulin:sfputil_loopback

Conversation

@xinyulin
Copy link
Copy Markdown
Contributor

@xinyulin xinyulin commented Jun 17, 2024

What I did

Add a debug group and a sub-command loopback under the sfputil command for debugging and module diagnostic purposes.

How I did it

Implement the loopback command by directly calling the set_loopback_mode() API.

How to verify it

Tested under Cisco8111 with Credo C1 cable.

  • Turn off loopback mode
    sfputil debug loopback Ethernet88 none
  • Turn on host input loopback
    sfputil debug loopback Ethernet88 host-side-input

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

The loopback command is not supported in previous version.

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

image

Test logs

  • local end (E0) with toggling host side input loopback mode
    page 0x00, byte 0x40 = 0 // target mode register set to E0
    page 0x13, byte 0xB7 = 0xFF // turn on host side input loopback on lane 1 ~ 8
    image

  • remote end1 (E1) with toggling media side input loopback mode
    page 0x00, byte 0x40 = 1 // target mode register set to E1
    page 0x13, byte 0xB5 = 0x0F // turn on media side input loopback on lane 1 ~ 4
    image

@xinyulin xinyulin force-pushed the sfputil_loopback branch 5 times, most recently from 6ded6a7 to d88fcb6 Compare June 17, 2024 08:10
Copy link
Copy Markdown
Contributor

@mihirpat1 mihirpat1 left a comment

Choose a reason for hiding this comment

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

@xinyulin In the PR description, can you please add the results of the following test done manually on E0 and E1/E2 side.

  1. Setup loopback (any 2 types of loopback)
  2. Dump the loopback register using sfputil show eeprom-hexdump -n <PAGE_NUM> -p PORT_NAME
  3. clear the loopback
  4. Dump the loopback register

@xinyulin xinyulin force-pushed the sfputil_loopback branch 12 times, most recently from c3786b7 to 6b4f056 Compare July 10, 2024 09:24

- Example:
```
admin@sonic:~$ sfputil firmware target Ethernet88 host-side-input
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.

Suggested change
admin@sonic:~$ sfputil firmware target Ethernet88 host-side-input
admin@sonic:~$ sfputil debug loopback Ethernet88 host-side-input

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oops! I copied it from other example, let me fix it!


- Usage:
```
sfputil debug loopback [OPTIONS] PORT_NAME LOOPBACK_MODE
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.

What do you mean by "[options]" here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is automatically added in the help message below.
image
I can remove it since there is no specific OPTIONS needed

@prgeor prgeor merged commit b6f7c2b into sonic-net:master Jul 12, 2024
@mihirpat1
Copy link
Copy Markdown
Contributor

@bingwang-ms Can you please help to merge this to 202405?
MSFT ADO - 26677525

mssonicbld pushed a commit to mssonicbld/sonic-utilities that referenced this pull request Jul 12, 2024
sonic-net#3369)

* [sfputil] Add loopback sub-command for debugging and module diagnostic control

Signed-off-by: xinyu <[email protected]>

* [sfputil] Correct and update the reference of sfputil debug loopback command

Signed-off-by: xinyu <[email protected]>

---------

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

Cherry-pick PR to 202405: #3416

mssonicbld pushed a commit that referenced this pull request Jul 12, 2024
#3369)

* [sfputil] Add loopback sub-command for debugging and module diagnostic control

Signed-off-by: xinyu <[email protected]>

* [sfputil] Correct and update the reference of sfputil debug loopback command

Signed-off-by: xinyu <[email protected]>

---------

Signed-off-by: xinyu <[email protected]>
@xinyulin xinyulin deleted the sfputil_loopback branch July 19, 2024 09:40
@prgeor
Copy link
Copy Markdown
Contributor

prgeor commented Jul 25, 2024

@lguohan add the request for 202311 branch

nmoray pushed a commit to nmoray/sonic-utilities that referenced this pull request Jun 25, 2025
sonic-net#3369)

* [sfputil] Add loopback sub-command for debugging and module diagnostic control

Signed-off-by: xinyu <[email protected]>

* [sfputil] Correct and update the reference of sfputil debug loopback command

Signed-off-by: xinyu <[email protected]>

---------

Signed-off-by: xinyu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants