summaryrefslogtreecommitdiffstats
path: root/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-vhost-build-with-kernels-3.19-and-4.0.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-vhost-build-with-kernels-3.19-and-4.0.patch')
-rw-r--r--meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-vhost-build-with-kernels-3.19-and-4.0.patch141
1 files changed, 141 insertions, 0 deletions
diff --git a/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-vhost-build-with-kernels-3.19-and-4.0.patch b/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-vhost-build-with-kernels-3.19-and-4.0.patch
new file mode 100644
index 0000000..a083fb1
--- /dev/null
+++ b/meta-isg/common/recipes-extended/dpdk/dpdk/dpdk-2.0.0-kni-fix-vhost-build-with-kernels-3.19-and-4.0.patch
@@ -0,0 +1,141 @@
1From d4903f024ede0e54cc5e025e2cb54309b1164d22 Mon Sep 17 00:00:00 2001
2From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3Date: Tue, 5 May 2015 15:08:00 +0100
4Subject: [PATCH 1/2] kni: fix vhost build with kernels 3.19 and 4.0
5
6Upstream-Status: Backport [2.1.0]
7
8Due to commit c0371da6 in kernel 3.19, which removed msg_iov
9and msg_iovlen from struct msghdr, DPDK would not build.
10Also, functions memcpy_toiovecend and memcpy_fromiovecend
11were removed in commits ba7438ae and 57dd8a07, being substituted by
12copy_from_iter and copy_to_iter.
13
14This patch makes use of struct iov_iter, which has references
15to msg_iov and msg_iovln, and makes use of copy_from_iter
16and copy_to_iter.
17
18Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
19Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
20(cherry picked from commit 45e63ba8db314f75b8c969f3f952dee87f209129)
21Signed-off-by: Rahul Kumar Gupta <rahul.kumarxx.gupta@intel.com>
22---
23 lib/librte_eal/linuxapp/kni/compat.h | 4 ++++
24 lib/librte_eal/linuxapp/kni/kni_vhost.c | 37 ++++++++++++++++++++++++++-------
25 2 files changed, 33 insertions(+), 8 deletions(-)
26
27diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
28index 1313523..1ad22ba 100644
29--- a/lib/librte_eal/linuxapp/kni/compat.h
30+++ b/lib/librte_eal/linuxapp/kni/compat.h
31@@ -19,3 +19,7 @@
32 #define sk_sleep(s) (s)->sk_sleep
33
34 #endif /* < 2.6.35 */
35+
36+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
37+#define HAVE_IOV_ITER_MSGHDR
38+#endif
39diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
40index 7141f83..83d3351 100644
41--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
42+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
43@@ -76,7 +76,7 @@ static struct proto kni_raw_proto = {
44 };
45
46 static inline int
47-kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
48+kni_vhost_net_tx(struct kni_dev *kni, struct msghdr *m,
49 unsigned offset, unsigned len)
50 {
51 struct rte_kni_mbuf *pkt_kva = NULL;
52@@ -84,7 +84,11 @@ kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
53 int ret;
54
55 KNI_DBG_TX("tx offset=%d, len=%d, iovlen=%d\n",
56- offset, len, (int)iov->iov_len);
57+#ifdef HAVE_IOV_ITER_MSGHDR
58+ offset, len, (int)m->msg_iter.iov->iov_len);
59+#else
60+ offset, len, (int)m->msg_iov->iov_len);
61+#endif
62
63 /**
64 * Check if it has at least one free entry in tx_q and
65@@ -108,7 +112,12 @@ kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
66 data_kva = pkt_kva->buf_addr + pkt_kva->data_off
67 - kni->mbuf_va + kni->mbuf_kva;
68
69- memcpy_fromiovecend(data_kva, iov, offset, len);
70+#ifdef HAVE_IOV_ITER_MSGHDR
71+ copy_from_iter(data_kva, len, &m->msg_iter);
72+#else
73+ memcpy_fromiovecend(data_kva, m->msg_iov, offset, len);
74+#endif
75+
76 if (unlikely(len < ETH_ZLEN)) {
77 memset(data_kva + len, 0, ETH_ZLEN - len);
78 len = ETH_ZLEN;
79@@ -143,7 +152,7 @@ drop:
80 }
81
82 static inline int
83-kni_vhost_net_rx(struct kni_dev *kni, struct iovec *iov,
84+kni_vhost_net_rx(struct kni_dev *kni, struct msghdr *m,
85 unsigned offset, unsigned len)
86 {
87 uint32_t pkt_len;
88@@ -177,10 +186,18 @@ kni_vhost_net_rx(struct kni_dev *kni, struct iovec *iov,
89 goto drop;
90
91 KNI_DBG_RX("rx offset=%d, len=%d, pkt_len=%d, iovlen=%d\n",
92- offset, len, pkt_len, (int)iov->iov_len);
93+#ifdef HAVE_IOV_ITER_MSGHDR
94+ offset, len, pkt_len, (int)m->msg_iter.iov->iov_len);
95+#else
96+ offset, len, pkt_len, (int)m->msg_iov->iov_len);
97+#endif
98
99 data_kva = kva->buf_addr + kva->data_off - kni->mbuf_va + kni->mbuf_kva;
100- if (unlikely(memcpy_toiovecend(iov, data_kva, offset, pkt_len)))
101+#ifdef HAVE_IOV_ITER_MSGHDR
102+ if (unlikely(copy_to_iter(data_kva, pkt_len, &m->msg_iter)))
103+#else
104+ if (unlikely(memcpy_toiovecend(m->msg_iov, data_kva, offset, pkt_len)))
105+#endif
106 goto drop;
107
108 /* Update statistics */
109@@ -348,7 +365,11 @@ kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
110 return 0;
111
112 KNI_DBG_TX("kni_sndmsg len %ld, flags 0x%08x, nb_iov %d\n",
113+#ifdef HAVE_IOV_ITER_MSGHDR
114+ len, q->flags, (int)m->msg_iter.iov->iov_len);
115+#else
116 len, q->flags, (int)m->msg_iovlen);
117+#endif
118
119 #ifdef RTE_KNI_VHOST_VNET_HDR_EN
120 if (likely(q->flags & IFF_VNET_HDR)) {
121@@ -362,7 +383,7 @@ kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
122 if (unlikely(len < ETH_HLEN + q->vnet_hdr_sz))
123 return -EINVAL;
124
125- return kni_vhost_net_tx(q->kni, m->msg_iov, vnet_hdr_len, len);
126+ return kni_vhost_net_tx(q->kni, m, vnet_hdr_len, len);
127 }
128
129 static int
130@@ -391,7 +412,7 @@ kni_sock_rcvmsg(struct kiocb *iocb, struct socket *sock,
131 #endif
132
133 if (unlikely(0 == (pkt_len = kni_vhost_net_rx(q->kni,
134- m->msg_iov, vnet_hdr_len, len))))
135+ m, vnet_hdr_len, len))))
136 return 0;
137
138 #ifdef RTE_KNI_VHOST_VNET_HDR_EN
139--
1401.9.1
141