Skip to content

Add stage to count packet processing results#1359

Open
Fredi-raspall wants to merge 6 commits intomainfrom
pr/fredi/pkt_stats
Open

Add stage to count packet processing results#1359
Fredi-raspall wants to merge 6 commits intomainfrom
pr/fredi/pkt_stats

Conversation

@Fredi-raspall
Copy link
Contributor

@Fredi-raspall Fredi-raspall commented Mar 19, 2026

  • Defines type PacketStats, which is a vector of atomicU64's indexed by DoneReason
  • Implements PacketStatsNF and adds it to the pipeline
  • Add cli command to show counts per DoneReason.
  • Redefine some DoneReasons for clarity
dataplane(✔)# show packet stats
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Packet stats ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    Packet result                  count
    Internal failure               0
    Interface: unknown             10
    Interface: detached            0
    Interface: admin down          0
    Interface: oper down           0
    Interface: unsupported         0
    Not Ethernet                   0
    Unhandled                      2
    Frame not for us               289
    Invalid dst MAC                0
    Missing ether type             0
    Filtered                       0
    IP:  packet is not IP          2
    IP:  missing routing info      0
    IP:  route drop                17
    IP:  TTL exceeded              0
    IP:  L2 resolution failure     0
    NAT: out of resources          0
    NAT: Unsupported protocol      0
    NAT: failure                   0
    NAT: not port-forwarded        0
    Malformed packet               0
    Unroutable                     0
    Invalid checksum               0
    Incomplete ICMP error          0
    Internal drop                  0
    Locally delivered              200
    Delivered                      311611

That was some early scratch work that we never used.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
@Fredi-raspall Fredi-raspall requested a review from a team as a code owner March 19, 2026 20:54
@Fredi-raspall Fredi-raspall requested review from daniel-noland and removed request for a team March 19, 2026 20:54
Implement PacketStats object to hold a table of counters per
DoneReason. The intent is to keep one such table per pipeline
to have some visibility about how packets are processed or dropped.

This commit also implements Display for DoneReason.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
This is a very simple NF that populates a shared PacketStats
object.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
- Use the strum crate to count the number of DoneReasons and keep
  thme in sync with the stats. This makes it easier to add new
  DoneReasons since the PacketStats will be automatically updated.
- Redefine DoneReasons to be more meaningful and reorder them for
  clarity.
- Adapt the dependant code to use the re-defined/new values.

Signed-off-by: Fredi Raspall <fredi@githedgehog.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant