Skip to content

[sfp-refactor] Add initial support for SFF-8636 in sonic_xcvr #218

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

Merged
merged 9 commits into from
Oct 7, 2021

Conversation

andywongarista
Copy link
Contributor

Description

This PR adds basic support for the SFF-8636 transceiver spec within the new sonic_xcvr package.
Also adds additional helper functions in XcvrApi that check if a particular xcvr feature is supported.

Motivation and Context

See the HLD: https://github.com/Azure/SONiC/blob/master/doc/sfp-refactor/sfp-refactor.md

How Has This Been Tested?

Added new unit test under tests/sonic_xcvr
Verified API calls on an Arista platform

Additional Information (Optional)

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.

could you address review comments?

@@ -23,21 +23,21 @@ def __init__(self, codes):
CodeRegField(consts.ID_FIELD, self.get_addr(0, 128), self.codes.XCVR_IDENTIFIERS),
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are all the unrelated fields ID_FIELD, POWER_CLASS_FIELD, CRD_TX_FIELD, LENGTH_SMF_KM_FIELD etc being grouped under SERIAL_ID? Can we break the fields further into related group of fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you look at the spec, all of these fields are defined in "Table 29 - Serial ID". The SERIAL_ID group field is analogous to this table.

@@ -0,0 +1,126 @@
from .sff8024 import Sff8024

class Sff8636Codes(Sff8024):
Copy link
Collaborator

Choose a reason for hiding this comment

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

As mentioned earlier review for SFF8436 PR, can we reuse these codes from SFF8436 or vice-versa? We should avoid duplication and have single source of truth

@@ -83,8 +83,8 @@ def get_transceiver_bulk_status(self):
return None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a comment in the file sff8436.py. "This file implements the APIs as per SFF-8436 for QSFP+ 4x10Gbps pluggable transceiver"?

@@ -0,0 +1,345 @@
from ...fields import consts
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a comment in the file sff8636.py. "This file implements the APIs as per the SFF-8636 specification for QSFP28 pluggable transceiver?

def get_transceiver_thresholds_support(self):
return not self.is_flat_memory()

def get_lpmode_support(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

All modules support low power mode (including copper cable and active cables), so I am not sure what this API is trying to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See other response

Comment on lines +93 to +95
"rx_los": all(rx_los) if self.get_rx_los_support() else 'N/A',
"tx_fault": all(tx_fault) if self.get_tx_fault_support() else 'N/A',
"tx_disable": all(tx_disable),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure about the usage of all() here because even if a single lane has "rx_los" set, the 100G port will be down. Shouldn't be:

any(rx_los)

Comment on lines +38 to +40
self.reader.return_value = bytearray([0xFF])
self.api.set_power_override(True, True)
self.reader.return_value = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does test do in line 38 and 40?

Comment on lines 14 to +20
from .codes.public.sff8436 import Sff8436Codes
from .api.public.sff8436 import Sff8436Api
from .mem_maps.public.sff8436 import Sff8436MemMap

from .codes.public.sff8636 import Sff8636Codes
from .api.public.sff8636 import Sff8636Api
from .mem_maps.public.sff8636 import Sff8636MemMap
Copy link
Collaborator

Choose a reason for hiding this comment

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

when are you planning to remove all these imports?

"""
sff8636.py

Implementation of SFF-8636 Rev 2.10a
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reword? Memory map implementation of ...

Comment on lines +323 to +327
def get_rx_los_support(self):
return True

def get_tx_bias_support(self):
return True
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two APIs are not supported by passive or copper cables

@prgeor prgeor merged commit 2ebd786 into sonic-net:master Oct 7, 2021
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
Increase unit test coverage for xcvrd.py
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.

2 participants