1 ; SPDX-License-Identifier: BSD-3-Clause
2 ; Copyright(c) 2021 Intel Corporation
4 ; This program is setting up two register arrays called "pkt_counters" and "byte_counters".
5 ; On every input packet (Ethernet/IPv4), the "pkt_counters" register at location indexed by
6 ; the IPv4 header "Source Address" field is incremented, while the same location in the
7 ; "byte_counters" array accummulates the value of the IPv4 header "Total Length" field.
9 ; The "regrd" and "regwr" CLI commands can be used to read and write the current value of
10 ; any register array location.
25 bit<16> identification
34 header ethernet instanceof ethernet_h
35 header ipv4 instanceof ipv4_h
45 metadata instanceof metadata_t
50 regarray pkt_counters size 65536 initval 0
51 regarray byte_counters size 65536 initval 0
60 regadd pkt_counters h.ipv4.src_addr 1
61 regadd byte_counters h.ipv4.src_addr h.ipv4.total_len
62 mov m.port_out m.port_in