Skip to content

[sonic_xcvr]: Preserve VDM control bits when freezing stats - #759

Closed
mzwang-arista wants to merge 1 commit into
sonic-net:masterfrom
mzwang-arista:arista/vdm-freeze-rmw
Closed

mzwang-arista wants to merge 1 commit into
sonic-net:masterfrom
mzwang-arista:arista/vdm-freeze-rmw

Conversation

@mzwang-arista

Copy link
Copy Markdown
Contributor

Description

Update CMIS VDM freeze and unfreeze operations to use read-modify-write
on the VDM control register. This changes only the freeze control bit
(bit 7), preserving other control bits defined by CMIS 5.4.

Add unit coverage for preserved control bits, EEPROM read failure without
a write, and EEPROM write failure.

Motivation and Context

The existing implementation writes a hardcoded value to the entire VDM
control byte (page 0x2F, byte 144). CMIS 5.4 defines additional control
bits in this byte; overwriting it can unintentionally clear or modify
them, causing VDM data to stop being reported.

How Has This Been Tested?

Ran the focused CMIS unit-test suite using sonic-py-common from
SONiC buildimage:

PYTHONPATH=/garage/mzwang/sonic-buildimage/src/sonic-py-common \
pytest -o addopts='' -q tests/sonic_xcvr/test_ccmis.py

Result:

47 passed in 0.30s

Also tested on a module where the prior implementation cleared
additional VDM control bits, causing VDM data not to be reported.
With this change, freeze/unfreeze preserves those bits and VDM
reporting continues normally.

Read-modify-write the VDM control register so freeze and unfreeze only modify bit 7, preserving CMIS 5.4 control bits. Return failure when the control register cannot be read.

Add coverage for preserved bits, failed reads, and failed writes.

Signed-off-by: Michael Wang <mzwang@arista.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@mzwang-arista

Copy link
Copy Markdown
Contributor Author

Duplicate #757

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