加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
From 1e4e2fe5d7239da26edf89f554f929c10e0d5573 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化