From patchwork Mon Nov 16 15:18:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Zhang, Helin" X-Patchwork-Id: 8951 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 36538591F; Mon, 16 Nov 2015 16:18:44 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id DF03E4A63 for ; Mon, 16 Nov 2015 16:18:41 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 16 Nov 2015 07:18:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,303,1444719600"; d="scan'208";a="601146208" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 16 Nov 2015 07:18:40 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 16 Nov 2015 07:18:40 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 16 Nov 2015 07:18:40 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.223]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.83]) with mapi id 14.03.0248.002; Mon, 16 Nov 2015 23:18:38 +0800 From: "Zhang, Helin" To: "De Lara Guarch, Pablo" , "dev@dpdk.org" Thread-Topic: [PATCH] kni: fix compilation issue with KNI_VHOST enabled Thread-Index: AQHRIHgnnDa0t0H5IECVdk8hIcHU/p6ewsZA Date: Mon, 16 Nov 2015 15:18:37 +0000 Message-ID: References: <1447682850-152756-1-git-send-email-pablo.de.lara.guarch@intel.com> In-Reply-To: <1447682850-152756-1-git-send-email-pablo.de.lara.guarch@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----Original Message----- From: De Lara Guarch, Pablo Sent: Monday, November 16, 2015 10:08 PM To: dev@dpdk.org Cc: Zhang, Helin ; De Lara Guarch, Pablo Subject: [PATCH] kni: fix compilation issue with KNI_VHOST enabled 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(+) +#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 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))) Is this a kernel socket or else? /Helin + return -ENOMEM; +#else if (!(q = (struct kni_vhost_queue *)sk_alloc( net, AF_UNSPEC, GFP_KERNEL, &kni_raw_proto))) return -ENOMEM;