From: Adrian Mamolea (admamole) Date: Thu, 28 Sep 2023 08:58:28 +0000 (+0000) Subject: Pull request #4011: packet_io: fix daq stats X-Git-Tag: 3.1.72.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f435941312b945f28aa5be6e711645ab9157fbe5;p=thirdparty%2Fsnort3.git Pull request #4011: packet_io: fix daq stats Merge in SNORT/snort3 from ~ADMAMOLE/snort3:kern to master Squashed commit of the following: commit 0ef7d59ebe19f9c93e39296bcf6dd7d540596971 Author: Adrian Mamolea Date: Tue Sep 19 17:52:12 2023 -0400 packet_io: fix daq stats --- diff --git a/src/packet_io/sfdaq_module.cc b/src/packet_io/sfdaq_module.cc index c0399e1fa..39fb65939 100644 --- a/src/packet_io/sfdaq_module.cc +++ b/src/packet_io/sfdaq_module.cc @@ -178,7 +178,8 @@ const PegInfo daq_names[] = { CountType::SUM, "analyzed", "total packets analyzed from DAQ" }, { CountType::SUM, "dropped", "packets dropped" }, { CountType::SUM, "filtered", "packets filtered out" }, - { CountType::SUM, "outstanding", "packets unprocessed" }, + { CountType::NOW, "outstanding", "packets unprocessed" }, + { CountType::MAX, "outstanding_max", "maximum of packets unprocessed" }, { CountType::SUM, "injected", "active responses or replacements" }, // Must align with MAX_DAQ_VERDICT (one for each, in order) @@ -258,16 +259,11 @@ void SFDAQModule::prep_counts(bool dump_stats) for ( unsigned i = 0; i < MAX_DAQ_VERDICT; i++ ) daq_stats.verdicts[i] = daq_stats_delta.verdicts[i]; - // If DAQ returns HW packets counter less than SW packets counter, - // Snort treats that as no outstanding packets left. - if (daq_stats_delta.hw_packets_received > - (daq_stats_delta.packets_filtered + daq_stats_delta.packets_received)) - { - daq_stats.outstanding = daq_stats_delta.hw_packets_received - - daq_stats_delta.packets_filtered - daq_stats_delta.packets_received; - } - else - daq_stats.outstanding = 0; + daq_stats.outstanding = new_daq_stats.hw_packets_received - + new_daq_stats.packets_filtered - new_daq_stats.packets_received; + + if ( daq_stats.outstanding > daq_stats.outstanding_max ) + daq_stats.outstanding_max = daq_stats.outstanding; if(!dump_stats) prev_daq_stats = new_daq_stats; diff --git a/src/packet_io/sfdaq_module.h b/src/packet_io/sfdaq_module.h index 770d54696..678080aed 100644 --- a/src/packet_io/sfdaq_module.h +++ b/src/packet_io/sfdaq_module.h @@ -63,6 +63,7 @@ struct DAQStats PegCount dropped; PegCount filtered; PegCount outstanding; + PegCount outstanding_max; PegCount injected; PegCount verdicts[MAX_DAQ_VERDICT]; PegCount internal_blacklist;