From patchwork Mon Apr 11 16:54:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 12014 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 6C4192952; Mon, 11 Apr 2016 18:54:34 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7BB7C2949 for ; Mon, 11 Apr 2016 18:54:33 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 11 Apr 2016 09:54:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,462,1455004800"; d="scan'208";a="930099048" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 11 Apr 2016 09:54:31 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u3BGsU0R031903; Mon, 11 Apr 2016 17:54:30 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u3BGsU54017958; Mon, 11 Apr 2016 17:54:30 +0100 Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u3BGsUdT017954; Mon, 11 Apr 2016 17:54:30 +0100 From: Ferruh Yigit To: dev@dpdk.org Cc: Helin Zhang , Ferruh Yigit Date: Mon, 11 Apr 2016 17:54:28 +0100 Message-Id: <1460393668-17719-1-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: References: Subject: [dpdk-dev] [PATCH] kni: fix vhost-kni compile errors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: Ferruh Yigit --- 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);