Update link up sequence with SI settings sync between OA and xcvrd - #2301
Update link up sequence with SI settings sync between OA and xcvrd#2301arpit-nexthop wants to merge 5 commits into
Conversation
Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
|
/azp run |
|
No pipelines are associated with this pull request. |
mihirpat1
left a comment
There was a problem hiding this comment.
@arpit-nexthop Can you please update the PR description with the table similar to the below so that we can maintain the list of relevant code changes for this HLD change?
#1432 (comment)
|
With this new design, do we prevent the admin state (and host TX signal) from coming up Thanks |
There was a problem hiding this comment.
Pull request overview
Updates the documented interface link bring-up sequence to describe SI settings synchronization between orchagent and xcvrd using a two-field handshake with a monotonic counter.
Changes:
- Replaces the prior NPU SI settings sync description with a two-field protocol (
si_sync_statusin APPL_DB andsi_settings_sync_statusin STATE_DB) including sequence counter semantics. - Updates workflows/mermaid diagrams and CMIS state machine to use
CMIS_STATE_SI_SETTINGS_WAITand new timeout behavior. - Refreshes crash/restart and OIR test-plan tables to reflect the new SI settings sync fields/values.
|
|
||
|
|
||
| 3. The OA upon receiving SI settings (via `si_sync_status` update in APPL_DB) will | ||
| - Disable port admin status (without updating host_tx_ready, to avoid triggering xcvrd) |
There was a problem hiding this comment.
@arpit-nexthop Wouldn't disabling port admin status also cause the CMIS SM to start from CMIS_STATE_INSERTED?
There was a problem hiding this comment.
No, that happens because we set the host_tx_ready to false. Here we are not setting it to false when SI is present. This avoids the xcvrd going to CMIS_INSERTED state.
There was a problem hiding this comment.
@arpit-nexthop I agree that the CMIS reinit happens due to host_tx_ready toggling.
However, what do you mean by Disable port admin status? Wouldn't this cause the CMIS SM to be notified which would eventually result in a CMIS reinit per the below?
https://github.com/sonic-net/sonic-platform-daemons/blob/3bb3540f10f9efbaadfd98f424efad96d561682d/sonic-xcvrd/xcvrd/xcvrd_utilities/port_event_helper.py#L7
https://github.com/sonic-net/sonic-platform-daemons/blob/3bb3540f10f9efbaadfd98f424efad96d561682d/sonic-xcvrd/xcvrd/cmis/cmis_manager_task.py#L1196
There was a problem hiding this comment.
This is not admin status in config_db, this is the call from OA to syncd/gbsyncd for disabling or enabling interface.
There was a problem hiding this comment.
Disable port admin status becomes Disable host port
There was a problem hiding this comment.
@arpit-nexthop Can you please address this comment?
| 4. CMIS_STATE_NPU_SI_SETTINGS_WAIT state will wait for NPU_SI_SETTINGS_DONE and upon reaching to NPU_SI_SETTINGS_DONE, CMIS SM will transition to CMIS_STATE_DP_INIT state. | ||
| There will be a timeout of 5s for every retry | ||
| 4. CMIS_STATE_SI_SETTINGS_WAIT state will wait for `SI_SYNC_DONE:<N>` in STATE_DB `si_settings_sync_status`, where N must match the notification number sent. Upon match, CMIS SM transitions to CMIS_STATE_DP_INIT state. | ||
| There will be a timeout of 10s; upon timeout, CMIS SM proceeds to CMIS_STATE_DP_INIT with a warning (no reinit) |
There was a problem hiding this comment.
@arpit-nexthop Why are we allowing CMIS initialization to progress without applying SI settings in case of timeout?
There was a problem hiding this comment.
I believe this is what we discussed in the meeting, where we wanted to wait for some time, reading the settings being applied. If not we should proceed rather than failing the state machine since SI notification does not happen in the cmis task.
We agreed not to add a notification for settings being programmed.
|
|
||
| 5. The CmisManagerTask thread will set “CMIS_REINIT_REQUIRED" to false after CMIS SM reaches to a steady state (CMIS_STATE_UNKNOWN, CMIS_STATE_FAILED, CMIS_STATE_READY and CMIS_STATE_REMOVED) for the corresponding port | ||
|
|
||
| 6. XCVRD will subscribe to PORT_TABLE in STATE_DB and trigger self-restart if the PORT_TABLE|Ethernet* is deleted for the namespace. |
There was a problem hiding this comment.
@prgeor @arpit-nexthop
Given that swss.sh already restarts xcvrd when media_settings.json is present swss.sh#L429-L440, there's now redundancy between that workaround and this STATE_DB subscription mechanism.
Should the swss.sh workaround be removed as part of this change's implementation PRs?
@benle7 Do you mean warm restart here? swss restart in generally leads to restarting syncd and reprogramming the ASIC as well. |
|
@arpit-nexthop Please help in addressing the comments provided by Copilot as well. |
…TATE_SI_SETTINGS_WAIT state' Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
|
/azp run |
|
No pipelines are associated with this pull request. |
I mean to "systemctl restart swss". |
Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
|
/azp run |
|
No pipelines are associated with this pull request. |
|
@longhuan-cisco , pls review |
Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
|
/azp run |
|
No pipelines are associated with this pull request. |
| Write SI params + si_settings_notification = SI_SETTINGS_NOTIFIED[N] to APPL_DB | ||
| Reset notify_si_settings = False | ||
| end note | ||
| if_state --> CMIS_STATE_READY : if host_tx_ready != True or admin_status != up - Action disable TX |
There was a problem hiding this comment.
Is this correct? How do SI settings get applied when interface us made admin up?
There was a problem hiding this comment.
OA turns shuts the port, applies SI settings and enables port and then sends the notification
There was a problem hiding this comment.
Question is whether state transition to CMIS_STATE_READY is correct here? (if host_tx_ready is not True or Admin status is Down)
There was a problem hiding this comment.
This section of the mermaid template refers to the admin_down state transition
|
|
||
|
|
||
| 3. The OA upon receiving SI settings (via `si_sync_status` update in APPL_DB) will | ||
| - Disable port admin status (without updating host_tx_ready, to avoid triggering xcvrd) |
There was a problem hiding this comment.
@arpit-nexthop Can you please address this comment?
|
|
||
| | Value | Written by | Purpose | | ||
| | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | ||
| | `SI_SETTINGS_DEFAULT:<N>` | 1\. SfpStateUpdateTask during transceiver removal (increments N)<br>2. xcvrd during boot-up initialization | Signals to OA that transceiver was removed or SI settings are in default state | |
There was a problem hiding this comment.
@arpit-nexthop Do you mean the xcvrd main process will perform this action?
xcvrd during boot-up initialization
There was a problem hiding this comment.
This is no longer required as initial removal / insertion notification will take care of this
| - If `si_settings_notification == SI_SETTINGS_DEFAULT:<N>` is received (transceiver removed), OA writes `si_settings_ack = SI_SETTINGS_DEFAULT:<N>` to STATE_DB (no serdes programming) | ||
|
|
||
| 4. CMIS_STATE_SI_SETTINGS_WAIT state will wait for `SI_SYNC_DONE:<N>` in STATE_DB `si_settings_ack`, where N must match the notification number sent. Upon match, CMIS SM transitions to CMIS_STATE_DP_INIT state. | ||
| There will be a timeout of 10s; upon timeout, CmisManagerTask resets `si_settings_notification` to `SI_SETTINGS_DEFAULT:<N+1>` in APPL_DB, sets `notify_si_settings=True`, and calls `force_cmis_reinit(retries+1)`, transitioning back to CMIS_STATE_INSERTED. This consumes a retry (max 3) and causes re-notification on the next INSERTED entry. After exhausting retries, the SM transitions to CMIS_STATE_FAILED. |
There was a problem hiding this comment.
@arpit-nexthop Just to clarify, wouldn't calling force_cmis_reinit(retries+1) automatically trigger SI settings notification?
There was a problem hiding this comment.
We would not want to keep setting the SI settings everytime we do a force cmis reinit, (called in shut/start flow as well). SI settings application will be re-triggered only if we fail to get the notification or an OIR event happens.
|
|
||
| ```mermaid | ||
| stateDiagram | ||
| stateDiagram-v2 |
There was a problem hiding this comment.
@arpit-nexthop Can you please go through this diagram and remove the legacy content?
There was a problem hiding this comment.
@mihirpat1 Added the PRE_INIT check as well. I would recommend viewing the file to see the diagram, the git unified view is not really showing the new diagram, just the old one being deleted.
Signed-off-by: arpit-nexthop <arpit@nexthop.ai>
|
/azp run |
|
No pipelines are associated with this pull request. |
|
@arpit-nexthop, all, Introducing this type of gate for orchagent, in advance of orchagent actually bringing the ASIC port admin up will prevent the churn that is currently seen when an ASIC port has already been enabled but then SI settings arrive at Redis thus causing orchagent to modify ASIC SerDes settings and consequently flap the ASIC port. Waiting at orchagent until such time as the SI settings are confirmed to have arrived from xcvrd (even if there were no changes actually provided by xcvrd with the exception of Redis confirmation flag) would prevent ASIC port from being brought up while only partially configured (in advance of SI settings arrival). Preventing this ASIC port churn/flap will help to clean up the critical enable path such that the ASIC port is only brought up once all provisioning has necessarily been completed and thus commensurately serve to minimize SI related flux within the machinery (as ASIC port(s) are transitioning down-then-up during provisioning time). Am also copying this same comment to orchagent PR #4497. |
|
For clarity, @benle7's suggestion/request earlier is essentially the same ask I made in my previous comment.
|
|
@snider-nokia Correct. @prgeor FYI
|
| 5. The CmisManagerTask thread will set “CMIS_REINIT_REQUIRED” to false after CMIS SM reaches to a steady state (CMIS_STATE_UNKNOWN, CMIS_STATE_FAILED, CMIS_STATE_READY and CMIS_STATE_REMOVED) for the corresponding port | ||
|
|
||
| 5. The CmisManagerTask thread will set “CMIS_REINIT_REQUIRED" to false after CMIS SM reaches to a steady state (CMIS_STATE_UNKNOWN, CMIS_STATE_FAILED, CMIS_STATE_READY and CMIS_STATE_REMOVED) for the corresponding port | ||
| 5a. **`can_skip_cmis_init_after_restart`**: When xcvrd restarts (process restart or warm reboot), CmisManagerTask checks whether full CMIS re-initialization can be skipped for a port. Skipping avoids an unnecessary link flap on already-configured ports. All four conditions must hold: |
There was a problem hiding this comment.
This section describes can_skip_cmis_init_after_restart, including SI notification/ACK matching, but I do not see this helper or equivalent SI-ack based restart-skip logic in the current xcvrd implementation PR.
Current xcvrd appears to rely on is_cmis_application_update_required(), and SI notification is done earlier in INSERTED when notify_si_settings is set. Please either add the described restart-skip logic to the implementation or update the HLD to match the actual behavior.
| Also, this key helps in preventing additional link flap which can happen if CMIS state machine initializes a port before NPU SI settings are applied (since application of NPU SI settings involves disable followed by enable of it). | ||
| In case of continuous restart of xcvrd, both the keys will still hold the same value as before the restart. This would ensure that the port re-initialization is resumed from the last known state. | ||
| - SI settings synchronization uses a two-field protocol to communicate between xcvrd and Orchagent (OA): | ||
| - `si_settings_notification` in PORT_TABLE (APPL_DB): written by xcvrd to signal SI settings state. OA reads this via its normal ConsumerStateTable flow. Values: `SI_SETTINGS_NOTIFIED:<N>` (xcvrd has notified SI settings for sequence N), `SI_SETTINGS_DEFAULT:<N>` (transceiver removed or no SI settings needed for sequence N). |
There was a problem hiding this comment.
Medium: document SI_SETTINGS_UNAVAIL as a third terminal protocol value
The implementation PRs no longer use SI_SETTINGS_DEFAULT:<N> for a present port that has no applicable SI settings. xcvrd publishes the counterless value SI_SETTINGS_UNAVAIL; OA treats it as terminal, does not program SerDes, releases the admin-up gate, and writes si_settings_ack = SI_SETTINGS_UNAVAIL.
| Notification | Meaning | OA response |
|---|---|---|
SI_SETTINGS_NOTIFIED:<N> |
SI settings for this insertion are available | Program them and acknowledge SI_SYNC_DONE:<N> |
SI_SETTINGS_DEFAULT:<N> |
Removal/reset of the numbered transaction | Do not program; acknowledge SI_SETTINGS_DEFAULT:<N> |
SI_SETTINGS_UNAVAIL |
A present port has no applicable SI settings | Do not program; acknowledge SI_SETTINGS_UNAVAIL and release the gate |
The HLD currently lists only NOTIFIED and DEFAULT, and says DEFAULT can also mean "no SI settings needed." That no longer matches either implementation. It also hides the terminal-notification invariant: every gated present external port must eventually receive either NOTIFIED:<N> or UNAVAIL.
Could you add UNAVAIL to both field tables and the relevant flow/state diagrams, and reserve DEFAULT:<N> for removal/reset?
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]
rebuild-source: sonic-net#2301 @ nexthop-ai/SONiC 7fce621 [case: upstream:open]

Updated Interface link up sequence with SI settings sync between orchagent and xcvrd