!28 [sync] PR-27: 适配gazelle减少发送拷贝报文

From: @openeuler-sync-bot 
Reviewed-by: @LemmyHuang 
Signed-off-by: @LemmyHuang
This commit is contained in:
openeuler-ci-bot 2022-03-08 03:17:46 +00:00 committed by Gitee
commit f523d26e67
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 56 additions and 21 deletions

View File

@ -0,0 +1,50 @@
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

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.1.3
Release: 5
Release: 6
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.tar.gz
@ -27,6 +27,7 @@ Patch9014: 0015-fix-tcp-port-alloc-issue.patch
Patch9015: 0016-lstack-support-mysql-mode.patch
Patch9016: 0017-support-REUSEPOR-option.patch
Patch9017: 0018-exec-gazelle_init_sock-before-read-event.patch
Patch9018: 0019-gazelle-reduce-copy-in-send.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
@ -38,28 +39,9 @@ ExclusiveArch: x86_64 aarch64
lwip is a small independent implementation of the TCP/IP protocol suite.
%prep
%setup -n %{name}-%{version} -q
%autosetup -n %{name}-%{version} -p1
find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \;
%patch9000 -p1
%patch9001 -p1
%patch9002 -p1
%patch9003 -p1
%patch9004 -p1
%patch9005 -p1
%patch9006 -p1
%patch9007 -p1
%patch9008 -p1
%patch9009 -p1
%patch9010 -p1
%patch9011 -p1
%patch9012 -p1
%patch9013 -p1
%patch9014 -p1
%patch9015 -p1
%patch9016 -p1
%patch9017 -p1
%build
cd %{_builddir}/%{name}-%{version}/src
%make_build
@ -74,6 +56,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Mon Mar 07 2022 wu-changsheng<wuchangsheng2@huawei.com> - 2.1.3-6
- gazelle reduce copy in send
* Mon Mar 07 2022 jiangheng<jiangheng12@huawei.com> - 2.1.3-5
- exec gazelle_sock_init before read event