Skip to Content.

rare-dev - Re: [rare-dev] SNMP sub-interface counter logic in bf_forwarder

Subject: Rare project developers

List archive


Re: [rare-dev] SNMP sub-interface counter logic in bf_forwarder


Chronological Thread 
  • From: Frédéric LOUI <>
  • To: Alexander Gall <>
  • Cc:
  • Subject: Re: [rare-dev] SNMP sub-interface counter logic in bf_forwarder
  • Date: Wed, 23 Feb 2022 17:12:06 +0100
  • Dkim-filter: OpenDKIM Filter v2.10.3 zmtaauth02.partage.renater.fr 08D70A00B4

Hi Alex,

This is the first counter we implemented and if you pay attention this is the
only counter linked to an ingress/egress control
When we tested it we mc36, IIRC we observed that traffic
(stats_pkt_out["$COUNTER_SPEC_PKTS"]) was counted twice.
(Not sure if it has an incidence but at that time there was no egress
control.)

> I guess there is similar logic for the counters reported to
> freerouter. How is this case handled there?
Well, the other counters are a bit different as they are linked to a table.
Such as this one:
https://bitbucket.software.geant.org/projects/RARE/repos/rare/browse/p4src/include/ig_ctl_nat.p4#106

@mc36, do you remember the exact reason why we did this ?

Also maybe this is the right moment to harmonise counters and just use
counter with table and not control ?

> Le 23 févr. 2022 à 16:34, Alexander Gall <> a écrit :
>
> Hello Frederic
>
> I'm trying to understand the logic of this code:
>
> self.subif_counters.update(
> {
> counter_id: [
> stats_in["$COUNTER_SPEC_PKTS"]
> - stats_pkt_out["$COUNTER_SPEC_PKTS"],
> stats_in["$COUNTER_SPEC_BYTES"]
> - stats_pkt_out["$COUNTER_SPEC_BYTES"],
> stats_out["$COUNTER_SPEC_PKTS"]
> + stats_pkt_out["$COUNTER_SPEC_PKTS"],
> stats_out["$COUNTER_SPEC_BYTES"]
> + stats_pkt_out["$COUNTER_SPEC_BYTES"],
> ]
> }
> )
>
> stats_{in,out} are the counters from ig_ctl_vlan_in and
> eg_ctl_vlan_out and stats_pkt_out is the counter for packets coming in
> from the CPU port. Those packets are sent directly to their egress
> port without passing through eg_ctl_vlan_out, i.e. they will not be
> accounted for in stats_out. This is corrected for by adding
> stats_pkt_out to stats_out, so I understand that part.
>
> However, I don't understand why we should subtract those packets from
> stats_in since they were never counted there in the first place.
>
> I'm asking you because I believe that the sub-interface code was
> written by you and maybe you had a reason for it that I'm not seeing
> :)
>
> I guess there is similar logic for the counters reported to
> freerouter. How is this case handled there?
>
> --
> Alex




Archive powered by MHonArc 2.6.19.

Top of Page