add gaelle-proc-info support in dpdk

(cherry picked from commit 2ac668dbf05069714011deebe1e7e0eabf4eca55)
This commit is contained in:
jiangheng 2022-11-15 15:14:35 +08:00 committed by openeuler-sync-bot
parent 7fcd170e50
commit c2b9609357
2 changed files with 56 additions and 5 deletions

View File

@ -0,0 +1,43 @@
From 3be4c6f38ea1e2fd66f21872f38a2fb42d0fd36c Mon Sep 17 00:00:00 2001
From: Guoyang Zhou <zhouguoyang@huawei.com>
Date: Tue, 23 Mar 2021 21:17:51 +0800
Subject: [PATCH] net/hinic: fix crash in secondary process
[ upstream commit 4c670dfaa417bc5604c9c58b505a74e2725acdb2 ]
Some apps, such as fstack, will use secondary process to access the
memory of eth_dev_ops, and they want to get the info of dev, but hinic
driver does not initialized it when in secondary process.
Fixes: 66f64dd6dc86 ("net/hinic: fix secondary process")
Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
---
drivers/net/hinic/hinic_pmd_ethdev.c | 5 +++++
2 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index a0499da7d4..89ee5b7a78 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -2972,6 +2972,10 @@ static const struct eth_dev_ops hinic_pmd_vf_ops = {
.filter_ctrl = hinic_dev_filter_ctrl,
};
+static const struct eth_dev_ops hinic_dev_sec_ops = {
+ .dev_infos_get = hinic_dev_infos_get,
+};
+
static int hinic_func_init(struct rte_eth_dev *eth_dev)
{
struct rte_pci_device *pci_dev;
@@ -2985,6 +2989,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)
/* EAL is SECONDARY and eth_dev is already created */
if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+ eth_dev->dev_ops = &hinic_dev_sec_ops;
PMD_DRV_LOG(INFO, "Initialize %s in secondary process",
eth_dev->data->name);
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: dpdk
Version: 19.11
Release: 23
Release: 24
Packager: packaging@6wind.com
URL: http://dpdk.org
%global source_version 19.11
@ -52,6 +52,7 @@ Patch6003: backport-CVE-2022-28199.patch
Patch6004: backport-gro-fix-chain-index-for-more-than-2-packets.patch
Patch6005: backport-gro-trim-tail-padding-bytes.patch
Patch6006: backport-gro-check-payload-length-after-trim.patch
Patch6007: backport-net-hinic-fix-crash-in-secondary-process.patch
Summary: Data Plane Development Kit core
Group: System Environment/Libraries
@ -125,16 +126,18 @@ sed -ri 's,(LIBRTE_VHOST=).*,\1y,' %{target}/.config
sed -ri 's,(LIBRTE_PMD_PCAP=).*,\1y,' %{target}/.config
make O=%{target} V=2 -j16
#build gazelle-pdump
#build gazelle-pdump/gazelle-proc-info
cd %{target}/build/app/pdump
export GAZELLE_FLAGS="-lm -lpthread -lrt -lnuma -lconfig"
%ifarch x86_64
export GAZELLE_FLAGS="${GAZELLE_FLAGS} -mssse3"
%endif
export GAZELLE_LIBS="-lrte_pci -lrte_bus_pci -lrte_cmdline -lrte_hash -lrte_mempool -lrte_mempool_ring -lrte_timer -lrte_eal -lrte_gro -lrte_ring -lrte_mbuf -lrte_kni -lrte_pmd_ixgbe -lrte_kvargs -lrte_pmd_hinic -lrte_pmd_i40e -lrte_pmd_virtio -lrte_bus_vdev -lrte_net -lrte_ethdev -lrte_pdump -lrte_pmd_pcap"
export GAZELLE_LIBS="-lrte_pci -lrte_bus_pci -lrte_cmdline -lrte_hash -lrte_mempool -lrte_mempool_ring -lrte_timer -lrte_eal -lrte_gro -lrte_ring -lrte_mbuf -lrte_kni -lrte_pmd_ixgbe -lrte_kvargs -lrte_pmd_hinic -lrte_pmd_i40e -lrte_pmd_virtio -lrte_bus_vdev -lrte_net -lrte_ethdev -lrte_pdump -lrte_pmd_pcap -lrte_metrics -lrte_cryptodev -lrte_security"
export SECURE_OPTIONS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wall -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fPIE -pie -fPIC -g"
gcc -o gazelle-pdump -m64 ${GAZELLE_FLAGS} ${SECURE_OPTIONS} -I../../../include -L../../../lib ${GAZELLE_LIBS} main.o
gcc -o gazelle-pdump ${GAZELLE_FLAGS} ${SECURE_OPTIONS} -I../../../include -L../../../lib ${GAZELLE_LIBS} main.o
cd -
cd %{target}/build/app/proc-info
gcc -o gazelle-proc-info ${GAZELLE_FLAGS} ${SECURE_OPTIONS} -I../../../include -L../../../lib ${GAZELLE_LIBS} main.o
%install
namer=%{kern_devel_ver}
@ -172,6 +175,7 @@ ln -s /usr/share/dpdk/%{target} $RPM_BUILD_ROOT/usr/include/dpdk/
mkdir -p $RPM_BUILD_ROOT/usr/bin
cp ./%{target}/app/dpdk-pdump $RPM_BUILD_ROOT/usr/bin
cp ./%{target}/build/app/pdump/gazelle-pdump $RPM_BUILD_ROOT/usr/bin
cp ./%{target}/build/app/proc-info/gazelle-proc-info $RPM_BUILD_ROOT/usr/bin
strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/igb_uio.ko
strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
@ -207,6 +211,7 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
%files tools
/usr/bin/dpdk-pdump
/usr/bin/gazelle-pdump
/usr/bin/gazelle-proc-info
%post
/sbin/ldconfig
@ -217,6 +222,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
/usr/sbin/depmod
%changelog
* Tue Nov 15 2022 jiangheng <jiangheng14@huawei.com> - 19.11-24
- proc-info: build gazelle-proc-info for gazelle
* Mon Nov 14 2022 kircher <majun65@huawei.com> - 19.11-23
- pdump: add pmd_pcap support for dpdk
- pdump: build gazelle-pdump for gazelle