Skip to content

Commit

Permalink
defrag: clean up existing stats counters
Browse files Browse the repository at this point in the history
7a044a9 removed the lines that incremented these defrag
counters, but kept the entities themselves. This commit removes counters
that we judge too complex to maintain, given the current state of the
code, and re-adds incrementing max_hit (memcap related).

Related to
Task OISF#5816
  • Loading branch information
jufajardini authored and victorjulien committed Jun 13, 2023
1 parent 0541740 commit a37a88d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
10 changes: 2 additions & 8 deletions src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,16 +591,10 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)

dtv->counter_defrag_ipv4_fragments =
StatsRegisterCounter("defrag.ipv4.fragments", tv);
dtv->counter_defrag_ipv4_reassembled =
StatsRegisterCounter("defrag.ipv4.reassembled", tv);
dtv->counter_defrag_ipv4_timeouts =
StatsRegisterCounter("defrag.ipv4.timeouts", tv);
dtv->counter_defrag_ipv4_reassembled = StatsRegisterCounter("defrag.ipv4.reassembled", tv);
dtv->counter_defrag_ipv6_fragments =
StatsRegisterCounter("defrag.ipv6.fragments", tv);
dtv->counter_defrag_ipv6_reassembled =
StatsRegisterCounter("defrag.ipv6.reassembled", tv);
dtv->counter_defrag_ipv6_timeouts =
StatsRegisterCounter("defrag.ipv6.timeouts", tv);
dtv->counter_defrag_ipv6_reassembled = StatsRegisterCounter("defrag.ipv6.reassembled", tv);
dtv->counter_defrag_max_hit =
StatsRegisterCounter("defrag.max_frag_hits", tv);

Expand Down
2 changes: 0 additions & 2 deletions src/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,8 @@ typedef struct DecodeThreadVars_
/** frag stats - defrag runs in the context of the decoder. */
uint16_t counter_defrag_ipv4_fragments;
uint16_t counter_defrag_ipv4_reassembled;
uint16_t counter_defrag_ipv4_timeouts;
uint16_t counter_defrag_ipv6_fragments;
uint16_t counter_defrag_ipv6_reassembled;
uint16_t counter_defrag_ipv6_timeouts;
uint16_t counter_defrag_max_hit;

uint16_t counter_flow_memcap;
Expand Down
6 changes: 5 additions & 1 deletion src/defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,12 @@ Defrag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)

/* return a locked tracker or NULL */
tracker = DefragGetTracker(tv, dtv, p);
if (tracker == NULL)
if (tracker == NULL) {
if (tv != NULL && dtv != NULL) {
StatsIncr(tv, dtv->counter_defrag_max_hit);
}
return NULL;
}

Packet *rp = DefragInsertFrag(tv, dtv, tracker, p);
DefragTrackerRelease(tracker);
Expand Down

0 comments on commit a37a88d

Please sign in to comment.