!21 kni: fix build with Linux 5.6 and 5.9

From: @seuzw
Reviewed-by: @wangxp006
Signed-off-by: @wangxp006
This commit is contained in:
openeuler-ci-bot 2020-11-20 19:26:46 +08:00 committed by Gitee
commit a4b8f41be6
3 changed files with 107 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: dpdk
Version: 19.11
Release: 4
Release: 5
Packager: packaging@6wind.com
URL: http://dpdk.org
%global source_version 19.11
@ -11,6 +11,8 @@ Patch1: CVE-2020-10722.patch
Patch2: CVE-2020-10723.patch
Patch3: CVE-2020-10724.patch
Patch4: CVE-2020-10726.patch
Patch5: kni-fix-build-with-Linux-5.6.patch
Patch6: v2-kni-fix-build-with-Linux-5.9.patch
Summary: Data Plane Development Kit core
Group: System Environment/Libraries
@ -72,6 +74,8 @@ This package contains the pdump tool for capture the dpdk network packets.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
namer=%{kern_devel_ver}
@ -173,6 +177,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
/usr/sbin/depmod
%changelog
* Fri Nov 20 2020 seuzw<930zhaowei@163.com> - 19.11-5
-kni: fix build with Linux 5.6 and 5.9
* Wed Sep 23 2020 hubble_zhu<hubble_zhu@qq.com> - 19.11-4
-update pyelftools to python3-pyelftools

View File

@ -0,0 +1,48 @@
From: Ferruh Yigit <ferruh.yigit@intel.com>
Date: Wed, 12 Feb 2020 17:14:24 +0000
Message-Id: <20200212171424.695556-1-ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH] kni: fix build with Linux 5.6
With the following Linux commit a new parameter 'txqueue' has been added
to 'ndo_tx_timeout' ndo:
commit 0290bd291cc0 ("netdev: pass the stuck queue to the timeout handler")
The change reflected to the KNI with version check.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
---
kernel/linux/kni/compat.h | 4 ++++
kernel/linux/kni/kni_net.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h
index 7109474ec..9ee45dbf6 100644
--- a/kernel/linux/kni/compat.h
+++ b/kernel/linux/kni/compat.h
@@ -130,3 +130,7 @@
#if KERNEL_VERSION(4, 10, 0) <= LINUX_VERSION_CODE
#define HAVE_IOVA_TO_KVA_MAPPING_SUPPORT
#endif
+
+#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE
+#define HAVE_TX_TIMEOUT_TXQUEUE
+#endif
diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
index 97fe85be9..c82c881a2 100644
--- a/kernel/linux/kni/kni_net.c
+++ b/kernel/linux/kni/kni_net.c
@@ -623,8 +623,13 @@ kni_net_rx(struct kni_dev *kni)
/*
* Deal with a transmit timeout.
*/
+#ifdef HAVE_TX_TIMEOUT_TXQUEUE
+static void
+kni_net_tx_timeout(struct net_device *dev, unsigned int txqueue)
+#else
static void
kni_net_tx_timeout(struct net_device *dev)
+#endif
{
pr_debug("Transmit timeout at %ld, latency %ld\n", jiffies,
jiffies - dev_trans_start(dev));

View File

@ -0,0 +1,51 @@
From: Ferruh Yigit <ferruh.yigit@intel.com>
Date: Mon, 17 Aug 2020 11:32:47 +0100
Message-Id: <20200817103247.1564204-1-ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH v2] kni: fix build with Linux 5.9
Starting from Linux 5.9 'get_user_pages_remote()' API doesn't get
'struct task_struct' parameter:
commit 64019a2e467a ("mm/gup: remove task_struct pointer for all gup code")
The change reflected to the KNI with version check.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* Add stable tag to request backport.
---
kernel/linux/kni/compat.h | 4 ++++
kernel/linux/kni/kni_dev.h | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h
index 9ee45dbf6f..d515b27669 100644
--- a/kernel/linux/kni/compat.h
+++ b/kernel/linux/kni/compat.h
@@ -134,3 +134,7 @@
#if KERNEL_VERSION(5, 6, 0) <= LINUX_VERSION_CODE
#define HAVE_TX_TIMEOUT_TXQUEUE
#endif
+
+#if KERNEL_VERSION(5, 9, 0) > LINUX_VERSION_CODE
+#define HAVE_TSK_IN_GUP
+#endif
diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h
index ca5f92a47b..c15da311ba 100644
--- a/kernel/linux/kni/kni_dev.h
+++ b/kernel/linux/kni/kni_dev.h
@@ -101,8 +101,13 @@ static inline phys_addr_t iova_to_phys(struct task_struct *tsk,
offset = iova & (PAGE_SIZE - 1);
/* Read one page struct info */
+#ifdef HAVE_TSK_IN_GUP
ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,
FOLL_TOUCH, &page, NULL, NULL);
+#else
+ ret = get_user_pages_remote(tsk->mm, iova, 1,
+ FOLL_TOUCH, &page, NULL, NULL);
+#endif
if (ret < 0)
return 0;