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

@@ -228,6 +228,7 @@ void marsio_io_drop(struct marsio_io *handle, uint16_t thr_idx, struct packet *p
{
struct packet *pkt;
marsio_buff_t *mbuff;
struct io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
@@ -235,6 +236,8 @@ void marsio_io_drop(struct marsio_io *handle, uint16_t thr_idx, struct packet *p
mbuff = (marsio_buff_t *)packet_get_io_ctx(pkt);
if (mbuff)
{
stat->drop_pkts++;
stat->drop_bytes += packet_get_len(pkt);
marsio_buff_free(handle->mr_ins, &mbuff, 1, 0, thr_idx);
}
packet_free(pkt);