Skip to content

Commit

Permalink
defrag: add defrag memcap stats counter
Browse files Browse the repository at this point in the history
  • Loading branch information
jufajardini committed Mar 30, 2023
1 parent 5e1dad7 commit b2b3306
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions etc/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4747,6 +4747,9 @@
"max_frag_hits": {
"type": "integer"
},
"memcap_exception_policy": {
"type": "integer"
},
"ipv4": {
"type": "object",
"properties": {
Expand Down
2 changes: 2 additions & 0 deletions src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,8 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
dtv->counter_defrag_ipv6_reassembled = StatsRegisterCounter("defrag.ipv6.reassembled", tv);
dtv->counter_defrag_max_hit =
StatsRegisterCounter("defrag.max_frag_hits", tv);
dtv->counter_defrag_memcap_exc_policy =
StatsRegisterCounter("defrag.memcap_exception_policy", tv);

for (int i = 0; i < DECODE_EVENT_MAX; i++) {
BUG_ON(i != (int)DEvents[i].code);
Expand Down
1 change: 1 addition & 0 deletions src/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ typedef struct DecodeThreadVars_
uint16_t counter_defrag_ipv6_fragments;
uint16_t counter_defrag_ipv6_reassembled;
uint16_t counter_defrag_max_hit;
uint16_t counter_defrag_memcap_exc_policy;

uint16_t counter_flow_memcap;
uint16_t counter_flow_memcap_exc_policy;
Expand Down
2 changes: 2 additions & 0 deletions src/defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,8 @@ Defrag(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
tracker = DefragGetTracker(tv, dtv, p);
if (tracker == NULL) {
StatsIncr(tv, dtv->counter_defrag_max_hit);
/* currently, whenever tracker is NULL, ExceptionPolicyApply has been called */
StatsIncr(tv, dtv->counter_defrag_memcap_exc_policy);
return NULL;
}

Expand Down

0 comments on commit b2b3306

Please sign in to comment.