sonic-net / sonic-net/sonic-platform-common

SFF-8472 Rx power conversion function incorrect

Open
#449 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
58
Forks
241
Avg merge
5d 12h
Merged PRs (30d)
8

Description

https://github.com/sonic-net/sonic-platform-common/blob/2606cd5fb0a58fc956577602235a9f8f84a887c6/sonic_platform_base/sonic_sfp/sff8472.py#L831-L871

SFF-8472 section 9.3

The specification states, under 5)
Received power, RX_PWR, is given in uW by the following equation:

Rx_PWR (uW) = Rx_PWR(4) * Rx_PWR_ADe4 (16 bit unsigned integer) +
           Rx_PWR(3) * Rx_PWR_ADe3 (16 bit unsigned integer) +
           Rx_PWR(2) * Rx_PWR_ADe2 (16 bit unsigned integer) +
           Rx_PWR(1) * Rx_PWR_AD (16 bit unsigned integer) +
           Rx_PWR(0)

which means Rx_PWR_AD is raised to the power of 4, 3 and 2 respectively in the expression. The comment and code does not reflect that.

Furthermore, the calibration constants are stored in IEEE Std 754 single precision float format in the device. These cannot be treated as integers, as is done in the code.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with sonic_platform_base/sonic_sfp/sff8472.py around lines 831-871 and compare the implementation with SFF-8472 section 9.3. Verify how the received-power calibration constants are represented in the device, then correct the power expression and constant handling. Done means the function follows the specified polynomial and interprets the constants as IEEE 754 single-precision floats.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.