Skip to content

[202511] [xcvrd] Support mixed application codes in CMIS decommission logic (#794)#860

Merged
vmittal-msft merged 1 commit into
sonic-net:202511from
mihirpat1:202511_mixed-breakout-decommission-validation
Jul 22, 2026
Merged

[202511] [xcvrd] Support mixed application codes in CMIS decommission logic (#794)#860
vmittal-msft merged 1 commit into
sonic-net:202511from
mihirpat1:202511_mixed-breakout-decommission-validation

Conversation

@mihirpat1

Copy link
Copy Markdown
Contributor

Cherry-pick of #794 to 202511.

Description

The original is_decommission_required() compared all 8 module lanes against a
single application code (app_new) — the app code of whichever logical port
triggered the check. On an OSFP-8X module configured with mixed breakout
(e.g., 1x400G on lanes 0-3 + 4x100G on lanes 4-7), lanes belonging to sibling
ports have a different valid app code. The old logic saw
current_app != app_new on those sibling lanes and returned True,
triggering an unnecessary decommission cycle.

Motivation and Context

Fix — Two changes in cmis_manager_task.py:

  1. New method get_desired_app_map(api, lport) — reads CONFIG_DB PORT table
    to find all sibling logical ports on the same physical port (matched by
    index). For each sibling, resolves the desired CMIS application code and
    lane mask, building a per-lane desired app map (e.g. [3,3,3,3,1,1,1,1]).
  2. Revised is_decommission_required(api, lport) — accepts lport instead
    of app_new, calls get_desired_app_map(), and compares each lane's
    current app against its per-lane desired app. Lanes currently unused
    (AppSel=0) are ignored.

How Has This Been Tested?

Cherry-pick conflict resolution notes: 202511 differs from master in two
pre-existing ways unrelated to #794 (kept unchanged here):

  • 202511 uses self.is_fast_reboot_enabled = False instance attribute
    (master refactored to lazy accessor _is_fast_reboot_enabled).
  • 202511 keeps the monolithic process_single_lport; master split it into
    handle_cmis_inserted_state / handle_cmis_dp_pre_init_check_state /
    handle_cmis_dp_deinit_state / process_cmis_state_machine.

The functional PR #794 changes (get_host_lane_count,
get_sibling_port_configs, get_desired_app_map, is_decommission_required)
are byte-for-byte identical to master. Call-site updates in the monolithic
process_single_lport (drop gearbox_lanes_dict param; call
is_decommission_required(api, lport)) applied.

Original PR testing (from #794): non-breakout baseline, sfputil reset + SNS,
xcvrd/pmon/swss restart, config reload, device reboot, loopback,
admin shut/no-shut, and DPB (1x800G ↔ 2x400G ↔ 4x200G ↔ 8x100G, 50
iterations each direction).

Additional Information (Optional)

MSFT ADO - 37489480

…onic-net#794)

* [xcvrd] Support mixed application codes in CMIS decommission logic

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Added support for gearbox host lane count

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Created dict for gearbox_lanes_dict

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Added error logs

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Replaced get_application with get_active_apsel_hostlane

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Optimized usage of gearbox_lanes_dict and created functions split getting desired application map

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

---------

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
@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.

@mihirpat1
mihirpat1 requested a review from Copilot July 21, 2026 21:18
@azure-pipelines

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

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 cherry-picks the fix from #794 into the 202511 branch to prevent unnecessary CMIS decommission cycles on OSFP-8X modules configured with mixed breakout by computing a per-lane “desired app code” map across sibling logical ports and comparing against each lane’s active AppSel.

Changes:

  • Add CONFIG_DB-backed sibling port discovery and build a per-lane desired application-code map (get_sibling_port_configs(), get_desired_app_map()).
  • Update is_decommission_required() to accept lport, compare lane-by-lane against the desired map, and ignore unused lanes (AppSel=0).
  • Cache gearbox lane-count data once per task_worker iteration and update call sites/tests accordingly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sonic-xcvrd/xcvrd/cmis/cmis_manager_task.py Adds sibling-port CONFIG_DB lookup and per-lane desired app mapping; updates decommission decision logic; introduces per-iteration gearbox lane-count caching.
sonic-xcvrd/tests/test_xcvrd.py Updates and expands unit tests to cover mixed-mode per-lane decommission logic and the new gearbox-lane cache usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +493 to +495
desired_map = self.get_desired_app_map(api, lport)
active_apsel = api.get_active_apsel_hostlane()
current_map = []
@vmittal-msft
vmittal-msft merged commit 08576c0 into sonic-net:202511 Jul 22, 2026
6 checks passed
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.

4 participants