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

Restore optoe page to default 0 for active cables #548

Merged
merged 5 commits into from
Mar 3, 2025

Conversation

prgeor
Copy link
Collaborator

@prgeor prgeor commented Feb 28, 2025

Description

Restore the optoe's page to page ZERO before reading the Lower page > 127

Motivation and Context

When the module is busy with CDB command, the optoe kernel driver at the end of user page read request, tries to restore the page to Page ZERO and if this write fails because the module could be busy with CDB command (since these modules donot support background CDB mode). Because of this when Xcvrd tries to read offset (> 127) in Lower page, since optoe does not restore the page to 0 for any Lower page access, the page read to these offset will result in wrong page to be read (because of previous page select write failure) and Xcvrd parsing fails causing crash.

Now in optoe EEPROM read API we ensure to restore the Page to ZERO page if the Page select byte is non-zero

How Has This Been Tested?

TBD:

  1. Test on Arista switch
  2. Test on Cisco switch

Additional Information (Optional)

@prgeor prgeor requested a review from Copilot February 28, 2025 00:06
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Choose a reason for hiding this comment

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

PR Overview

This PR restores the optoe page to zero before performing EEPROM reads for offsets greater than 127, preventing potential read errors and crashes when the module is busy with CDB commands.

  • Introduces a new constant, SFP_OPTOE_PAGE_OFFSET.
  • Adds methods to get the current page and restore the page to zero.
  • Modifies the EEPROM read function to check and restore the page if necessary.

Reviewed Changes

File Description
sonic_platform_base/sonic_xcvr/sfp_optoe_base.py Adds new constants and methods to manage the optoe page, and updates read_eeprom accordingly

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

sonic_platform_base/sonic_xcvr/sfp_optoe_base.py:284

  • Comparing the bytearray returned by get_optoe_current_page() directly to 0 may not work as intended; consider checking the first element (e.g., self.get_optoe_current_page()[0] != 0) to correctly verify if the page is zero.
if offset > 127 and offset < 256 and self.get_optoe_current_page() != 0:

sonic_platform_base/sonic_xcvr/sfp_optoe_base.py:284

  • [nitpick] Consider using the SFP_OPTOE_PAGE_OFFSET constant instead of the literal 127 in the condition to maintain consistency within the code.
if offset > 127 and offset < 256 and self.get_optoe_current_page() != 0:
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prgeor prgeor requested a review from mihirpat1 February 28, 2025 00:32
@mihirpat1
Copy link
Contributor

@prgeor Wondering if the current changeset requires special handling for SFF-8472 based transceivers since these transceivers have page select byte at byte 127, A2h instead of A0h.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prgeor
Copy link
Collaborator Author

prgeor commented Feb 28, 2025

@prgeor Wondering if the current changeset requires special handling for SFF-8472 based transceivers since these transceivers have page select byte at byte 127, A2h instead of A0h.

@mihirpat1 Good question. I think we should be good in that case because 0xA0 address space offset > 127 is a reserved space. We don't have a use case today

image

In other words, all Access for offset > 127 will be in 0xA2 address space in SFP case.

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yxieca
Copy link
Contributor

yxieca commented Mar 3, 2025

Why do you only need to reset the page code in 128-255 offset range? do you also need to reset the page code when offset is greater than 255?

@prgeor
Copy link
Collaborator Author

prgeor commented Mar 3, 2025

Why do you only need to reset the page code in 128-255 offset range? do you also need to reset the page code when offset is greater than 255?

@yxieca The optoe kernel driver before r/w to the page >=1 already sets the page selection register.

@prgeor prgeor merged commit c6f6bed into sonic-net:master Mar 3, 2025
5 checks passed
@prgeor
Copy link
Collaborator Author

prgeor commented Mar 3, 2025

@kperumalbfn could you help cherry pick to 202411
@bingwang-ms could you help cherry pick to 202405

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #549

@mihirpat1
Copy link
Contributor

@kperumalbfn @bingwang-ms
MSFT ADO - 31626749

@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #550

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.

7 participants