Skip to content

Conversation

@bobby-nexthop
Copy link
Contributor

@bobby-nexthop bobby-nexthop commented Nov 21, 2025

Description

This change moves CMIS processing into a new function process_cmis_state_machine. This will be broken up further in future PRs

Motivation and Context

xcvrd has gotten to 4000 lines long. To make things easier, we'd like to refactor it. This is the second PR in a series that aims to do the following:

Task PR
1) Move functions used across multiple files in xcvrd to utils/common.py #654
2) Move CmisManagerTask into cmis/cmis_manager_task.py #691
3) Split task_worker into process_single_lport #701
4) Move cmis logic out of process_single_lport #716
4) Rename xcvrd/xcvrd_utilities to xcvrd/utils bobby-nexthop#3
5) Add handle_cmis_inserted_state function bobby-nexthop#4
6) Add handle_cmis_dp_pre_init_check_state function bobby-nexthop#5
7) Add handle_cmis_dpdeinit_state function bobby-nexthop#6
8) Add handle_cmis_ap_conf_state function bobby-nexthop#7
9) Add handle_cmis_dp_init_state bobby-nexthop#8
10) Add handle_cmis_txon_state bobby-nexthop#9
11) Add handle_cmis_activate_state bobby-nexthop#10

The new flow will go from calling task_worker() to
CMIS Refactor Flow

How Has This Been Tested?

  1. All unit tests pass
  2. tested on device with no issues, links all up.

Additional Information (Optional)

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@bobby-nexthop bobby-nexthop reopened this Nov 24, 2025
@mssonicbld
Copy link
Collaborator

/azp run

1 similar comment
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@bobby-nexthop
Copy link
Contributor Author

@mihirpat1 @prgeor

@mihirpat1 mihirpat1 requested a review from Copilot December 4, 2025 17:07
Copilot finished reviewing on behalf of mihirpat1 December 4, 2025 17:11
Copy link

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 the CmisManagerTask by extracting CMIS state machine processing logic from process_single_lport into a new dedicated function process_cmis_state_machine. This is part 4 of a larger refactoring effort to improve code organization and maintainability of the xcvrd daemon.

  • Extracted state machine logic into process_cmis_state_machine for better code organization
  • Refactored process_single_lport to validate inputs and prepare data before invoking the state machine
  • Preserved all existing functionality and error handling paths

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

@prgeor
Copy link
Collaborator

prgeor commented Dec 6, 2025

@bobby-nexthop is there any change in the logic or only in code arranagement?

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.

3 participants