From 1e4e2fe5d7239da26edf89f554f929c10e0d5573 Mon Sep 17 00:00:00 2001 From: yangchen Date: Wed, 6 Mar 2024 18:25:19 +0800 Subject: [PATCH] support udp pkglen > mtu: modify netbuf_alloc size --- src/api/sockets.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/api/sockets.c b/src/api/sockets.c index 923518c..66f6e2c 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -1891,7 +1891,13 @@ lwip_sendto(int s, const void *data, size_t size, int flags, /* make the buffer point to the data that should be sent */ #if LWIP_NETIF_TX_SINGLE_PBUF /* Allocate a new netbuf and copy the data into it. */ +#if GAZELLE_ENABLE + /* In the gazelle scenario, only use buf.p->payload and buf.p->tot_len, and + buf.p->payload stores the sock pointer info. Don't need to alloc short_size */ + if (netbuf_alloc(&buf, 0) == NULL) { +#else if (netbuf_alloc(&buf, short_size) == NULL) { +#endif err = ERR_MEM; } else { #if LWIP_CHECKSUM_ON_COPY @@ -1905,6 +1911,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags, /* In the gazelle scenario, the payload is stored in send_ring, and the payload stores the sock pointer information. */ buf.p->payload = (void *)sock; + buf.p->tot_len = short_size; #else MEMCPY(buf.p->payload, data, short_size); #endif -- 2.33.0