From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ferruh.yigit@intel.com>
Received: from mga07.intel.com (mga07.intel.com [134.134.136.100])
 by dpdk.org (Postfix) with ESMTP id 2A16B567F;
 Tue, 21 Mar 2017 10:54:53 +0100 (CET)
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by orsmga105.jf.intel.com with ESMTP; 21 Mar 2017 02:54:52 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.36,198,1486454400"; d="scan'208";a="946555875"
Received: from sivswdev02.ir.intel.com ([10.237.217.46])
 by orsmga003.jf.intel.com with ESMTP; 21 Mar 2017 02:54:50 -0700
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>,
 Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org,
	stable@dpdk.org,
	Ferruh Yigit <ferruh.yigit@intel.com>
Date: Tue, 21 Mar 2017 09:54:48 +0000
Message-Id: <20170321095448.13772-1-ferruh.yigit@intel.com>
X-Mailer: git-send-email 2.8.4
In-Reply-To: <20170320112208.7941-1-ferruh.yigit@intel.com>
References: <20170320112208.7941-1-ferruh.yigit@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] [PATCH v2] kni: fix build with kernel 4.11
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 21 Mar 2017 09:54:53 -0000

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.

Cc: stable@dpdk.org

Reported-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Pankaj Gupta <pagupta@redhat.com>
---
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(+)

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index 78da08e..d96275a 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -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
diff --git a/lib/librte_eal/linuxapp/kni/kni_dev.h b/lib/librte_eal/linuxapp/kni/kni_dev.h
index 002e5fa..72385ab 100644
--- a/lib/librte_eal/linuxapp/kni/kni_dev.h
+++ b/lib/librte_eal/linuxapp/kni/kni_dev.h
@@ -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>
-- 
2.9.3