Skip to contentSkip to conversation

kni: fix build with kernel 4.11

PATCH Superseded Ferruh Yigit 4 participants 5 messages Mar 20, 2017 – Mar 30, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kni: fix build with kernel 4.11

compile error:
.../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
error: implicit declaration of function ‘signal_pending’ [-Werror=implicit-function-declaration]

  if (signal_pending(current) || ret_val <= 0) {
      ^~~~~~~~~~~~~~

Linux 4.11 moves signal function declarations to its own header file:
Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")

User new header file "linux/sched/signal.h" to fix build error.

---
 lib/librte_eal/linuxapp/kni/compat.h  | 6 ++++++
 lib/librte_eal/linuxapp/kni/kni_dev.h | 6 ++++++
 2 files changed, 12 insertions(+)
lib/librte_eal/linuxapp/kni/compat.h +6 -0
index 78da08e..d96275a 100644
@@ -2,6 +2,8 @@
  * Minimal wrappers to allow compiling kni on older kernels.
  */
 
+#include <linux/version.h>
+
 #ifndef RHEL_RELEASE_VERSION
 #define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
 #endif
@@ -67,3 +69,7 @@
 	(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)))
 #undef NET_NAME_UNKNOWN
 #endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#endif
lib/librte_eal/linuxapp/kni/kni_dev.h +6 -0
index 002e5fa..72385ab 100644
@@ -30,9 +30,15 @@
 #endif
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include "compat.h"
+
 #include <linux/if.h>
 #include <linux/wait.h>
+#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#include <linux/sched/signal.h>
+#else
 #include <linux/sched.h>
+#endif
 #include <linux/netdevice.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
Signature · 1 line
2.9.3
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ferruh Yigit

compile error:
.../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
error: implicit declaration of function ‘signal_pending’ [-Werror=implicit-function-declaration]

  if (signal_pending(current) || ret_val <= 0) {
      ^~~~~~~~~~~~~~
Quoted 8 lines

Linux 4.11 moves signal function declarations to its own header file:
Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")

User new header file "linux/sched/signal.h" to fix build error.

Kernel version: 4.11-rc3

Quoted 49 lines
---
 lib/librte_eal/linuxapp/kni/compat.h  | 6 ++++++
 lib/librte_eal/linuxapp/kni/kni_dev.h | 6 ++++++
 2 files changed, 12 insertions(+)
lib/librte_eal/linuxapp/kni/compat.h +6 -0
index 78da08e..d96275a 100644
@@ -2,6 +2,8 @@
  * Minimal wrappers to allow compiling kni on older kernels.
  */
 
+#include <linux/version.h>
+
 #ifndef RHEL_RELEASE_VERSION
 #define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
 #endif
@@ -67,3 +69,7 @@
 	(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)))
 #undef NET_NAME_UNKNOWN
 #endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#endif
lib/librte_eal/linuxapp/kni/kni_dev.h +6 -0
index 002e5fa..72385ab 100644
@@ -30,9 +30,15 @@
 #endif
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include "compat.h"
+
 #include <linux/if.h>
 #include <linux/wait.h>
+#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#include <linux/sched/signal.h>
+#else
 #include <linux/sched.h>
+#endif
 #include <linux/netdevice.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
Signature · 1 line
2.9.3
Tested-by on v1 1/1
#2 lore raw
In reply to Ferruh Yigit

Hello,

Quoted 65 lines

compile error:
.../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
error: implicit declaration of function ‘signal_pending’ [-Werror=implicit-function-declaration]

  if (signal_pending(current) || ret_val <= 0) {
      ^~~~~~~~~~~~~~

Linux 4.11 moves signal function declarations to its own header file:
Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")

User new header file "linux/sched/signal.h" to fix build error.

---
 lib/librte_eal/linuxapp/kni/compat.h  | 6 ++++++
 lib/librte_eal/linuxapp/kni/kni_dev.h | 6 ++++++
 2 files changed, 12 insertions(+)
lib/librte_eal/linuxapp/kni/compat.h +6 -0
index 78da08e..d96275a 100644
@@ -2,6 +2,8 @@
  * Minimal wrappers to allow compiling kni on older kernels.
  */
 
+#include <linux/version.h>
+
 #ifndef RHEL_RELEASE_VERSION
 #define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
 #endif
@@ -67,3 +69,7 @@
 	(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)))
 #undef NET_NAME_UNKNOWN
 #endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#endif
lib/librte_eal/linuxapp/kni/kni_dev.h +6 -1
index 002e5fa..72385ab 100644
@@ -30,9 +30,15 @@
 #endif
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include "compat.h"
+
 #include <linux/if.h>
 #include <linux/wait.h>
+#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#include <linux/sched/signal.h>
+#else
 #include <linux/sched.h>
+#endif
 #include <linux/netdevice.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
--
Quoted 1 line

2.9.3

This patch fixes build error of DPDK with linux kernel version 4.11.0-rc2 for me.

Quoted 2 lines
#3 lore raw

PATCH v2 1/1 kni: fix build with kernel 4.11

In reply to Ferruh Yigit

compile error:
.../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
error: implicit declaration of function ‘signal_pending’ [-Werror=implicit-function-declaration]

  if (signal_pending(current) || ret_val <= 0) {
      ^~~~~~~~~~~~~~

Linux 4.11 moves signal function declarations to its own header file:
Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")

Use new header file "linux/sched/signal.h" to fix the build error.

---
v2:
* update commit log User -> Use
* CC: stable and Thomas

---
 lib/librte_eal/linuxapp/kni/compat.h  | 6 ++++++
 lib/librte_eal/linuxapp/kni/kni_dev.h | 6 ++++++
 2 files changed, 12 insertions(+)
lib/librte_eal/linuxapp/kni/compat.h +6 -0
index 78da08e..d96275a 100644
@@ -2,6 +2,8 @@
  * Minimal wrappers to allow compiling kni on older kernels.
  */
 
+#include <linux/version.h>
+
 #ifndef RHEL_RELEASE_VERSION
 #define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
 #endif
@@ -67,3 +69,7 @@
 	(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)))
 #undef NET_NAME_UNKNOWN
 #endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#endif
lib/librte_eal/linuxapp/kni/kni_dev.h +6 -0
index 002e5fa..72385ab 100644
@@ -30,9 +30,15 @@
 #endif
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include "compat.h"
+
 #include <linux/if.h>
 #include <linux/wait.h>
+#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
+#include <linux/sched/signal.h>
+#else
 #include <linux/sched.h>
+#endif
 #include <linux/netdevice.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
Signature · 1 line
2.9.3
#4 lore raw

2017-03-21 09:54, Ferruh Yigit:

Quoted 15 lines

compile error:
.../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
error: implicit declaration of function ‘signal_pending’ [-Werror=implicit-function-declaration]

  if (signal_pending(current) || ret_val <= 0) {
      ^~~~~~~~~~~~~~

Linux 4.11 moves signal function declarations to its own header file:
Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")

Use new header file "linux/sched/signal.h" to fix the build error.

Quoted 8 lines

---
v2:
* update commit log User -> Use
* CC: stable and Thomas

Applied, thanks