add self-developed patches

This commit is contained in:
jinag12 2024-01-12 02:37:17 +00:00 committed by jiangheng
parent 2f47ec2a85
commit ea65d9df08
12 changed files with 2420 additions and 1 deletions

View File

@ -0,0 +1,81 @@
From a235fee1e21ff103b1fbb24f23f23035c793bab0 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 16:10:57 +0800
Subject: [PATCH] add securec compile option and fPIC option
---
app/meson.build | 2 ++
buildtools/chkincs/meson.build | 2 ++
drivers/meson.build | 2 ++
examples/meson.build | 2 ++
lib/meson.build | 2 ++
5 files changed, 10 insertions(+)
diff --git a/app/meson.build b/app/meson.build
index 8aaed59..e22bbb2 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -43,6 +43,8 @@ if get_option('tests')
endif
default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall']
+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines']
default_ldflags = []
if get_option('default_library') == 'static' and not is_windows
default_ldflags += ['-Wl,--export-dynamic']
diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
index f2dadca..98dae23 100644
--- a/buildtools/chkincs/meson.build
+++ b/buildtools/chkincs/meson.build
@@ -14,6 +14,8 @@ gen_c_files = generator(gen_c_file_for_header,
cflags = machine_args
cflags += '-DALLOW_EXPERIMENTAL_API'
cflags += '-DALLOW_INTERNAL_API'
+cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall']
+cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines']
sources = files('main.c')
sources += gen_c_files.process(dpdk_chkinc_headers)
diff --git a/drivers/meson.build b/drivers/meson.build
index 5ba5340..1891192 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -57,6 +57,8 @@ enable_drivers += always_enable
default_cflags = machine_args
default_cflags += ['-DALLOW_EXPERIMENTAL_API']
default_cflags += ['-DALLOW_INTERNAL_API']
+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall']
+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines']
if cc.has_argument('-Wno-format-truncation')
default_cflags += '-Wno-format-truncation'
diff --git a/examples/meson.build b/examples/meson.build
index 8e8968a..51c975d 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -86,6 +86,8 @@ default_ldflags = dpdk_extra_ldflags
if get_option('default_library') == 'static' and not is_windows
default_ldflags += ['-Wl,--export-dynamic']
endif
+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall']
+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines']
foreach example: examples
name = example.split('/')[-1]
diff --git a/lib/meson.build b/lib/meson.build
index 6c143ce..65cc38a 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -143,6 +143,8 @@ enable_libs += always_enable
default_cflags = machine_args
default_cflags += ['-DALLOW_EXPERIMENTAL_API']
default_cflags += ['-DALLOW_INTERNAL_API']
+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall']
+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines']
if cc.has_argument('-Wno-format-truncation')
default_cflags += '-Wno-format-truncation'
--
2.33.0

View File

@ -0,0 +1,72 @@
From cf3c7fd3f5898d515899841eadfe86a154c0268b Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 16:14:16 +0800
Subject: [PATCH] dpdk-bugfix-the-deadlock-in-rte_eal_init
---
lib/eal/linux/eal.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 57da058..28226fc 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1126,7 +1126,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_init_alert("Cannot get hugepage information.");
rte_errno = EACCES;
rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed);
- return -1;
+ goto out;
}
}
@@ -1151,7 +1151,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_init_alert("Cannot init logging.");
rte_errno = ENOMEM;
rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed);
- return -1;
+ goto out;
}
#ifdef VFIO_PRESENT
@@ -1159,7 +1159,7 @@ rte_eal_init(int argc, char **argv)
rte_eal_init_alert("Cannot init VFIO");
rte_errno = EAGAIN;
rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed);
- return -1;
+ goto out;
}
#endif
/* in secondary processes, memory init may allocate additional fbarrays
@@ -1169,7 +1169,7 @@ rte_eal_init(int argc, char **argv)
if (rte_eal_memzone_init() < 0) {
rte_eal_init_alert("Cannot init memzone");
rte_errno = ENODEV;
- return -1;
+ goto out;
}
rte_mcfg_mem_read_lock();
@@ -1178,7 +1178,7 @@ rte_eal_init(int argc, char **argv)
rte_mcfg_mem_read_unlock();
rte_eal_init_alert("Cannot init memory");
rte_errno = ENOMEM;
- return -1;
+ goto out;
}
/* the directories are locked during eal_hugepage_info_init */
@@ -1323,6 +1323,10 @@ rte_eal_init(int argc, char **argv)
eal_mcfg_complete();
return fctret;
+
+out:
+ eal_hugedirs_unlock();
+ return -1;
}
static int
--
2.33.0

