fix dkms issues on 4.11 (LP: #1691830)
[deb_dpdk.git] / debian / patches / kni-fix-build-with-kernel-4.11.patch
1 From d4d2380cbb02980bf0334601d9ce6ec5400413f9 Mon Sep 17 00:00:00 2001
2 From: Ferruh Yigit <ferruh.yigit@intel.com>
3 Date: Tue, 21 Mar 2017 09:54:48 +0000
4 Subject: [PATCH] kni: fix build with kernel 4.11
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 compile error:
10 .../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
11 error: implicit declaration of function ‘signal_pending’
12 [-Werror=implicit-function-declaration]
13   if (signal_pending(current) || ret_val <= 0) {
14       ^~~~~~~~~~~~~~
15
16 Linux 4.11 moves signal function declarations to its own header file:
17 Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup &
18 sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")
19
20 Use new header file "linux/sched/signal.h" to fix the build error.
21
22 Cc: stable@dpdk.org
23
24 Reported-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
25 Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
26 Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
27 Tested-by: Pankaj Gupta <pagupta@redhat.com>
28 ---
29  lib/librte_eal/linuxapp/kni/compat.h  | 6 ++++++
30  lib/librte_eal/linuxapp/kni/kni_dev.h | 6 ++++++
31  2 files changed, 12 insertions(+)
32
33 Origin: http://dpdk.org/browse/dpdk/commit/?id=d4d2380cbb02980bf0334601d9ce6ec5400413f9
34 Original-Author: Ferruh Yigit <ferruh.yigit@intel.com>
35 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/1691830
36 Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
37 Last-Update: 2017-05-19
38
39 diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
40 index 78da08e..d96275a 100644
41 --- a/lib/librte_eal/linuxapp/kni/compat.h
42 +++ b/lib/librte_eal/linuxapp/kni/compat.h
43 @@ -2,6 +2,8 @@
44   * Minimal wrappers to allow compiling kni on older kernels.
45   */
46  
47 +#include <linux/version.h>
48 +
49  #ifndef RHEL_RELEASE_VERSION
50  #define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
51  #endif
52 @@ -67,3 +69,7 @@
53         (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)))
54  #undef NET_NAME_UNKNOWN
55  #endif
56 +
57 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
58 +#define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
59 +#endif
60 diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h
61 index 002e5fa..72385ab 100644
62 --- a/lib/librte_eal/linuxapp/kni/kni_dev.h
63 +++ b/lib/librte_eal/linuxapp/kni/kni_dev.h
64 @@ -30,9 +30,15 @@
65  #endif
66  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
67  
68 +#include "compat.h"
69 +
70  #include <linux/if.h>
71  #include <linux/wait.h>
72 +#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
73 +#include <linux/sched/signal.h>
74 +#else
75  #include <linux/sched.h>
76 +#endif
77  #include <linux/netdevice.h>
78  #include <linux/spinlock.h>
79  #include <linux/list.h>
80 -- 
81 2.7.4
82