From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C73A7C598 for ; Mon, 4 May 2015 23:46:05 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 04 May 2015 14:46:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,368,1427785200"; d="scan'208";a="720589217" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 04 May 2015 14:46:03 -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 t44Lk3Jc007799 for ; Mon, 4 May 2015 22:46:03 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t44Lk3fq029483 for ; Mon, 4 May 2015 22:46:03 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id t44Lk3e6029479 for dev@dpdk.org; Mon, 4 May 2015 22:46:03 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Mon, 4 May 2015 22:46:03 +0100 Message-Id: <1430775963-29444-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] kni: fix compilation issue on kernel 3.19 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, 04 May 2015 21:46:06 -0000 Due to commit c0371da6 in kernel 3.19, which removed msg_iov and msg_iovlen from struct msghdr, DPDK would not build. This patch makes use of struct iov_iter, which has references to those two variables. Reported-by: Thomas Monjalon Signed-off-by: Pablo de Lara --- lib/librte_eal/linuxapp/kni/compat.h | 4 ++++ lib/librte_eal/linuxapp/kni/kni_vhost.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h index 1313523..1ad22ba 100644 --- a/lib/librte_eal/linuxapp/kni/compat.h +++ b/lib/librte_eal/linuxapp/kni/compat.h @@ -19,3 +19,7 @@ #define sk_sleep(s) (s)->sk_sleep #endif /* < 2.6.35 */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) +#define HAVE_IOV_ITER_MSGHDR +#endif diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c index 7141f83..a2fd97f 100644 --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c @@ -76,7 +76,7 @@ static struct proto kni_raw_proto = { }; static inline int -kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov, +kni_vhost_net_tx(struct kni_dev *kni, const struct iovec *iov, unsigned offset, unsigned len) { struct rte_kni_mbuf *pkt_kva = NULL; @@ -143,7 +143,7 @@ drop: } static inline int -kni_vhost_net_rx(struct kni_dev *kni, struct iovec *iov, +kni_vhost_net_rx(struct kni_dev *kni, const struct iovec *iov, unsigned offset, unsigned len) { uint32_t pkt_len; @@ -361,8 +361,11 @@ kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock, if (unlikely(len < ETH_HLEN + q->vnet_hdr_sz)) return -EINVAL; - +#ifdef HAVE_IOV_ITER_MSGHDR + return kni_vhost_net_tx(q->kni, m->msg_iter.iov, vnet_hdr_len, len); +#else return kni_vhost_net_tx(q->kni, m->msg_iov, vnet_hdr_len, len); +#endif } static int @@ -391,7 +394,11 @@ kni_sock_rcvmsg(struct kiocb *iocb, struct socket *sock, #endif if (unlikely(0 == (pkt_len = kni_vhost_net_rx(q->kni, +#ifdef HAVE_IOV_ITER_MSGHDR + m->msg_iter.iov, vnet_hdr_len, len)))) +#else m->msg_iov, vnet_hdr_len, len)))) +#endif return 0; #ifdef RTE_KNI_VHOST_VNET_HDR_EN -- 1.7.4.1