[202012][sffbase] change TX/RX POWER value from '-inf' to '-40dB' when the raw data is 0 #314
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
according to the Transceiver EEPROM DOM description, the measurement range of TX/RX POWER is 0 to 6.5535
mW (~-40 to +8.2 dBm) , detail please refer to SFF8636, CMIS, etc.
With the current implementation, when the raw data is 0, it will be converted to a special string '-inf dB', however, since this string does not contain a valid number, eventually, it will be treated as an invalid value and will be interpreted as 'N/A'. When the cable doesn't support this measurement, the platform API will also return 'N/A' as a result, so the current implementation can not differentiate these two cases.
furthermore, in the CLI(show interface transceiver eeprom -d), when the value of some field is 'N/A', it will be omitted from the CLI output. In a particular case, if some cable channel RX/TX POWER is '0', it will not be in the output, hence confusing the user about whether the channel exists or not. Below is an example with QSFP-DD cable, it has 8 channels, but the tx/rx power raw data of 4 of them is 0, so it will not be displayed and will on see 4 channels tx/rx power in the CLI output:
So a better implementation is to interpret '0' as '-40 dB' according to the measurement range, and the CLI output will have all the channels displayed in the output:
Motivation and Context
To fix the display issue when RX/RX POWER raw data is '0'.
How Has This Been Tested?
check the 'show interface transceiver eeprom -d' output,
call the relevant platform API to check the result
run platform related regression test case
Additional Information (Optional)