From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 95AEE2E81 for ; Mon, 16 Nov 2015 15:08:00 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 16 Nov 2015 06:07:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,303,1444719600"; d="scan'208";a="852035045" Received: from sie-lab-214-036.ir.intel.com (HELO sie-lab-214-174.ir.intel.com) ([10.237.214.36]) by fmsmga002.fm.intel.com with ESMTP; 16 Nov 2015 06:07:32 -0800 From: Pablo de Lara To: dev@dpdk.org Date: Mon, 16 Nov 2015 14:07:30 +0000 Message-Id: <1447682850-152756-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] kni: fix compilation issue with KNI_VHOST enabled 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: , X-List-Received-Date: Mon, 16 Nov 2015 14:08:01 -0000 Fix for the following error, on kernels 4.2.0 or higher, when KNI_VHOST is enabled: CC [M] lib/librte_eal/linuxapp/kni/kni_vhost.o lib/librte_eal/linuxapp/kni/kni_vhost.c: In function ‘kni_vhost_backend_init’: lib/librte_eal/linuxapp/kni/kni_vhost.c:669:38: error: too few arguments to function ‘sk_alloc’ if (!(q = (struct kni_vhost_queue *)sk_alloc( ^ In file included from lib/librte_eal/linuxapp/kni/kni_vhost.c:27:0: /usr/src/kernels/4.2.3-300.fc23.x86_64/include/net/sock.h:1515:14: note: declared here struct sock *sk_alloc(struct net *net, int family, gfp_t priority, ^ This change in the kernel was added in the following commit: Linux: 11aa9c28 ("net: Pass kern from net_proto_family.create to sk_alloc") Signed-off-by: Pablo de Lara --- lib/librte_eal/linuxapp/kni/kni_vhost.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index d0c12a6..2346ff3 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -666,9 +666,15 @@ kni_vhost_backend_init(struct kni_dev *kni) if (kni->vhost_queue != NULL) return -1; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) + if (!(q = (struct kni_vhost_queue *)sk_alloc( + net, AF_UNSPEC, GFP_KERNEL, &kni_raw_proto, 0))) + return -ENOMEM; +#else if (!(q = (struct kni_vhost_queue *)sk_alloc( net, AF_UNSPEC, GFP_KERNEL, &kni_raw_proto))) return -ENOMEM; +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) */ err = sock_create_lite(AF_UNSPEC, SOCK_RAW, IPPROTO_RAW, &q->sock); if (err) -- 2.5.0