Skip to content

Commit

Permalink
more counters.
Browse files Browse the repository at this point in the history
  • Loading branch information
r12f committed Jan 9, 2024
1 parent 9b82a70 commit 4b163ac
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "dash_ha.p4"
#include "underlay.p4"

#define MAX_ENI (64)
#define MAX_METER_BUCKETS_PER_ENI (4096)
#define MAX_METER_BUCKETS (MAX_ENI * MAX_METER_BUCKETS_PER_ENI)

control dash_ingress(
inout headers_t hdr
, inout metadata_t meta
Expand Down Expand Up @@ -108,6 +112,20 @@ control dash_ingress(
meta.stage4_dash_acl_group_id = ## prefix ##_stage4_dash_acl_group_id; \
meta.stage5_dash_acl_group_id = ## prefix ##_stage5_dash_acl_group_id;

counter(MAX_ENI, CounterType.both) eni_in;
counter(MAX_ENI, CounterType.both) eni_out;
@SaiCounter[action_names="set_eni_attrs"]
counter(MAX_ENI, CounterType.both) eni_in_discards;
@SaiCounter[action_names="set_eni_attrs"]
counter(MAX_ENI, CounterType.both) eni_out_discards;
@SaiCounter[action_names="set_eni_attrs"]
counter(MAX_ENI, CounterType.both) eni_in_error;
@SaiCounter[action_names="set_eni_attrs"]
counter(MAX_ENI, CounterType.both) eni_out_error;
@SaiCounter[action_names="set_eni_attrs"]
counter(MAX_ENI, CounterType.both) eni_in_oversize;
@SaiCounter[action_names="set_eni_attrs"]
counter(MAX_ENI, CounterType.both) eni_out_oversize;
action set_eni_attrs(bit<32> cps,
bit<32> pps,
bit<32> flows,
Expand Down Expand Up @@ -289,8 +307,6 @@ control dash_ingress(
const default_action = NoAction();
}

// MAX_METER_BUCKET = MAX_ENI(64) * NUM_BUCKETS_PER_ENI(4096)
#define MAX_METER_BUCKETS 262144
#ifdef TARGET_BMV2_V1MODEL
@SaiCounter[name="outbound_bytes_counter", action_names="meter_bucket_action", as_attr="true"]
counter(MAX_METER_BUCKETS, CounterType.bytes) meter_bucket_outbound;
Expand Down

0 comments on commit 4b163ac

Please sign in to comment.