packet IO support inject packet and add inject packet stat

This commit is contained in:
luwenpeng
2024-04-25 15:34:46 +08:00
parent 476c5bac56
commit 54a78389cf
6 changed files with 85 additions and 0 deletions

View File

@@ -274,6 +274,32 @@ void dumpfile_io_drop(struct dumpfile_io *handle, uint16_t thr_idx, struct packe
}
}
int dumpfile_io_inject(struct dumpfile_io *handle, uint16_t thr_idx, struct packet *pkts, int nr_pkts)
{
int len;
struct packet *pkt = NULL;
struct io_stat *stat = &handle->stat[thr_idx];
for (int i = 0; i < nr_pkts; i++)
{
pkt = &pkts[i];
len = packet_get_len(pkt);
stat->inject_pkts++;
stat->inject_bytes += len;
stat->raw_tx_pkts++;
stat->raw_tx_bytes += len;
stat->dev_tx_pkts++;
stat->dev_tx_bytes += len;
packet_free(pkt);
}
return nr_pkts;
}
void dumpfile_io_yield(struct dumpfile_io *handle, uint16_t thr_idx, uint64_t timeout_ms)
{
return;