Closed r12f closed 8 months ago
Please fix build errors
ok, the tests are passed now. :D @kcudnik , this change is now ready for review.
thanks Chris!
but in a way that's going backwards to making it "understand" dash code!
and yep, this is something I am working on right now for counters. Basically, to generate the counter attributes, we have to add unused parameters into table action parameters, which is really weird to understand. a more proper way is actually to parse the p4 bmv2 program and find the counter writes to build the relationship.
i am working on 2 PRs, one add SAICounter annotation to make the counter in use. another one to parse the P4 program and build the relationships. this will makes more sense than the heuristics we had, such as the naming patterns, or the number of fields that an action has and etc.
adding one example as reference:
#ifdef TARGET_BMV2_V1MODEL
counter(MAX_METER_BUCKETS, CounterType.bytes) meter_bucket_inbound;
counter(MAX_METER_BUCKETS, CounterType.bytes) meter_bucket_outbound;
#endif // TARGET_BMV2_V1MODEL
action meter_bucket_action(
@SaiVal[type="sai_uint64_t", isreadonly="true"] bit<64> outbound_bytes_counter,
@SaiVal[type="sai_uint64_t", isreadonly="true"] bit<64> inbound_bytes_counter,
@SaiVal[type="sai_uint32_t", skipattr="true"] bit<32> meter_bucket_index) {
// read only counters for SAI api generation only
meta.meter_bucket_index = meter_bucket_index;
}
Add type hints to make the code more maintainable since it will be even less likely to go wrong.
As previous refactoring changes, no updates on generated files: