From 73cb4117e235b0d27bb78e82042c36251dbfe557 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 13 Mar 2024 12:06:58 +0100 Subject: net: add net_alloc_packets helper We have a number of drivers that call net_alloc_packet in a loop and will gain some more in the quest to drop NetRxPackets. Let's provide a helper that can be used for this and a function to free the packets as well. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20240313110704.1095554-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- include/net.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/net.h b/include/net.h index ffc1093ae6..38fd6f8d3c 100644 --- a/include/net.h +++ b/include/net.h @@ -551,6 +551,14 @@ static inline char *net_alloc_packet(void) return dma_alloc(PKTSIZE); } +static inline void net_free_packet(char *pkt) +{ + return dma_free(pkt); +} + +int net_alloc_packets(void **packets, int count); +void net_free_packets(void **packets, unsigned count); + struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport, rx_handler_f *handler, void *ctx); -- cgit v1.2.3