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:
Rename as_attr to attr_type for supporting more types of counter generation.
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:
This will results in the both metering bucket counter being generated as stats enum:
Once an table as any stats enum, we will generate the stats APIs:
On port level, it will generate the overall counters:
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.
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:
as_attr
toattr_type
for supporting more types of counter generation.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](https://github.com/sonic-net/DASH/assets/1533278/411b48b6-9187-4975-ae13-434422ed5a96)
This will results in the both metering bucket counter being generated as stats enum:![image](https://github.com/sonic-net/DASH/assets/1533278/b212da2d-8265-4179-a547-a7f86a58a24a)
Once an table as any stats enum, we will generate the stats APIs:
![image](https://github.com/sonic-net/DASH/assets/1533278/4fecdf6a-cb5c-44ef-8247-1055b72786b0)
On port level, it will generate the overall counters:![image](https://github.com/sonic-net/DASH/assets/1533278/2c7fa2da-a36c-44b2-810b-7c2dcbca7d51)
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](https://github.com/sonic-net/DASH/assets/1533278/cefc02fe-a60f-4c90-a417-f12388f88744)