From 59f9b2491899ddfae481c496bb0d947a9c1d72f2 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 29 May 2023 21:40:42 +0300 Subject: speed up packet allocation by switching to malloc + Also allow reusing packets, though only with external buffers. --- include/gran/packet.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/gran/packet.h b/include/gran/packet.h index 5c241be..25275f9 100644 --- a/include/gran/packet.h +++ b/include/gran/packet.h @@ -24,9 +24,13 @@ struct packet; struct packet *create_packet(enum packet_type type, uintptr_t addr, size_t size); + struct packet *create_packet_with(enum packet_type type, uintptr_t addr, size_t size, void *data); +struct packet *reuse_packet(struct packet *pkt, enum packet_type type, + uintptr_t addr, size_t size, void *data); + enum packet_type packet_type(struct packet *pkt); enum packet_state packet_state(struct packet *pkt); void packet_set_state(struct packet *pkt, enum packet_state state); -- cgit v1.3