Skip to content

Fix hardcoded lane masks when applying loopbacks#686

Merged
prgeor merged 3 commits into
sonic-net:masterfrom
nexthop-ai:abhi.hardcoded-lane-masks
Jul 9, 2026
Merged

Fix hardcoded lane masks when applying loopbacks#686
prgeor merged 3 commits into
sonic-net:masterfrom
nexthop-ai:abhi.hardcoded-lane-masks

Conversation

@abhi-nexthop

@abhi-nexthop abhi-nexthop commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Description

Certain transceivers expect exact lane masks for the active appsel when setting Media Side and Host side loopbacks respectively.
Currently, we have them hardcoded as 0xFF which works on certain transceivers but not others. On a 1 media lane transceiver, trying to disable loopback on it with 0xFF might fail depending on the device. We noticed this on several transceivers

Motivation and Context

How Has This Been Tested?

Tested on INPHI CORP IN-Q3JZ1-TC-M1 and Acacia DP04QSDD-E20-001

Acacia works with and without the fix
IN-Q3JZ1-TC-M1 fails to set any kind of media loopback without the fix

Additional Information (Optional)

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 sonic_platform_base/sonic_xcvr/api/public/cmis.py Outdated

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 updates the CMIS transceiver loopback implementation to avoid using a hardcoded 0xFF lane mask by deriving the “all lanes” mask from the currently active AppSel’s host/media lane counts, improving compatibility with 1-lane / smaller-lane-count modules.

Changes:

  • Add APIs to resolve the active AppSel descriptor and fetch active host/media lane counts from Page 11h + application advertisement.
  • Use the derived “all lanes” mask instead of 0xFF for loopback operations (notably when disabling all loopbacks via loopback_mode == 'none').
  • Extend unit tests to cover the new active-lane-count APIs and updated loopback behaviors.

Reviewed changes

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

File Description
tests/sonic_xcvr/test_cmis.py Adds tests for active AppSel lane count helpers; updates loopback tests to account for derived masks.
sonic_platform_base/sonic_xcvr/api/public/cmis.py Introduces active AppSel lane-count helpers; replaces hardcoded lane masks in loopback paths; minor boolean conversion change for media loopback getters.

Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py Outdated
Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py Outdated
Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py Outdated
Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py Outdated
Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py
Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py Outdated
Comment thread tests/sonic_xcvr/test_cmis.py
Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py
Comment thread sonic_platform_base/sonic_xcvr/api/public/cmis.py
@prgeor

prgeor commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

@abhi-nexthop are you working on resolving the comments?

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

Copy link
Copy Markdown
Contributor Author

@prgeor Sorry Prince I was away and missed the response email notification. Fixed and tested

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).

@prgeor prgeor merged commit 80a4857 into sonic-net:master Jul 9, 2026
6 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.

4 participants