packet IO support inject packet and add inject packet stat
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user