Add stat of inject packet and drop packet

This commit is contained in:
luwenpeng
2024-04-30 15:25:34 +08:00
parent 611fda598f
commit e418c84b85
4 changed files with 37 additions and 0 deletions

View File

@@ -262,12 +262,16 @@ void dumpfile_io_egress(struct dumpfile_io *handle, uint16_t thr_idx, struct pac
void dumpfile_io_drop(struct dumpfile_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts)
{
struct packet *pkt = NULL;
struct io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
pkt = &pkts[i];
struct pcap_pkt *pcap_pkt = (struct pcap_pkt *)packet_get_io_ctx(pkt);
if (pcap_pkt)
{
stat->drop_pkts++;
stat->drop_bytes += packet_get_len(pkt);
free(pcap_pkt);
}
packet_free(pkt);