Skip to content

Add complete bank support for CMIS transceivers#640

Draft
bobby-nexthop wants to merge 1 commit intosonic-net:masterfrom
nexthop-ai:bank-support-cmis
Draft

Add complete bank support for CMIS transceivers#640
bobby-nexthop wants to merge 1 commit intosonic-net:masterfrom
nexthop-ai:bank-support-cmis

Conversation

@bobby-nexthop
Copy link
Contributor

Description

This PR extends the bank parameter support introduced in PR #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
    • 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 #473.

Motivation and Context

How Has This Been Tested?

Additional Information (Optional)

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>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants