Add packet utils to packet.h
This commit is contained in:
@@ -171,8 +171,16 @@ int marsio_io_ingress(struct marsio_io *handle, uint16_t thr_idx, struct packet
|
||||
continue;
|
||||
}
|
||||
|
||||
pkt = &pkts[nr_parsed];
|
||||
memset(pkt, 0, sizeof(struct packet));
|
||||
packet_parse(pkt, data, len);
|
||||
packet_set_io_ctx(pkt, mbuff);
|
||||
packet_set_origin(pkt, PACKET_ORIGIN_MARSIO);
|
||||
nr_parsed++;
|
||||
|
||||
if (marsio_buff_is_ctrlbuf(mbuff))
|
||||
{
|
||||
packet_set_ctrl(pkt);
|
||||
ATOMIC_ADD(&handle->stat.ctrl_rx_pkts, 1);
|
||||
ATOMIC_ADD(&handle->stat.ctrl_rx_bytes, len);
|
||||
}
|
||||
@@ -181,12 +189,6 @@ int marsio_io_ingress(struct marsio_io *handle, uint16_t thr_idx, struct packet
|
||||
ATOMIC_ADD(&handle->stat.raw_rx_pkts, 1);
|
||||
ATOMIC_ADD(&handle->stat.raw_rx_bytes, len);
|
||||
}
|
||||
|
||||
pkt = &pkts[nr_parsed];
|
||||
packet_parse(pkt, data, len);
|
||||
packet_set_io_ctx(pkt, mbuff);
|
||||
packet_set_action(pkt, PACKET_ACTION_FORWARD);
|
||||
nr_parsed++;
|
||||
}
|
||||
|
||||
return nr_parsed;
|
||||
|
||||
Reference in New Issue
Block a user