Skip to content

C-CMIS PM API and memory map support - #719

Open
nkanchi-nexthop wants to merge 3 commits into
sonic-net:masterfrom
nexthop-ai:nkanchi.c-cmis-pm-support
Open

C-CMIS PM API and memory map support#719
nkanchi-nexthop wants to merge 3 commits into
sonic-net:masterfrom
nexthop-ai:nkanchi.c-cmis-pm-support

Conversation

@nkanchi-nexthop

@nkanchi-nexthop nkanchi-nexthop commented Jul 16, 2026

Copy link
Copy Markdown

Description

  • Adds C-CMIS Page 3Ah support and completes the missing Page 35h fields following C-CMIS 1.4.
  • Adds the corresponding register field constants to fields/consts.py, a new page3a.py memory map page, and wires it into the page registry.
  • Adds a Page 42h "Performance Monitoring Advertisement" memory map page and constants, and wires it into CCmisApi.get_pm_all()/get_transceiver_pm() so the newly-added Page 35h monitors are only read when the module advertises them as implemented.
  • Adds the missing Page 3Ah host-interface PM fields.
  • Currently 34h raw counters are used to derive PM fields that populate the dict. Now added the raw counters from 34h into the dict as well.
  • Adds advertisement for CMIS revision and C-CMIS support.
Page Description
34h Media Lane FEC performance monitoring fields
35h Media Lane Link performance monitoring fields
3Ah Host interface performance monitoring fields
42h Performance Monitoring advertisement fields

Motivation and Context

  • The memory map was missing several coherent PM registers defined in C-CMIS 1.4 (page 35h bytes 212-241), so these newer optical PMs for coherent modules could not be read.
  • The memory map was missing page 3Ah entirely, so hosts couldn't read host-side FEC/frame performance counters
  • The C-CMIS 1.4 spec marks Page 34h and 35h monitors as optional and gates them behind Page 42h advertisement bits and the original Page 34h/35h fields are left ungated since existing consumers depend on those keys always being populated.
  • Only the new fields added to page 35h need the new advertisement check.
  • Page 3Ah counters have no corresponding Page 42h advertisement in the spec, so they're always read.

How Has This Been Tested?

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Signed-off-by: Nikhil Kanchi <nkanchi@nexthop.ai>
@nkanchi-nexthop
nkanchi-nexthop force-pushed the nkanchi.c-cmis-pm-support branch from b9cf5ea to 08d58a9 Compare July 16, 2026 22:27
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 719 in repo sonic-net/sonic-platform-common

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

(byte 142, bit 4). For modules complying with CMIS 5.3 or
later, that bit is used for checking C-CMIS support.
'''
cmis_major = self.xcvr_eeprom.read(consts.CMIS_MAJOR_REVISION)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not just use get_cmis_rev?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends the SONiC CMIS/C-CMIS transceiver support by adding missing C-CMIS 1.4 performance-monitoring (PM) memory-map pages/fields and wiring them into the C-CMIS API so callers can retrieve additional coherent and host-interface PM counters, with Page 42h-based gating for newly introduced optional Page 35h monitors.

Changes:

  • Add new CMIS page implementations for C-CMIS Page 3Ah (host-interface PM) and Page 42h (PM advertisement bits) and register them in the C-CMIS memory map.
  • Extend Page 35h with additional PM fields, and gate only the newly added Page 35h monitor groups behind Page 42h “implemented” advertisement bits.
  • Expand CCmisApi.get_pm_all() / get_transceiver_pm() to include Page 3Ah host counters and expose raw Page 34h counters alongside derived ratios; update unit tests accordingly.

Reviewed changes

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

Show a summary per file
File Description
tests/sonic_xcvr/test_cmis.py Adds CMIS 5.3+ coherent-pages advertisement test coverage for is_coherent_module().
tests/sonic_xcvr/test_ccmis.py Adds/updates tests for new PM pages, gating behavior, and raw counter exposure.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page42.py Introduces Page 42h PM advertisement bit memory map.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page3a.py Introduces Page 3Ah host-interface PM counter memory map.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page35.py Adds the missing C-CMIS 1.4 Page 35h PM fields.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/page01.py Adds the coherent-pages support advertisement bit definition.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/pages/init.py Exports the new Page 3Ah and Page 42h classes.
sonic_platform_base/sonic_xcvr/mem_maps/public/cmis/c_cmis.py Wires new pages into the C-CMIS memory map registry.
sonic_platform_base/sonic_xcvr/fields/consts.py Adds new field constants for Page 35h additions, Page 3Ah counters, and Page 42h advertisement bits.
sonic_platform_base/sonic_xcvr/api/xcvr_api.py Documents additional PM keys surfaced via transceiver PM APIs.
sonic_platform_base/sonic_xcvr/api/public/cmis.py Updates is_coherent_module() to use CMIS 5.3+ coherent-pages advertisement bit when available.
sonic_platform_base/sonic_xcvr/api/public/c_cmis.py Adds Page 42h-gated logic for new Page 35h monitors and adds Page 3Ah/34h raw counters to PM output.

Comment on lines +1055 to +1057
CMIS 5.3 introduced an C-CMIS advertisement bit on Page 01h
(byte 142, bit 4). For modules complying with CMIS 5.3 or
later, that bit is used for checking C-CMIS support.
Comment on lines +577 to +580
RX_SOPROC_IMPL = "rxSopcrImpl"
RX_AVG_SOPROC_PM_IMPL = "rxAvgSopcrPmImpl"
RX_MIN_SOPROC_PM_IMPL = "rxMinSopcrPmImpl"
RX_MAX_SOPROC_PM_IMPL = "rxMaxSopcrPmImpl"
RX_MAX_SNR_MARGIN_PM = "rxMaxSNRMarginPm"
RX_AVG_QFACTOR_PM = "rxAvgQFactorPm"
RX_MIN_QFACTOR_PM = "rxMinQFactorPm"
RX_MAX_PM_QFACTOR = "rxMaxPmQFactor"
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@prgeor

prgeor commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

@nkanchi-nexthop you need to sign the DCO agreement for checker to pass

Signed-off-by: Nikhil Kanchi <nkanchi@nexthop.ai>
@nkanchi-nexthop
nkanchi-nexthop force-pushed the nkanchi.c-cmis-pm-support branch from ab75e03 to 516b88f Compare July 31, 2026 07:29
@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.

5 participants