Add CpoCmisApi - #742
Conversation
…ituents Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR refactors CmisApi (CMIS transceiver API) aggregate “read-many-registers then return a dict” methods to expose separate banked vs non-banked entry points, enabling xcvrd (especially for CPO/shared-device scenarios) to avoid redundant non-banked EEPROM reads while preserving the existing aggregate APIs.
Changes:
- Split
get_transceiver_info()intoget_non_banked_transceiver_info()+get_banked_transceiver_info()and recompose in the original method. - Split DOM reads/flags and status/status-flags similarly into banked and non-banked helpers, with the original aggregate methods now merging the two parts.
- Split the transceiver-info default dictionary into banked/non-banked subsets and keep an aggregate default dict.
Suppressed comments (1)
sonic_platform_base/sonic_xcvr/api/public/cmis.py:419
- Avoid the explicit line continuation ("\") here; it makes the indentation misleading and is prone to style/lint issues. This assignment fits on one line cleanly.
xcvr_info["%s%d" % ("active_apsel_hostlane", lane)] = \
apsel_dict["%s%d" % (consts.ACTIVE_APSEL_HOSTLANE, lane)]
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
prgeor
left a comment
There was a problem hiding this comment.
@bgallagher-nexthop I was wondering if we should deal with this nuance in cpo specific CMIS api override?
I think that approach would work too:
I think the downside is that we will have a maintenance cost of keeping What do you think? |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…class of CmisApi Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
1c0342a to
7753dad
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…-banked split Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Changed the approach to use a CPO specific subclass that splits some aggregate methods into banked / non-banked constituent methods instead of modifying |
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 08a113e [case: upstream:open]
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 08a113e [case: upstream:open]
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 08a113e [case: upstream:open]
Signed-off-by: Brian Gallagher <bgallagher@nexthop.ai>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 8d68046 [case: upstream:open]
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 8d68046 [case: upstream:open]
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 8d68046 [case: upstream:open]
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 8d68046 [case: upstream:open]
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 8d68046 [case: upstream:open]
rebuild-source: sonic-net#742 @ nexthop-ai/sonic-platform-common 8d68046 [case: upstream:open]
Description
CmisApihas aggregate functions that read multiple registers and return a dict containing logically grouped information back toxcvrd. For instance,get_transceiver_infois a good example of one of these functions.This PR implements CPO-specific subclass of
CmisApithat splits those aggregate functions into smaller functions that return banked or non-banked information. Takingget_transceiver_infofor example, there will now be 3 functions:get_banked_transceiver_info, which will return only bank-dependent informationget_non_banked_transceiver_info, which will return only bank-independent informationget_transceiver_infowill continue to exist, but internally it will just call the two above functions and return the union of their output.This functionality is limited to a CPO subclass since the ability to read banked and non-banked information independently is only required by CPO at this time.
Motivation and Context
For CPO, there is a desire to limit reading non-banked information from the hardware for each port because many ports may share the same device. Reading non-banked information multiple times from the same device for each port would waste i2c read bandwidth, so the functions have been split to allow
xcvrdto selectively read non-banked information only as much as necessary and avoid duplicate reads.How Has This Been Tested?
A new test class for
CpoCmisApihas been introduced that will run all existing test-cases defined forCmisApiagainst the subclass. The subclass adds no new functionality, just exposes new functions.