Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sai-gen] Add support for generating SAI stats APIs for counters. #514

Merged
merged 6 commits into from
Feb 13, 2024

Conversation

r12f
Copy link
Collaborator

@r12f r12f commented Feb 11, 2024

Problem

DASH has scaling requirement that requires technology providers to support huge number of objects, e.g. 8M of CA-PA mappings. If we need to add counters for these objects by using generic SAI counters, we will generate large number of counter ids, which might not be ideal.

Also some counters we are collecting are not data path counters, but more like hit counts, which is not what generic SAI counter is modeling.

For these cases, we can support generating the counters as SAI stats and leverage existing SAI stats API design for querying the counters back.

What we are doing in this change

This change updated sai_api_gen.py with 2 changes:

  1. Rename as_attr to attr_type for supporting more types of counter generation.
  2. Updated the counter generation logic and its templates for generating SAI stats APIs.

This feature will be used in the incoming fast path API generations.

Take metering bucket as an example to illustrate this change, say we updated its counters to capture both packet and bytes, change its type to stats, then add another counter for tracking all traffic, not on metering bucket level:
image

This will results in the both metering bucket counter being generated as stats enum:
image

Once an table as any stats enum, we will generate the stats APIs:
image
image

On port level, it will generate the overall counters:
image

However, we are not generating a working libsai at this moment, which is the same as the counters today. This work will be postponed to later time.
image

image

@r12f
Copy link
Collaborator Author

r12f commented Feb 13, 2024

Here is the preview of the fast path SAI API change that built on top of this feature (for header generation only):

@r12f
Copy link
Collaborator Author

r12f commented Feb 13, 2024

thanks for the review, Marian! will get this merged and sharing the fast path SAI update out.

@r12f r12f merged commit 1d5f8ce into sonic-net:main Feb 13, 2024
5 checks passed
@r12f r12f deleted the user/r12f/stats-gen branch February 13, 2024 20:59
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