Skip to content

[WIP]Bank support page refactor#666

Closed
aditya-nexthop wants to merge 15 commits into
sonic-net:masterfrom
nexthop-ai:bank-support-page-refactor
Closed

[WIP]Bank support page refactor#666
aditya-nexthop wants to merge 15 commits into
sonic-net:masterfrom
nexthop-ai:bank-support-page-refactor

Conversation

@aditya-nexthop
Copy link
Copy Markdown
Contributor

Description

Motivation and Context

How Has This Been Tested?

Additional Information (Optional)

bobby-nexthop and others added 15 commits March 30, 2026 21:27
This PR extends the bank parameter support introduced in PR sonic-net#632 to
fully enable multi-bank CMIS transceiver support throughout the stack.

Changes include:

1. **Memory Map Bank Awareness**:
   - Updated CmisFlatMemMap, CmisMemMap, and CCmisMemMap to accept bank parameter
   - Implemented bank-aware getaddr() method in CmisFlatMemMap that correctly
     calculates linear offsets using the formula from sonic-linux-kernel PR sonic-net#473
   - Added bank property to CmisFlatMemMap for read-only access
   - Added constants: CMIS_EEPROM_PAGE_SIZE, CMIS_NUM_NON_BANKED_PAGES,
     CMIS_NUM_BANKED_PAGES, CMIS_ARCH_PAGES
   - Uses unified formula: linear_offset = (bank * CMIS_ARCH_PAGES + page) * page_size + offset
   - Each bank is treated as a full 256-page (32KB) architectural block for proper alignment

2. **API Factory Updates**:
   - Added bank parameter to create_xcvr_api() and _create_cmis_api()
   - Updated CMIS API instantiation to pass bank parameter to memory maps
   - Modified id_mapping to pass bank parameter for all CMIS module types
     (0x18, 0x19, 0x1b, 0x1e)

3. **SfpBase Integration**:
   - Updated refresh_xcvr_api() to pass bank parameter when creating xcvr_api

4. **Field Definitions**:
   - Added BANKS_SUPPORTED_FIELD constant to consts.py
   - Added BanksSupported field to MODULE_CHAR_ADVT in CmisMemMap

This enables proper support for CMIS modules with multiple memory banks,
allowing correct EEPROM access across all banks as defined in the CMIS
specification. The offset calculation formula matches the optoe kernel
driver implementation in sonic-linux-kernel PR sonic-net#473.

Signed-off-by: Bobby McGonigle <bobby@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
…ith a banked register

Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
…n-banked pages

Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
…nk != 0

Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
…bank_size

Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Abhi Singh <abhi@nexthop.ai>
…on easier

Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

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.

5 participants