diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-03-13 12:06:58 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-13 12:38:55 +0100 |
commit | 73cb4117e235b0d27bb78e82042c36251dbfe557 (patch) | |
tree | 6bdebf132aefb9673937c5ec3d44e17d4e8bfd52 /include | |
parent | 50cbfd91b5737dedc6d1713f0cbacb67c1a604b1 (diff) | |
download | barebox-73cb4117e235b0d27bb78e82042c36251dbfe557.tar.gz barebox-73cb4117e235b0d27bb78e82042c36251dbfe557.tar.xz |
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 <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240313110704.1095554-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/net.h | 8 |
1 files changed, 8 insertions, 0 deletions
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); |