Skip to content

SAI Switch Temperature Attributes for Sub-degree Precision#2306

Open
bp899348 wants to merge 1 commit into
opencomputeproject:masterfrom
bp899348:patch-2
Open

SAI Switch Temperature Attributes for Sub-degree Precision#2306
bp899348 wants to merge 1 commit into
opencomputeproject:masterfrom
bp899348:patch-2

Conversation

@bp899348

Copy link
Copy Markdown

SAI Switch Temperature Attributes for Sub-degree Precision

SAI_SWITCH_ATTR_TEMP_LIST returns temperature values rounded to whole degrees Celsius. This discards sub-degree precision that is available from the hardware, making it unsuitable for applications that require finer thermal granularity.

SAI Switch Temperature Attributes for Sub-degree Precision

`SAI_SWITCH_ATTR_TEMP_LIST` returns temperature values rounded to whole degrees
Celsius. This discards sub-degree precision that is available from the hardware,
making it unsuitable for applications that require finer thermal granularity.

Signed-off-by: Barmesh Pandey <barmeshwar.pandey@broadcom.com>
Comment thread inc/saiswitch.h
*
* @type sai_s32_list_t
* @flags READ_ONLY
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The commit added a new tag @precision. You can define the precision in SAI_SWITCH_ATTR_TEMP_LIST_RAW and no need SAI_SWITCH_ATTR_TEMP_BASE_TEN_PRECISION. You can get the precision from the meta data attr->valuePrecision.
See the examples in https://github.com/opencomputeproject/SAI/blob/master/experimental/saiexperimentalotnoa.h

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you for the suggestion. The @precision tag is a compile-time constant in the metadata — it is hardcoded at attribute definition time and cannot change at runtime.

In our case, the temperature resolution is hardware and platform dependent and must be queried at runtime. SAI_SWITCH_ATTR_TEMP_BASE_TEN_PRECISION is a READ_ONLY attribute that the driver reports dynamically, allowing consumers to adapt without any code or metadata change as platforms evolve.

So yes, @precision would still be hardcoded — just in a different place.

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