| #include "include/defines.p4" |
| #include "include/headers.p4" |
| #include "include/parser.p4" |
| #include "include/actions.p4" |
| #include "include/port_counters.p4" |
| header_type ecmp_metadata_t { |
| groupSize : 32; // Not used. Workaround to avoid p4c complaining about inferring type to groupSize. |
| metadata ecmp_metadata_t ecmp_metadata; |
| field_list ecmp_hash_fields { |
| field_list_calculation ecmp_hash { |
| action ecmp_group(groupId, groupSize) { |
| modify_field(ecmp_metadata.groupId, groupId); |
| modify_field(ecmp_metadata.groupSize, groupSize); |
| modify_field_with_hash_based_offset(ecmp_metadata.selector, 0, ecmp_hash, groupSize); |
| standard_metadata.ingress_port : ternary; |
| ethernet.dstAddr : ternary; |
| ethernet.srcAddr : ternary; |
| ethernet.etherType : ternary; |
| ecmp_metadata.groupId : exact; |
| ecmp_metadata.selector : exact; |
| counter ecmp_group_table_counter { |
| direct: ecmp_group_table; |