[cmis] Fix enter_password to include standard password entry method - #724
Open
Junchao-Mellanox wants to merge 1 commit into
Open
[cmis] Fix enter_password to include standard password entry method#724Junchao-Mellanox wants to merge 1 commit into
Junchao-Mellanox wants to merge 1 commit into
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
Author
|
Hi @prgeor , @mihirpat1 , could you please help review this? Thanks! |
stephenxs
previously approved these changes
Jul 21, 2026
Junchao-Mellanox
force-pushed
the
public/pr-19
branch
from
July 22, 2026 09:23
600270d to
b6282d6
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
bgallagher-nexthop
approved these changes
Jul 22, 2026
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Junchao-Mellanox
force-pushed
the
public/pr-19
branch
from
July 23, 2026 02:53
8676fb0 to
2abdcf0
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
keboliu
previously approved these changes
Jul 28, 2026
prgeor
reviewed
Jul 28, 2026
prgeor
reviewed
Jul 28, 2026
prgeor
reviewed
Jul 28, 2026
prgeor
reviewed
Jul 28, 2026
prgeor
reviewed
Jul 28, 2026
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Junchao-Mellanox
force-pushed
the
public/pr-19
branch
from
July 29, 2026 05:54
59eeec7 to
2d17bd7
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
prgeor
reviewed
Jul 31, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the SONiC CMIS transceiver support to enter the host password using the CMIS-standard Password Entry Area (page 00h bytes 122–125, MSB-first) and to optionally confirm acceptance via the PasswordCmdResult register (CMIS 5.3+). It also wires this capability into the CDB handler path and updates unit tests accordingly.
Changes:
- Added CMIS-side password entry via Password Entry Area with optional polling of PasswordCmdResult (CMIS 5.3+).
- Extended the CMIS page00 lower memory map and field constants to expose Password Entry Area and PasswordCmdResult.
- Updated CDB/CDB-FW handler construction and tests to support delegating password entry to CMIS as a fallback path.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/sonic_xcvr/test_cmis.py | Adds unit tests for CMIS password-entry support checks and polling behavior. |
| tests/sonic_xcvr/test_cdb.py | Updates CDB handler tests to include CMIS fallback behavior and weakref semantics. |
| tests/sonic_xcvr/test_cdb_fw.py | Updates firmware handler tests for the new handler constructor signature. |
| sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page00_lower.py | Adds CMIS page00 mappings for Password Entry Area and PasswordCmdResult. |
| sonic_platform_base/sonic_xcvr/fields/consts.py | Introduces constants for password entry/result registers and polling parameters. |
| sonic_platform_base/sonic_xcvr/cdb/cdb.py | Adds CMIS API weakref and password-entry fallback wiring in CdbCmdHandler. |
| sonic_platform_base/sonic_xcvr/cdb/cdb_fw.py | Updates firmware handler to pass through CMIS API reference. |
| sonic_platform_base/sonic_xcvr/api/public/cmis.py | Implements Password Entry Area write + PasswordCmdResult polling and CMIS revision gating. |
| sonic_platform_base/sonic_xcvr/api/public/cdb_fw.py | Passes cmis_api=self into the CDB firmware handler factory. |
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Junchao-Mellanox
force-pushed
the
public/pr-19
branch
from
August 7, 2026 04:04
e1574c1 to
0b965c7
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
`CdbCmdHandler.enter_password()` previously delivered the CMIS host password only via CDB command `0001h`. This is not the standard mechanism defined by the CMIS spec and is not honored by all modules — the standard, universally-supported way to unlock password-protected CDB/EEPROM access is to write the 4-byte host password (MSB first) to the Password Entry Area at page 00h bytes 122-125. As a result, password entry would fail on modules that only unlock via the Password Entry Area, blocking protected CDB/EEPROM operations (e.g. firmware/SED-protected access) on those modules. - `cdb.py` — Reworked `enter_password()` to first write the password to the Password Entry Area (page 00h bytes 122-125, MSB first) using `write_raw`, which is the standard method honored by all CMIS modules. If that write fails, it falls back to the original CDB command `0001h` path for modules that rely on it. Input validation (integer in range `0..0xFFFFFFFF`) is preserved, and `struct` is used to pack the 32-bit password big-endian. - `cdb_consts.py` — Added `CDB_HOST_PASSWORD_ENTRY_OFFSET = 122` and `CDB_HOST_PASSWORD_ENTRY_SIZE = 4` with documentation describing the Password Entry Area register layout. - `test_cdb.py` — Updated existing tests to assert the password is now written MSB-first to the Password Entry Area (and that no CDB command is sent when the register write succeeds), and added `test_enter_password_fallback_to_cdb_command` to cover the fallback path when the register write fails. Ran the updated unit tests in `tests/sonic_xcvr/test_cdb.py`, covering: - `test_enter_password_valid` — password written MSB-first to the Password Entry Area, no CDB command issued. - `test_enter_password_default` — default password (`0x00001011`) written to the Password Entry Area. - `test_enter_password_fallback_to_cdb_command` — CDB command `0001h` used as fallback when the register write returns `False`. Signed-off-by: Junchao Chen <junchao@mellanox.com>
Junchao-Mellanox
force-pushed
the
public/pr-19
branch
from
August 7, 2026 06:26
0b965c7 to
8557319
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
CMIS defines two ways to deliver the host password that unlocks protected CDB/EEPROM access:
CDB command 0001h is not honored by all CMIS modules. On modules that unlock only via the Password Entry Area, password entry silently fails, which blocks every password-protected CDB/EEPROM operation — firmware download/run/commit and SED-protected access among them. This change makes password entry work across both module families without changing behavior for modules that already unlock via CDB.
How I did it
cdb.py— Reworkedenter_password()to first write the password to the Password Entry Area (page 00h bytes - api/public/cmis.py — New CmisApi.enter_password_via_memory(password), which writes the password to the Password Entry Area and then interprets the result:How to verify it
Unit tests in tests/sonic_xcvr/test_cmis.py and tests/sonic_xcvr/test_cdb.py: