DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Helin Zhang <helin.zhang@intel.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH] kni: fix vhost-kni compile errors
Date: Mon, 11 Apr 2016 17:54:28 +0100	[thread overview]
Message-ID: <1460393668-17719-1-git-send-email-ferruh.yigit@intel.com> (raw)
In-Reply-To: <CAOH8HtoUOEddeciO9F0XFdz7B9OFZvwb22sc8Rc9GSs5WaQ=fg@mail.gmail.com>

fix vhost-kni compile errors because of Linux kernel API changes

- SOCK_ASYNC_WAITDATA renamed to SOCKWQ_ASYNC_WAITDATA
  Linux commit id: 9cd3e072
  Updated in Linux kernel 4.4

- sk_alloc() gets new parameter
  Linux commit id: 11aa9c28b
  Updated in Linux kernel 4.2
  New parameter is: "@kern: is this to be a kernel socket?"

Reported-by: chintu hetam <rometoroam@gmail.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

---

Patch not tested, just fixed compiler errors.
---
 lib/librte_eal/linuxapp/kni/kni_vhost.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index 6f2a961..482b384 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -251,7 +251,11 @@ kni_sock_poll(struct file *file, struct socket *sock, poll_table * wait)
 		mask |= POLLIN | POLLRDNORM;
 
 	if (sock_writeable(&q->sk) ||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
+	    (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &q->sock->flags) &&
+#else
 	    (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &q->sock->flags) &&
+#endif
 	     sock_writeable(&q->sk)))
 		mask |= POLLOUT | POLLWRNORM;
 
@@ -619,8 +623,11 @@ kni_sk_write_space(struct sock *sk)
 	wait_queue_head_t *wqueue;
 
 	if (!sock_writeable(sk) ||
-	    !test_and_clear_bit(SOCK_ASYNC_NOSPACE,
-				&sk->sk_socket->flags))
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
+	    !test_and_clear_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags))
+#else
+	    !test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags))
+#endif
 		return;
 	wqueue = sk_sleep(sk);
 	if (wqueue && waitqueue_active(wqueue))
@@ -666,8 +673,14 @@ kni_vhost_backend_init(struct kni_dev *kni)
 	if (kni->vhost_queue != NULL)
 		return -1;
 
-	if (!(q = (struct kni_vhost_queue *)sk_alloc(
-		      net, AF_UNSPEC, GFP_KERNEL, &kni_raw_proto)))
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
+	q = (struct kni_vhost_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL,
+			&kni_raw_proto, 0);
+#else
+	q = (struct kni_vhost_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL,
+			&kni_raw_proto);
+#endif
+	if (!q)
 		return -ENOMEM;
 
 	err = sock_create_lite(AF_UNSPEC, SOCK_RAW, IPPROTO_RAW, &q->sock);
-- 
2.5.5

  parent reply	other threads:[~2016-04-11 16:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-09 23:26 [dpdk-dev] DPDK 2.2 build failing with vhost-kni chintu hetam
2016-04-11  8:25 ` Xie, Huawei
2016-04-11 14:09   ` chintu hetam
2016-04-11 18:57     ` chintu hetam
2016-04-11 19:02       ` chintu hetam
2016-04-11 16:54 ` Ferruh Yigit [this message]
2016-04-11 17:04   ` [dpdk-dev] [PATCH] kni: fix vhost-kni compile errors Thomas Monjalon
2016-04-11 17:57     ` Ferruh Yigit
2016-04-11 18:30     ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2016-04-11 20:43       ` Thomas Monjalon

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=1460393668-17719-1-git-send-email-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    /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).