Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the exception when configure unsupported frequency #397

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

chiourung
Copy link
Contributor

@chiourung chiourung commented Sep 13, 2023

Description

Fix the issue #322

Motivation and Context

  1. Add verify_config_laser_frequency to check frequency eariler
    => It doesn't need to re-init CMIS when configure unsupported frequency.
    Original: re-init CMIS when configure unsupported frequency
Oct 18 09:14:39.210054 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=INSERTED, retries=0
Oct 18 09:14:39.472017 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: force Datapath reinit
Oct 18 09:14:40.487872 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_DEINIT, retries=0
Oct 18 09:14:41.590057 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240 DpDeinit duration 5.0 secs, modulePwrUp duration 10.0 secs
Oct 18 09:14:42.605772 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=AP_CONFIGURED, retries=0
Oct 18 09:14:42.658108 sonic ERR pmon#xcvrd: CMIS: Ethernet240 configured freq:193200 GHz is NOT in 75GHz grid
Oct 18 09:14:42.669000 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240 configured laser frequency 193200 GHz
Oct 18 09:14:43.855498 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_INIT, retries=0
Oct 18 09:14:43.906384 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240 DpInit duration 300.0 secs
Oct 18 09:14:44.922315 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0
Oct 18 09:16:24.641865 sonic NOTICE pmon#xcvrd: message repeated 96 times: [ CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0]
Oct 18 09:16:24.641865 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: Turning ON tx power
Oct 18 09:16:25.700848 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_ACTIVATION, retries=0
Oct 18 09:16:37.433233 sonic NOTICE pmon#xcvrd: message repeated 11 times: [ CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_ACTIVATION, retries=0]
Oct 18 09:16:37.433233 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: READY

After patch the implementation, it would skip to re-init if only invalid frequency is configured.

Oct 18 09:22:20.197207 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=INSERTED, retries=0
Oct 18 09:22:20.495627 sonic ERR pmon#xcvrd: CMIS: Ethernet240 configured freq:193200 GHz is NOT in 75GHz grid
Oct 18 09:22:20.495627 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: no CMIS application update required...READY

It still can do CMIS init, if CMIS application updated is required

Oct 19 01:18:08.541387 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=INSERTED, retries=0
Oct 19 01:18:08.840536 sonic ERR pmon#xcvrd: CMIS: Ethernet240 configured freq:193200 GHz is NOT in 75GHz grid
Oct 19 01:18:08.840536 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: force Datapath reinit
Oct 19 01:18:09.874248 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_DEINIT, retries=0
Oct 19 01:18:11.024655 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240 DpDeinit duration 5.0 secs, modulePwrUp duration 10.0 secs
Oct 19 01:18:12.075646 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=AP_CONFIGURED, retries=0
Oct 19 01:18:13.696503 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_INIT, retries=0
Oct 19 01:18:13.810656 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240 DpInit duration 300.0 secs
Oct 19 01:18:14.826569 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0
Oct 19 01:18:17.159367 sonic NOTICE pmon#xcvrd: message repeated 2 times: [ CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0]
Oct 19 01:18:17.186024 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0
Oct 19 01:18:20.573053 sonic NOTICE pmon#xcvrd: message repeated 3 times: [ CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0]
Oct 19 01:18:20.615286 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0
Oct 19 01:19:58.512031 sonic NOTICE pmon#xcvrd: message repeated 94 times: [ CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_TXON, retries=0]
Oct 19 01:19:58.512031 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: Turning ON tx power
Oct 19 01:19:59.527643 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_ACTIVATION, retries=0
Oct 19 01:20:11.887326 sonic NOTICE pmon#xcvrd: message repeated 12 times: [ CMIS: Ethernet240: 400G, lanemask=0xff, state=DP_ACTIVATION, retries=0]
Oct 19 01:20:11.887326 sonic NOTICE pmon#xcvrd: CMIS: Ethernet240: READY
  1. Catch the exception for set_laser_freq

Signed-off-by: chiourung_huang [email protected]

1. Add verify_config_laser_frequency to check frequency eariler
2. Catch the exception for set_laser_freq

Signed-off-by: chiourung_huang <[email protected]>
@@ -1323,18 +1323,31 @@ def configure_tx_output_power(self, api, lport, tx_power):
self.log_error("{} configured tx power {} > maximum power {} supported".format(lport, tx_power, max_p))
return api.set_tx_power(tx_power)

def configure_laser_frequency(self, api, lport, freq, grid=75):
_, _, _, lowf, highf = api.get_supported_freq_config()
def verify_config_laser_frequency(self, api, lport, freq, grid=75):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a description for this function?
Also, are we not planning to handle other frequency grid checks in this function?

# If user requested frequency is NOT the same as configured on the module
# force datapath re-initialization
if 0 != freq and freq != api.get_laser_config_freq():
if self.verify_config_laser_frequency(api, lport, freq) == True:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this to configure_laser_frequency?
Since with the current implementation, a port could remain uninitialized forever if the configured frequency is invalid.
Moving the check to configure_laser_frequency will allow to proceed with CMIS initialization with default frequency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Line 1571: need_update = self.is_cmis_application_update_required(api, appl, host_lanes_mask)
If the configured frquency is invalid, then it would not change the value of need_update.
If there is some other situation that requires initialization, it will still do the initialization.
If only the frequency is different and the frequency is invalid, I think it is not necessary to do initialize.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Line 1571: need_update = self.is_cmis_application_update_required(api, appl, host_lanes_mask)
If the configured frquency is invalid, then it would not change the value of need_update.
If there is some other situation that requires initialization, it will still do the initialization.
If only the frequency is different and the frequency is invalid, I think it is not necessary to do initialize.

Copy link
Contributor

@mihirpat1 mihirpat1 left a comment

Choose a reason for hiding this comment

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

Please attach the Unit-test results with user configuring valid frequency and invalid frequency.

Copy link
Collaborator

@prgeor prgeor left a comment

Choose a reason for hiding this comment

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

@chiourung could you address comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants