DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH v3 19/19] kni: move kernel version ifdefs to compat header
Date: Mon, 26 Sep 2016 16:39:38 +0100	[thread overview]
Message-ID: <20160926153938.7575-20-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20160926153938.7575-1-ferruh.yigit@intel.com>

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_eal/linuxapp/kni/compat.h    | 12 ++++++++++++
 lib/librte_eal/linuxapp/kni/kni_vhost.c | 16 +++++-----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index 9ae50a7..78da08e 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -20,6 +20,14 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
 #define sk_sleep(s) ((s)->sk_sleep)
+#else
+#define HAVE_SOCKET_WQ
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
+#define HAVE_STATIC_SOCK_MAP_FD
+#else
+#define kni_sock_map_fd(s) sock_map_fd(s, 0)
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
@@ -39,6 +47,10 @@
 #define HAVE_REBUILD_HEADER
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+#define HAVE_SK_ALLOC_KERN_PARAM
+#endif
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
 #define HAVE_TRANS_START_HELPER
 #endif
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index 3ba0c57..f54c34b 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -40,7 +40,7 @@
 
 #define RX_BURST_SZ 4
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
+#ifdef HAVE_STATIC_SOCK_MAP_FD
 static int kni_sock_map_fd(struct socket *sock)
 {
 	struct file *file;
@@ -57,8 +57,6 @@ static int kni_sock_map_fd(struct socket *sock)
 	fd_install(fd, file);
 	return fd;
 }
-#else
-#define kni_sock_map_fd(s)             sock_map_fd(s, 0)
 #endif
 
 static struct proto kni_raw_proto = {
@@ -225,17 +223,13 @@ kni_sock_poll(struct file *file, struct socket *sock, poll_table *wait)
 		return POLLERR;
 
 	kni = q->kni;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
+#ifdef HAVE_SOCKET_WQ
 	pr_debug("start kni_poll on group %d, wq 0x%16llx\n",
 		  kni->group_id, (uint64_t)sock->wq);
+	poll_wait(file, &sock->wq->wait, wait);
 #else
 	pr_debug("start kni_poll on group %d, wait at 0x%16llx\n",
 		  kni->group_id, (uint64_t)&sock->wait);
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
-	poll_wait(file, &sock->wq->wait, wait);
-#else
 	poll_wait(file, &sock->wait, wait);
 #endif
 
@@ -663,7 +657,7 @@ kni_vhost_backend_init(struct kni_dev *kni)
 	if (kni->vhost_queue != NULL)
 		return -1;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+#ifdef HAVE_SK_ALLOC_KERN_PARAM
 	q = (struct kni_vhost_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL,
 			&kni_raw_proto, 0);
 #else
@@ -729,7 +723,7 @@ kni_vhost_backend_init(struct kni_dev *kni)
 
 	kni->vq_status = BE_START;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
+#ifdef HAVE_SOCKET_WQ
 	pr_debug("backend init sockfd=%d, sock->wq=0x%16llx,sk->sk_wq=0x%16llx",
 		  q->sockfd, (uint64_t)q->sock->wq,
 		  (uint64_t)q->sk.sk_wq);
-- 
2.7.4

  parent reply	other threads:[~2016-09-26 15:44 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15 15:46 [dpdk-dev] [PATCH 00/19] KNI checkpatch cleanup Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 01/19] kni: move externs to the header file Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 02/19] kni: uninitialize global variables Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 03/19] kni: make static struct const Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 04/19] kni: whitespace, indentation, long line corrections Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 05/19] kni: prefer unsigned int to unsigned Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 06/19] kni: remove useless return Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 07/19] kni: comparisons should place the constant on the right Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 08/19] kni: trailing statements should be on next line Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 09/19] kni: do not use assignment in if condition Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 10/19] kni: macros with complex values should be enclosed in parentheses Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 11/19] kni: prefer min_t to min Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 12/19] kni: prefer ether_addr_copy to memcpy Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 13/19] kni: update kernel logging Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 14/19] kni: remove unnecessary 'out of memory' message Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 15/19] kni: move functions to eliminate function declarations Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 16/19] kni: remove compile time debug configuration Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 17/19] kni: updated log messages Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 18/19] kni: prefer uint32_t to unsigned int Ferruh Yigit
2016-09-15 15:46 ` [dpdk-dev] [PATCH 19/19] kni: move kernel version ifdefs to compat header Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 00/19] KNI checkpatch cleanup Ferruh Yigit
2016-09-26 15:39   ` [dpdk-dev] [PATCH v3 " Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 01/19] kni: move externs to the header file Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 02/19] kni: uninitialize global variables Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 03/19] kni: make static struct const Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 04/19] kni: whitespace, indentation, long line corrections Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 05/19] kni: prefer unsigned int to unsigned Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 06/19] kni: remove useless return Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 07/19] kni: comparisons should place the constant on the right Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 08/19] kni: trailing statements should be on next line Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 09/19] kni: do not use assignment in if condition Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 10/19] kni: macros with complex values should be enclosed in parentheses Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 11/19] kni: prefer min_t to min Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 12/19] kni: prefer ether_addr_copy to memcpy Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 13/19] kni: update kernel logging Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 14/19] kni: remove unnecessary 'out of memory' message Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 15/19] kni: move functions to eliminate function declarations Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 16/19] kni: remove compile time debug configuration Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 17/19] kni: updated log messages Ferruh Yigit
2016-09-26 15:39     ` [dpdk-dev] [PATCH v3 18/19] kni: prefer uint32_t to unsigned int Ferruh Yigit
2016-09-26 15:39     ` Ferruh Yigit [this message]
2016-10-13 21:15     ` [dpdk-dev] [PATCH v3 00/19] KNI checkpatch cleanup Thomas Monjalon
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 01/19] kni: move externs to the header file Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 02/19] kni: uninitialize global variables Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 03/19] kni: make static struct const Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 04/19] kni: whitespace, indentation, long line corrections Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 05/19] kni: prefer unsigned int to unsigned Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 06/19] kni: remove useless return Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 07/19] kni: comparisons should place the constant on the right Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 08/19] kni: trailing statements should be on next line Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 09/19] kni: do not use assignment in if condition Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 10/19] kni: macros with complex values should be enclosed in parentheses Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 11/19] kni: prefer min_t to min Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 12/19] kni: prefer ether_addr_copy to memcpy Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 13/19] kni: update kernel logging Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 14/19] kni: remove unnecessary 'out of memory' message Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 15/19] kni: move functions to eliminate function declarations Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 16/19] kni: remove compile time debug configuration Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 17/19] kni: updated log messages Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 18/19] kni: prefer uint32_t to unsigned int Ferruh Yigit
2016-09-16 16:26 ` [dpdk-dev] [PATCH v2 19/19] kni: move kernel version ifdefs to compat header Ferruh Yigit
2016-10-05 10:38 ` [dpdk-dev] [PATCH 00/19] KNI checkpatch cleanup Pattan, Reshma
2016-10-10 12:37   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160926153938.7575-20-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).