Skip to content

sfp-refactor 400zr integration#216

Closed
qinchuanares wants to merge 17 commits intosonic-net:masterfrom
qinchuanares:sfp-refactor-400zr-integration
Closed

sfp-refactor 400zr integration#216
qinchuanares wants to merge 17 commits intosonic-net:masterfrom
qinchuanares:sfp-refactor-400zr-integration

Conversation

@qinchuanares
Copy link
Contributor

This is a sfp-refactor follow-up work: to add 400ZR driver and high level functions into sfp-refactor. To query the keys in state_DB and write keys in config_DB into the module.

Description

The PR aims to provide 400ZR + SONiC support.

Motivation and Context

To be updated

How Has This Been Tested?

To be updated

Additional Information (Optional)

@lgtm-com
Copy link

lgtm-com bot commented Aug 30, 2021

This pull request introduces 3 alerts when merging bbabcc4 into a09f5a3 - view on LGTM.com

new alerts:

  • 3 for Variable defined multiple times

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.

The CMIS API would stay for long time, would you please add brief description for each API, about the params and the return value/data. Please also add test cases for QSFP-DD modules. Please address my other comments.

@prgeor
Copy link
Collaborator

prgeor commented Oct 13, 2021

@qinchuanares could you fix LGTM warnings and also resolve the merge conflict?

@lgtm-com
Copy link

lgtm-com bot commented Oct 13, 2021

This pull request introduces 27 alerts when merging e3cc76a into 2ebd786 - view on LGTM.com

new alerts:

  • 16 for Variable defined multiple times
  • 7 for Except block handles 'BaseException'
  • 2 for Unused local variable
  • 2 for Unused import

@qinchuanares qinchuanares requested a review from prgeor October 14, 2021 17:38
@prgeor prgeor self-assigned this Oct 19, 2021
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.

@qinchuanares could you address review comments.

@@ -22,7 +23,7 @@ def _get_id(self):

def create_xcvr_api(self):
# TODO: load correct classes from id_mapping file
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you rebase your code with latest master?

return bytearray(struct.pack(self.format, int(val * self.scale)))
return bytearray(struct.pack(self.format, int(val)))

class ListRegField(RegField):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do see this field used in CMIS memmap for TRANS_CDB, CDB_LPL, CDB_CMD, CDB_WRITE_MSG, but I don't see you are using it for decode/encode. I see for CDB, you are using write_flexible(). If not using remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@qinchuanares still not resolved. if resolved point me to where ListRegField is used. if not used delete ListRegField

@prgeor
Copy link
Collaborator

prgeor commented Oct 19, 2021

This is a sfp-refactor follow-up work: to add 400ZR driver and high level functions into sfp-refactor. To query the keys in state_DB and write keys in config_DB into the module.

Description

The PR aims to provide 400ZR + SONiC support.

Motivation and Context

To be updated

How Has This Been Tested?

To be updated

Additional Information (Optional)

@qinchuanares could you update the above sections of your PR? Also please add link to your HLD in the PR description.

