Skip to content

[CMIS] Gracefully handle setting of max_banks_size in optoe#668

Open
prgeor wants to merge 4 commits into
sonic-net:masterfrom
prgeor:cmis-bank
Open

[CMIS] Gracefully handle setting of max_banks_size in optoe#668
prgeor wants to merge 4 commits into
sonic-net:masterfrom
prgeor:cmis-bank

Conversation

@prgeor
Copy link
Copy Markdown
Collaborator

@prgeor prgeor commented May 18, 2026

Description

Refactored the code to gracefully handle setting of the maximum bank size for platforms using optoe kernel driver for the CMIS compliant transceivers/CPO

Motivation and Context

Use existing EEPROM memory map scheme for max supported bank and handle cases where platform does not use optoe driver

How Has This Been Tested?

Unit test

Additional Information (Optional)

@prgeor prgeor requested a review from Copilot May 18, 2026 19:05
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Prince George <prgeor@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 refactors CMIS/optoe bank-size handling so the maximum supported bank value can be derived from the CMIS EEPROM memory map and applied to the optoe max_bank_size sysfs entry when available.

Changes:

  • Adds a CMIS API accessor for supported banks.
  • Converts the CMIS BanksSupported field to use a code table.
  • Updates optoe refresh logic to attempt setting max_bank_size after API refresh.

Reviewed changes

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

File Description
sonic_platform_base/sonic_xcvr/sfp_optoe_base.py Updates optoe max_bank_size sysfs handling and refresh flow.
sonic_platform_base/sonic_xcvr/api/public/cmis.py Adds a CMIS accessor for maximum supported banks.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis.py Changes BanksSupported decoding to use CMIS code mappings.
sonic_platform_base/sonic_xcvr/codes/public/cmis.py Adds the CMIS bank-support code table.

Comment thread sonic_platform_base/sonic_xcvr/sfp_optoe_base.py Outdated
Comment on lines +335 to +337
except:
max_bank_size = 0
pass
MAX_BANKS_SUPPORTED = {
0: 0,
1: 2,
2: 4
Comment on lines +147 to +153
def get_max_supported_banks(self):
"""Returns max supported banks"""

if self.is_flat_memory():
return 0

return self.xcvr_eeprom.read(consts.BANKS_SUPPORTED_FIELD)
Signed-off-by: Prince George <prgeor@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Prince George <prgeor@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Prince George <prgeor@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@bgallagher-nexthop bgallagher-nexthop left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Prince

Copy link
Copy Markdown
Contributor

@aditya-nexthop aditya-nexthop left a comment

Choose a reason for hiding this comment

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

LGTM

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.

6 participants