Skip to content

Conversation

@bobby-nexthop
Copy link
Contributor

@bobby-nexthop bobby-nexthop commented Jan 28, 2026

Description

This change moves CMIS processing for dp pre init state into its own function. It does not add any logic changes.

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) Add handle_cmis_inserted_state function #738
5) Add handle_cmis_dp_pre_init_check_state function #741
6) Add handle_cmis_dpdeinit_state function bobby-nexthop#6
7) Add handle_cmis_ap_conf_state function bobby-nexthop#7
8) Add handle_cmis_dp_init_state bobby-nexthop#8
9) Add handle_cmis_txon_state bobby-nexthop#9
10) Add handle_cmis_activate_state bobby-nexthop#10

How Has This Been Tested?

Transceivers continue to get programmed correctly with links up, unit tests pass

Additional Information (Optional)

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@bobby-nexthop bobby-nexthop marked this pull request as ready for review January 28, 2026 23:28
@bobby-nexthop bobby-nexthop changed the title Xcvrd refactor 7 Xcvrd Refactor 6/13: Create handle_cmis_dp_pre_init_check_state function for CMIS_DP_PRE_INIT_CHECK Jan 28, 2026
@mihirpat1 mihirpat1 requested a review from Copilot January 29, 2026 01:36
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 continues the xcvrd CMIS state machine refactor by extracting the CMIS_STATE_DP_PRE_INIT_CHECK logic into a dedicated helper method, without changing behavior. The state machine now delegates the datapath pre-init check handling to this new method, improving readability and maintainability.

Changes:

  • Introduced handle_cmis_dp_pre_init_check_state(self, lport) to encapsulate all CMIS_STATE_DP_PRE_INIT_CHECK handling logic.
  • Updated process_cmis_state_machine to call the new handler instead of inlining the datapath pre-init check logic.
  • Preserved existing datapath reinit, Tx power configuration, frequency validation, and READY transition behavior via the new helper’s return value contract.

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

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