View File

@ -0,0 +1,27 @@
From 3a2d7e1b625dfda565ce27a667a68242e259b82f Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 16:17:14 +0800
Subject: [PATCH] 0004-dpdk-master-core-donot-set-affinity-in-libstorage
---
lib/eal/linux/eal.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 28226fc..769c6d0 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1219,7 +1219,9 @@ rte_eal_init(int argc, char **argv)
eal_check_mem_on_local_socket();
- if (rte_thread_set_affinity_by_id(rte_thread_self(),
+ /* Master thread don't set affinity in LibStorage application */
+ if (strstr(program_invocation_short_name, "LibStorage") == NULL &&
+ rte_thread_set_affinity_by_id(rte_thread_self(),
&lcore_config[config->main_lcore].cpuset) != 0) {
rte_eal_init_alert("Cannot set affinity");
rte_errno = EINVAL;
--
2.33.0

View File

@ -0,0 +1,25 @@
From 89eeedc121c4ea470100ecae9f9489840775a524 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 16:17:48 +0800
Subject: [PATCH] 0005-dpdk-change-the-log-level-in-prepare_numa.patch
---
lib/eal/linux/eal_memalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index 9853ec7..21c5729 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -159,7 +159,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id)
RTE_LOG(DEBUG, EAL, "Trying to obtain current memory policy.\n");
if (get_mempolicy(oldpolicy, oldmask->maskp,
oldmask->size + 1, 0, 0) < 0) {
- RTE_LOG(ERR, EAL,
+ RTE_LOG(DEBUG, EAL,
"Failed to get current mempolicy: %s. "
"Assuming MPOL_DEFAULT.\n", strerror(errno));
*oldpolicy = MPOL_DEFAULT;
--
2.33.0

View File

@ -0,0 +1,34 @@
From 52227243949f372edd9efd82ad03250e67bdcc0d Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 16:19:06 +0800
Subject: [PATCH] 0006-dpdk-fix-dpdk-coredump-problem.patch
---
lib/eal/linux/eal_interrupts.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index d4919df..e681628 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -1129,7 +1129,7 @@ eal_intr_thread_main(__rte_unused void *arg)
*/
if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
&pipe_event) < 0) {
- rte_panic("Error adding fd to %d epoll_ctl, %s\n",
+ RTE_LOG(ERR, EAL, "Error adding fd to %d epoll_ctl, %s\n",
intr_pipe.readfd, strerror(errno));
}
numfds++;
@@ -1151,7 +1151,7 @@ eal_intr_thread_main(__rte_unused void *arg)
*/
if (epoll_ctl(pfd, EPOLL_CTL_ADD,
rte_intr_fd_get(src->intr_handle), &ev) < 0) {
- rte_panic("Error adding fd %d epoll_ctl, %s\n",
+ RTE_LOG(ERR, EAL, "Error adding fd %d epoll_ctl, %s\n",
rte_intr_fd_get(src->intr_handle),
strerror(errno));
}
--
2.33.0

View File

@ -0,0 +1,27 @@
From 1ec3f2020f652b39e3ad1e39bed71cc4855ec636 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 16:28:06 +0800
Subject: [PATCH] 0007-dpdk-fix-cpu-flag-error-in-Intel-R-Xeon-R-CPU-E5-262
---
config/meson.build | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/config/meson.build b/config/meson.build
index a9ccd56..6ae32ec 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -154,6 +154,10 @@ if cpu_instruction_set == 'generic'
elif host_machine.cpu_family().startswith('riscv')
cpu_instruction_set = 'rv64gc'
endif
+elif host_machine.cpu_family().startswith('x86')
+ if cc.get_define('__SSE4_2__', args:'-march=native') == ''
+ cpu_instruction_set = 'corei7'
+ endif
endif
dpdk_conf.set('RTE_MACHINE', cpu_instruction_set)
--
2.33.0

View File

@ -0,0 +1,40 @@
From 4eab54da18159310d6cfdc490bd212dba1416043 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 19:38:36 +0800
Subject: [PATCH] 0008-reinit-support-return-ok.patch
---
lib/eal/linux/eal.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 769c6d0..bc0ca2b 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -968,6 +968,7 @@ rte_eal_init(int argc, char **argv)
{
int i, fctret, ret;
static RTE_ATOMIC(uint32_t) run_once;
+ static uint32_t reinit_ok = 0;
uint32_t has_run = 0;
char cpuset[RTE_CPU_AFFINITY_STR_LEN];
char thread_name[RTE_THREAD_NAME_SIZE];
@@ -983,8 +984,15 @@ rte_eal_init(int argc, char **argv)
return -1;
}
+ if (argc > 1 && !strncmp(argv[1], "reinit-ok", strlen("reinit-ok"))) {
+ reinit_ok = 1;
+ }
+
if (!rte_atomic_compare_exchange_strong_explicit(&run_once, &has_run, 1,
rte_memory_order_relaxed, rte_memory_order_relaxed)) {
+ if (reinit_ok) {
+ return 0;
+ }
rte_eal_init_alert("already called initialization.");
rte_errno = EALREADY;
return -1;
--
2.33.0

View File

@ -0,0 +1,87 @@
From f541da70a5fdb553dc0cb71b3de54065dd245c2d Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 19 Jun 2023 00:56:38 +0800
Subject: [PATCH] gro:fix gro with tcp push flag
TCP data packets sometimes carry a PUSH flag. Currently,
only the packets that do not have PUSH flag can be GROed.
The packets that have a PUSH flag cannot be GROed, the packets
that cannot be processed by GRO are placed last.
In this case, the received packets may be out of order.
For example, there are two packets mbuf1 and mbuf2. mbuf1
contains PUSH flag, mbuf2 does not contain PUSH flag.
After GRO processing, mbuf2 is sent for processing before mbuf1.
This out-of-order will affect TCP processing performance and
lead to unnecessary dup-ACK.
Referring to the Linux kernel implementation, packets with PUSH
flag can also perform GRO. And if one of the packets containing
PUSH flag, the packets after GRO will carry PUSH flag.
Reference: https://mails.dpdk.org/archives/stable/2022-July/039759.html
---
lib/gro/gro_tcp.h | 16 +++++++++++++---
lib/gro/gro_tcp4.c | 3 ++-
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/lib/gro/gro_tcp.h b/lib/gro/gro_tcp.h
index d926c4b..5f96ea3 100644
--- a/lib/gro/gro_tcp.h
+++ b/lib/gro/gro_tcp.h
@@ -85,7 +85,8 @@ merge_two_tcp_packets(struct gro_tcp_item *item,
uint16_t l2_offset)
{
struct rte_mbuf *pkt_head, *pkt_tail, *lastseg;
- uint16_t hdr_len, l2_len;
+ struct rte_tcp_hdr *head_tcp_hdr, *tail_tcp_hdr;
+ uint16_t hdr_len, l2_len, l3_offset;
if (cmp > 0) {
pkt_head = item->firstseg;
@@ -96,8 +97,8 @@ merge_two_tcp_packets(struct gro_tcp_item *item,
}
/* check if the IPv4 packet length is greater than the max value */
- hdr_len = l2_offset + pkt_head->l2_len + pkt_head->l3_len +
- pkt_head->l4_len;
+ l3_offset = l2_offset + pkt_head->l2_len + pkt_head->l3_len;
+ hdr_len = l3_offset + pkt_head->l4_len;
l2_len = l2_offset > 0 ? pkt_head->outer_l2_len : pkt_head->l2_len;
if (unlikely(pkt_head->pkt_len - l2_len + pkt_tail->pkt_len -
hdr_len > MAX_IP_PKT_LENGTH))
@@ -106,6 +107,15 @@ merge_two_tcp_packets(struct gro_tcp_item *item,
if (unlikely(pkt_head->nb_segs >= 20))
return 0;
+ /* merge push flag to pkt_head */
+ tail_tcp_hdr = rte_pktmbuf_mtod_offset(pkt_tail,
+ struct rte_tcp_hdr *, l3_offset);
+ if (tail_tcp_hdr->tcp_flags & RTE_TCP_PSH_FLAG) {
+ head_tcp_hdr = rte_pktmbuf_mtod_offset(pkt_head,
+ struct rte_tcp_hdr *, l3_offset);
+ head_tcp_hdr->tcp_flags |= RTE_TCP_PSH_FLAG;
+ }
+
/* remove the packet header for the tail packet */
rte_pktmbuf_adj(pkt_tail, hdr_len);
diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c
index 6645de5..f771e81 100644
--- a/lib/gro/gro_tcp4.c
+++ b/lib/gro/gro_tcp4.c
@@ -140,10 +140,11 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len;
/*
- * Don't process the packet which has FIN, SYN, RST, PSH, URG, ECE
+ * Don't process the packet which has FIN, SYN, RST, URG, ECE
* or CWR set.
*/
if (tcp_hdr->tcp_flags != RTE_TCP_ACK_FLAG)
+ if (tcp_hdr->tcp_flags & (~(RTE_TCP_ACK_FLAG | RTE_TCP_PSH_FLAG)))
return -1;
/* trim the tail padding bytes */
--
2.33.0

View File

@ -0,0 +1,25 @@
From d0bdd88e02a4b84883f601acb6d414c42dee53b8 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Thu, 11 Jan 2024 19:44:51 +0800
Subject: [PATCH]
0010-example-l3fwd-masking-wrong-warning-array-subscript-.patch
---
examples/l3fwd/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build
index c25de77..ac5f393 100644
--- a/examples/l3fwd/meson.build
+++ b/examples/l3fwd/meson.build
@@ -7,6 +7,7 @@
# DPDK instance, use 'make'
allow_experimental_apis = true
+cflags += ['-Wno-array-bounds']
deps += ['acl', 'hash', 'lpm', 'fib']
sources = files(
'l3fwd_acl.c',
--
2.33.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
From 0e4ac40f7d72a669d509731b3d1b1c3e62a95487 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Fri, 12 Jan 2024 10:05:30 +0800
Subject: lstack need skip rte_bus_probe when use ltran mode
---
lib/eal/linux/eal.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index fd66fc4..39ac949 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1372,11 +1372,15 @@ rte_eal_init(int argc, char **argv)
return -1;
}
- /* Probe all the buses and devices/drivers on them */
- if (rte_bus_probe()) {
- rte_eal_init_alert("Cannot probe devices");
- rte_errno = ENOTSUP;
- return -1;
+ if (internal_conf->map_perfect && internal_conf->base_virtaddr) {
+ RTE_LOG(WARNING, EAL, "Skip rte_bus_probe\n");
+ } else {
+ /* Probe all the buses and devices/drivers on them */
+ if (rte_bus_probe()) {
+ rte_eal_init_alert("Cannot probe devices");
+ rte_errno = ENOTSUP;
+ return -1;
+ }
}
#ifdef VFIO_PRESENT
--
2.33.0

View File

@ -10,11 +10,24 @@
Name: dpdk
Version: 23.11
Release: 1
Release: 2
URL: http://dpdk.org
Source: https://fast.dpdk.org/rel/dpdk-%{version}.tar.xz
# upstream patch number start from 6000
# self developed patch number start from 9000
Patch9001: 0001-add-igb_uio.patch
Patch9002: 0002-dpdk-add-secure-compile-option-and-fPIC-option.patch
Patch9003: 0003-dpdk-bugfix-the-deadlock-in-rte_eal_init.patch
Patch9004: 0004-dpdk-master-core-donot-set-affinity-in-libstorage.patch
Patch9005: 0005-dpdk-change-the-log-level-in-prepare_numa.patch
Patch9006: 0006-dpdk-fix-dpdk-coredump-problem.patch
Patch9007: 0007-dpdk-fix-cpu-flag-error-in-Intel-R-Xeon-R-CPU-E5-262.patch
Patch9008: 0008-reinit-support-return-ok.patch
Patch9009: 0009-gro-fix-gro-with-tcp-push-flag.patch
Patch9010: 0010-example-l3fwd-masking-wrong-warning-array-subscript-.patch
Patch9011: 0011-dpdk-add-support-for-gazellle.patch
Patch9012: 0012-lstack-need-skip-rte_bus_probe-when-use-ltran-mode.patch
BuildRequires: meson
BuildRequires: python3-pyelftools
@ -182,6 +195,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko
%endif
%changelog
* Tue Jan 12 2024 jiangheng <jiangheng14@huawei.com> - 23.11-2
add self-developed patches
* Tue Jan 09 2024 jiangheng <jiangheng14@huawei.com> - 23.11-1
upgrade dpdk to 23.11