From 8500d8d2d88dd3f6e7180796cf93cdb88758b3b3 Mon Sep 17 00:00:00 2001 From: jiangheng Date: Mon, 13 Mar 2023 10:23:35 +0800 Subject: [PATCH] add pbuf lock when aggregate pbuf (cherry picked from commit 528622f5ffa530b2b80ae3ea80f777d96b2d71cb) --- 0054-add-pbuf-lock-when-aggregate-pbuf.patch | 45 ++++++++++++++++++++ lwip.spec | 7 ++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0054-add-pbuf-lock-when-aggregate-pbuf.patch diff --git a/0054-add-pbuf-lock-when-aggregate-pbuf.patch b/0054-add-pbuf-lock-when-aggregate-pbuf.patch new file mode 100644 index 0000000..938ac45 --- /dev/null +++ b/0054-add-pbuf-lock-when-aggregate-pbuf.patch @@ -0,0 +1,45 @@ +From a9906aabda21b9d2912377352ef0058eb4fb76e0 Mon Sep 17 00:00:00 2001 +From: jiangheng +Date: Mon, 13 Mar 2023 10:00:12 +0800 +Subject: [PATCH] add pbuf lock when aggregate pbuf + +--- + src/include/lwip/pbuf.h | 3 ++- + src/include/lwipsock.h | 3 +-- + 2 files changed, 3 insertions(+), 3 deletions(-) +diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h +index 4f5c8ef..50d88af 100644 +--- a/src/include/lwip/pbuf.h ++++ b/src/include/lwip/pbuf.h +@@ -230,9 +230,10 @@ struct pbuf { + u64_t l4_len:8; + u8_t header_off; + u8_t rexmit; +- u8_t in_write; ++ volatile u8_t allow_in; + u8_t head; + struct pbuf *last; ++ pthread_spinlock_t pbuf_lock; + #endif /* GAZELLE_ENABLE CHECKSUM_OFFLOAD_SWITCH */ + }; + +diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h +index 399b701..affb598 100644 +--- a/src/include/lwipsock.h ++++ b/src/include/lwipsock.h +@@ -105,11 +105,10 @@ struct lwip_sock { + + char pad1 __rte_cache_aligned; + /* app and stack thread all use */ +- uint32_t in_send; /* avoid sock too much send rpc msg*/ ++ uint32_t call_num; /* avoid sock too much send rpc msg*/ + char pad2 __rte_cache_aligned; + /* stack thread all use */ + struct list_node recv_list; +- struct list_node send_list; + struct pbuf *send_lastdata; + struct pbuf *send_pre_del; + sem_t snd_ring_sem; +-- +2.29.0.windows.1 + diff --git a/lwip.spec b/lwip.spec index 771619f..4731e01 100644 --- a/lwip.spec +++ b/lwip.spec @@ -4,7 +4,7 @@ Summary: lwip is a small independent implementation of the TCP/IP protocol suite Name: lwip Version: 2.1.2 -Release: 33 +Release: 34 License: BSD URL: http://savannah.nongnu.org/projects/lwip/ Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip @@ -66,6 +66,7 @@ Patch9049: 0050-lwip-add-need_tso_send.patch Patch9050: 0051-lwip_fnctl-only-support-F_SETFL-F_GETFL.patch Patch9051: 0052-cleancode-improve-lwipopts.h-readability.patch Patch9052: 0053-reduce-cpu-usage-when-send.patch +Patch9053: 0054-add-pbuf-lock-when-aggregate-pbuf.patch BuildRequires: gcc-c++ dos2unix dpdk-devel @@ -136,6 +137,7 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \; %patch9050 -p1 %patch9051 -p1 %patch9052 -p1 +%patch9053 -p1 %build cd %{_builddir}/%{name}-%{version}/src @@ -151,6 +153,9 @@ cd %{_builddir}/%{name}-%{version}/src %{_libdir}/liblwip.a %changelog +* Mon Mar 13 2023 jiangheng - 2.1.2-34 +- add pbuf lock when aggregate pbuf + * Fri Mar 10 2023 jiangheng - 2.1.2-33 - reduce cpu usage when send