1 Star 0 Fork 48

zerich/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0019-gazelle-reduce-copy-in-send.patch 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
吴昌盛 提交于 2022-03-07 21:15 . gazelle reduce copy in send
From 05bfdb54fc744d835c8b3b50b54d220fe7e87277 Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Mon, 7 Mar 2022 21:10:06 +0800
Subject: [PATCH] reduce copy in send
---
src/core/pbuf.c | 5 +++++
src/include/lwip/pbuf.h | 3 +++
2 files changed, 8 insertions(+)
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index 27afc28..cd6b558 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -281,6 +281,10 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
}
/* If pbuf is to be allocated in RAM, allocate memory for it. */
+#if USE_LIBOS
+ /* alloc mbuf to reduce copy in sending */
+ p = lwip_alloc_pbuf(layer, length, type);
+#else
p = (struct pbuf *)mem_malloc(alloc_len);
if (p == NULL) {
return NULL;
@@ -289,6 +293,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
length, length, type, 0);
LWIP_ASSERT("pbuf_alloc: pbuf->payload properly aligned",
((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0);
+#endif
break;
}
default:
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index e5daf96..3894574 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -272,6 +272,9 @@ void pbuf_free_ooseq(void);
/* Initializes the pbuf module. This call is empty for now, but may not be in future. */
#define pbuf_init()
+#if USE_LIBOS
+struct pbuf *lwip_alloc_pbuf(pbuf_layer l, u16_t length, pbuf_type type);
+#endif
struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type);
struct pbuf *pbuf_alloc_reference(void *payload, u16_t length, pbuf_type type);
#if LWIP_SUPPORT_CUSTOM_PBUF
--
2.30.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zerich/lwip.git
git@gitee.com:zerich/lwip.git
zerich
lwip
lwip
master

搜索帮助