rx_power_high_warn = self.xcvr_eeprom.read(consts.RX_POWER_HIGH_WARN)
rx_power_low_warn = self.xcvr_eeprom.read(consts.RX_POWER_LOW_WARN)
rx_power_dict = {'monitor value lane1': rx_power,
'high alarm': rx_power_high_alarm,
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 rename the dict keys similar to the ones defined(get_rx_power() ) in sff8436?.

voltage_low_alarm = self.xcvr_eeprom.read(consts.VOLTAGE_LOW_ALARM)
voltage_high_warn = self.xcvr_eeprom.read(consts.VOLTAGE_HIGH_WARN)
voltage_low_warn = self.xcvr_eeprom.read(consts.VOLTAGE_LOW_WARN)
voltage_dict = {'monitor value': voltage,
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 rename the dict keys similar to the ones defined in sff8436?.

tx_power_low_alarm = self.xcvr_eeprom.read(consts.TX_POWER_LOW_ALARM)
tx_power_high_warn = self.xcvr_eeprom.read(consts.TX_POWER_HIGH_WARN)
tx_power_low_warn = self.xcvr_eeprom.read(consts.TX_POWER_LOW_WARN)
tx_power_dict = {'monitor value lane1': tx_power,
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 rename the dict keys similar to the ones defined in sff8436?.

tx_power_low_alarm = self.xcvr_eeprom.read(consts.TX_POWER_LOW_ALARM)
tx_power_high_warn = self.xcvr_eeprom.read(consts.TX_POWER_HIGH_WARN)
tx_power_low_warn = self.xcvr_eeprom.read(consts.TX_POWER_LOW_WARN)
tx_power_dict = {'monitor value lane1': tx_power,
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 rename the dict keys similar to the ones defined in sff8436?.

tx_bias_current_low_alarm = self.xcvr_eeprom.read(consts.TX_BIAS_CURR_LOW_ALARM)
tx_bias_current_high_warn = self.xcvr_eeprom.read(consts.TX_BIAS_CURR_HIGH_WARN)
tx_bias_current_low_warn = self.xcvr_eeprom.read(consts.TX_BIAS_CURR_LOW_WARN)
tx_bias_current_dict = {'monitor value lane1': tx_bias_current,
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 rename the dict keys similar to the ones defined in sff8436?.

case_temp_low_alarm = self.xcvr_eeprom.read(consts.CASE_TEMP_LOW_ALARM)
case_temp_high_warn = self.xcvr_eeprom.read(consts.CASE_TEMP_HIGH_WARN)
case_temp_low_warn = self.xcvr_eeprom.read(consts.CASE_TEMP_LOW_WARN)
case_temp_dict = {'monitor value': case_temp,
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 rename the dict keys similar to the ones defined in sff8436?.

tx_power_high_warn_dict['TX_lane%d' %(bitpos+1)] = bool((tx_power_high_warn >> bitpos) & 0x1)
tx_power_low_warn_dict['TX_lane%d' %(bitpos+1)] = bool((tx_power_low_warn >> bitpos) & 0x1)

tx_power_flag_dict = {'tx_power_high_alarm': tx_power_high_alarm_dict,
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 rename the dict keys similar to the ones defined in sff8436?.

rx_power_high_warn_dict['RX_lane%d' %(bitpos+1)] = bool((rx_power_high_warn >> bitpos) & 0x1)
rx_power_low_warn_dict['RX_lane%d' %(bitpos+1)] = bool((rx_power_low_warn >> bitpos) & 0x1)

rx_power_flag_dict = {'rx_power_high_alarm': rx_power_high_alarm_dict,
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 rename the dict keys similar to the ones defined in sff8436?.

Copy link
Contributor

Choose a reason for hiding this comment

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

please check whether the dict keys defined are similar to existing sff8436/sff8636?

@qinchuanares
Copy link
Contributor Author

@qinchuanares could you fix LGTM warnings and also resolve the merge conflict?

Resolved.

@prgeor prgeor reopened this Oct 22, 2021
…m cmis; 3. split cmis and ccmis api when creating xcvr_api in xcvr_api_factory; 4. remove print and add logger to collect info for syslog
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.

can you please address review comments? please mark the comment as 'resolved' if done so.

return bytearray(struct.pack(self.format, int(val * self.scale)))
return bytearray(struct.pack(self.format, int(val)))

class ListRegField(RegField):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@qinchuanares still not resolved. if resolved point me to where ListRegField is used. if not used delete ListRegField

@prgeor
Copy link
Collaborator

prgeor commented Nov 8, 2021

@qinchuanares closing this PR since all changes moved to PR228

@prgeor prgeor closed this Nov 8, 2021
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
…; fix the get_firmware_version API to sync with download_firmware (sonic-net#216)

Signed-off-by: vaibhav-dahiya [email protected]

Description
This PR refactors the listening of port probes from linkmgr to xcvrd as so that xcvrd does not see timeout messages like these below

Sep 27 22:24:37.490921 SONIC WARNING mux#linkmgrd: link_manager/LinkManagerStateMachine.cpp:815 handleMuxWaitTimeout: Ethernet120: xcvrd timed out responding to linkmgrd, current state: (P: Unknown, M: Wait, L: Down)

Refactoring to a separate listener thread mode as well as removing the lock(safe because read/write transaction via eeprom for port probe) seems to handle this, and does not have the logs like this one above.
as the read write eeprom also has a mutex lock in the platform api call, optoe implementation.
https://github.com/Azure/sonic-linux-kernel/blob/889d76e36b3f012d3782a1c5e1587c32e4d1ed11/patch/driver-support-optoe.patch#L717

Motivation and Context
refactor xcvrd for listening to port probes, disable calling the get_firmware_api() while a download is in progress.

Signed-off-by: vaibhav-dahiya <[email protected]>
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