Skip to content

Create ELSFP memory map classes#678

Open
aditya-nexthop wants to merge 9 commits into
sonic-net:masterfrom
nexthop-ai:aditya.elsfp-mem-map
Open

Create ELSFP memory map classes#678
aditya-nexthop wants to merge 9 commits into
sonic-net:masterfrom
nexthop-ai:aditya.elsfp-mem-map

Conversation

@aditya-nexthop
Copy link
Copy Markdown
Contributor

@aditya-nexthop aditya-nexthop commented May 26, 2026

Cherry pick commits from nexthop-ai#2 to public fork since it wasn't possible to move the original PR to sonic-net

Description

Add memory-map support for ELSFP (External Laser Source Function Plug,
OIF-ELSFP-CMIS-01.0). Builds on the per-page CMIS refactor from #667.

  • mem_maps/public/elsfp.pyElsfpMemMap extends CmisFlatMemMap
    and composes pages 01h, 02h, 1Ah, 1Bh, 2Fh, 9Fh via add_pages(...).
    Excludes lane-datapath pages 10h–13h (not present on ELSFP modules).
  • cmis/pages/page1a.pyElsfpAdvertisementsFlagsCtrlPage (CMIS 1Ah,
    OIF-ELSFP Tables 4–10): module advertisements, lane faults/warnings,
    laser save/restore, alarm masks, per-lane fault/warning codes, lane
    controls, lane-to-fiber mapping, per-lane frequency.
  • cmis/pages/page1b.pyElsfpSetpointsMonitorsPage (CMIS 1Bh,
    Tables 11–12): per-lane bias-current / optical-power setpoints and
    monitors, voltage monitor, ICC monitor.
  • fields/elsfp_consts.py — ELSFP field-name constants.
  • codes/public/cmis.py — adds CONTROL_MODE, LANE_FAULT_CODE,
    LANE_WARNING_CODE, LANE_STATE code tables.
  • cmis/pages/consts.py + __init__.py — ELSFP page-number constants
    and new-class re-exports.
  • cmis/pages/page00_lower.py — adds EXTENDED_MODULE_INFO_FIELD
    (MODULE_FUNCTION_TYPE at byte 57) so ELSFP modules are identifiable
    via the standard module-info block.

Motivation and Context

ELSFP modules expose CMIS but substitute the lane-datapath pages
(10h–13h) for laser-source control pages (1Ah/1Bh) and add their own
fault/warning vocabulary. Without these classes, none of the
ELSFP-specific fields are addressable from sonic-platform-common.

The per-page memory-map refactor in #667 made this composable:
ElsfpMemMap reuses every shared CMIS page and only adds the two ELSFP
pages plus the small set of new codes/consts they reference.

How Has This Been Tested?

pytest suite: 1168 passed in 1.53s (no regressions vs master).
ElsfpMemMap(CmisCodes) instantiates cleanly and exposes the new
field groups via the inherited XcvrMemMap.get_field() lookup.

Additional Information (Optional)

Purely additive — no existing class is modified semantically.

abhi-nexthop and others added 6 commits May 26, 2026 18:02
Signed-off-by: Abhi Singh <abhi@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: aditya-nexthop <aditya@nexthop.ai>
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
Signed-off-by: aditya-nexthop <aditya@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/codes/public/cmis.py
Comment thread sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/elsfp/elsfp.py
Comment thread sonic_platform_base/sonic_xcvr/codes/public/cmis.py Outdated
@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: aditya-nexthop <aditya@nexthop.ai>
@aditya-nexthop aditya-nexthop force-pushed the aditya.elsfp-mem-map branch from f19c2cf to 73a334a Compare May 27, 2026 18:39
@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: aditya-nexthop <aditya@nexthop.ai>
@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

Adds ELSFP (OIF-ELSFP-CMIS-01.0) support to sonic-platform-common by introducing an ELSFP-specific CMIS memory map, new page implementations (1Ah/1Bh), and the accompanying field constants and code tables so ELSFP modules can be identified and their ELSFP-only fields can be accessed via the existing mem-map APIs.

Changes:

  • Introduces ElsfpMemMap composed from standard CMIS pages plus new ELSFP pages 0x1A/0x1B (excluding CMIS lane-datapath pages 0x10–0x13).
  • Adds ELSFP page implementations and ELSFP-specific field-name constants and code tables.
  • Extends CMIS page 0x00 lower to expose MODULE_FUNCTION_TYPE in an EXTENDED_MODULE_INFO_FIELD, with a new unit test covering page composition and basic field/code availability.

Reviewed changes

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

Show a summary per file
File Description
tests/sonic_xcvr/test_elsfp.py Adds unit tests for ElsfpMemMap page composition, field resolvability, and ELSFP-specific code tables.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page1a.py Adds ELSFP CMIS page 0x1A fields (advertisements, flags, controls, masks, lane state).
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page1b.py Adds ELSFP CMIS page 0x1B fields (per-lane setpoints/monitors).
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page00_lower.py Adds EXTENDED_MODULE_INFO_FIELD containing MODULE_FUNCTION_TYPE for ELSFP identification.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/consts.py Defines ELSFP page number constants (0x1A, 0x1B).
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/init.py Re-exports ELSFP page constants and page classes.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/elsfp.py Adds ElsfpMemMap that composes the appropriate CMIS + ELSFP pages.
sonic_platform_base/sonic_xcvr/fields/elsfp_consts.py Adds ELSFP-specific field-name constants for pages 0x1A and 0x1B.
sonic_platform_base/sonic_xcvr/fields/consts.py Adds shared field-name constants for MODULE_FUNCTION_TYPE and EXTENDED_MODULE_INFO_FIELD.
sonic_platform_base/sonic_xcvr/codes/public/elsfp.py Adds ElsfpCodes extending CMIS codes with ELSFP-specific code tables.
sonic_platform_base/sonic_xcvr/codes/public/cmis.py Adds MODULE_FUNCTION_TYPE code table and extends VDM type entries.

Comment thread sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page1a.py Outdated
…eview comments

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

/azp run

@azure-pipelines
Copy link
Copy Markdown

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.

7 participants