* [PATCH] kni: fix build on RHEL6.5
@ 2014-12-11 5:27 Jincheng Miao
[not found] ` <1418275627-17145-1-git-send-email-jmiao-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Jincheng Miao @ 2014-12-11 5:27 UTC (permalink / raw)
To: dev-VfR2kkLFssw
RHEL6.5 kernel is based on 2.6.32. But there are two changing
from 2.6.35:
1. socket struct is changed
It wrappered previous wait_queue_head_t of socket to
struct socket_wq. So for the kernel older than 2.6.35, we should
directly use socket->wait instead.
2. new function sk_sleep()
This function is implemented from 2.6.35 to obtain wait queue
from struct sock. This patch adds a macro in kni/compat.h
to be compatible with older kernels.
Patch is tested in RHEL6.5 and RHEL7.0 with:
CONFIG_RTE_LIBRTE_KNI=y
CONFIG_RTE_KNI_KO_DEBUG=y
CONFIG_RTE_KNI_VHOST=y
CONFIG_RTE_KNI_VHOST_MAX_CACHE_SIZE=1024
CONFIG_RTE_KNI_VHOST_VNET_HDR_EN=y
CONFIG_RTE_KNI_VHOST_DEBUG_RX=y
CONFIG_RTE_KNI_VHOST_DEBUG_TX=y
Signed-off-by: Jincheng Miao <jmiao-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
lib/librte_eal/linuxapp/kni/compat.h | 6 ++++++
lib/librte_eal/linuxapp/kni/kni_vhost.c | 17 +++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index 0d87421..1313523 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -13,3 +13,9 @@
#define kstrtoul strict_strtoul
#endif /* < 2.6.39 */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
+
+#define sk_sleep(s) (s)->sk_sleep
+
+#endif /* < 2.6.35 */
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index c05c868..7141f83 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -33,6 +33,7 @@
#include <linux/if_tun.h>
#include <linux/version.h>
+#include "compat.h"
#include "kni_dev.h"
#include "kni_fifo.h"
@@ -215,10 +216,19 @@ kni_sock_poll(struct file *file, struct socket *sock, poll_table * wait)
return POLLERR;
kni = q->kni;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
KNI_DBG("start kni_poll on group %d, wq 0x%16llx\n",
kni->group_id, (uint64_t)sock->wq);
+#else
+ KNI_DBG("start kni_poll on group %d, wait at 0x%16llx\n",
+ kni->group_id, (uint64_t)&sock->wait);
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
poll_wait(file, &sock->wq->wait, wait);
+#else
+ poll_wait(file, &sock->wait, wait);
+#endif
if (kni_fifo_count(kni->rx_q) > 0)
mask |= POLLIN | POLLRDNORM;
@@ -681,10 +691,17 @@ kni_vhost_backend_init(struct kni_dev *kni)
kni->vq_status = BE_START;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
KNI_DBG("backend init sockfd=%d, sock->wq=0x%16llx,"
"sk->sk_wq=0x%16llx",
q->sockfd, (uint64_t)q->sock->wq,
(uint64_t)q->sk.sk_wq);
+#else
+ KNI_DBG("backend init sockfd=%d, sock->wait at 0x%16llx,"
+ "sk->sk_sleep=0x%16llx",
+ q->sockfd, (uint64_t)&q->sock->wait,
+ (uint64_t)q->sk.sk_sleep);
+#endif
return 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1418275627-17145-1-git-send-email-jmiao-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] kni: fix build on RHEL6.5 [not found] ` <1418275627-17145-1-git-send-email-jmiao-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2014-12-16 15:21 ` Thomas Monjalon 2014-12-17 3:26 ` Jincheng Miao 0 siblings, 1 reply; 4+ messages in thread From: Thomas Monjalon @ 2014-12-16 15:21 UTC (permalink / raw) To: Jincheng Miao; +Cc: dev-VfR2kkLFssw 2014-12-11 13:27, Jincheng Miao: > RHEL6.5 kernel is based on 2.6.32. But there are two changing > from 2.6.35: > 1. socket struct is changed > It wrappered previous wait_queue_head_t of socket to > struct socket_wq. So for the kernel older than 2.6.35, we should > directly use socket->wait instead. > > 2. new function sk_sleep() > This function is implemented from 2.6.35 to obtain wait queue > from struct sock. This patch adds a macro in kni/compat.h > to be compatible with older kernels. I don't understand the relation between RHEL-6.5 and the kernel 2.6.35. The patch seems not related to RHEL at all. Please start your explanations by describing what is the problem you want to solve. Thanks -- Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kni: fix build on RHEL6.5 2014-12-16 15:21 ` Thomas Monjalon @ 2014-12-17 3:26 ` Jincheng Miao [not found] ` <5490F801.3020807-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Jincheng Miao @ 2014-12-17 3:26 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev-VfR2kkLFssw On 12/16/2014 11:21 PM, Thomas Monjalon wrote: > 2014-12-11 13:27, Jincheng Miao: >> RHEL6.5 kernel is based on 2.6.32. But there are two changing >> from 2.6.35: >> 1. socket struct is changed >> It wrappered previous wait_queue_head_t of socket to >> struct socket_wq. So for the kernel older than 2.6.35, we should >> directly use socket->wait instead. >> >> 2. new function sk_sleep() >> This function is implemented from 2.6.35 to obtain wait queue >> from struct sock. This patch adds a macro in kni/compat.h >> to be compatible with older kernels. > I don't understand the relation between RHEL-6.5 and the kernel 2.6.35. > The patch seems not related to RHEL at all. > Please start your explanations by describing what is the problem > you want to solve. Hi Thomas, This patch is working for resolving the problem I found on RHEL6.5: http://dpdk.org/ml/archives/dev/2014-December/009827.html Because the root cause is socket struct change from 2.6.35, so this patch also fits for all kernels older than 2.6.35. Sorry for the ambiguous description, I think the title should be: "kni: more compatibility for kernel older than 2.6.35" Regards, Jincheng Miao > > Thanks ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <5490F801.3020807-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] kni: fix build on RHEL6.5 [not found] ` <5490F801.3020807-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2014-12-17 23:39 ` Thomas Monjalon 0 siblings, 0 replies; 4+ messages in thread From: Thomas Monjalon @ 2014-12-17 23:39 UTC (permalink / raw) To: Jincheng Miao; +Cc: dev-VfR2kkLFssw 2014-12-17 11:26, Jincheng Miao: > On 12/16/2014 11:21 PM, Thomas Monjalon wrote: > > 2014-12-11 13:27, Jincheng Miao: > >> RHEL6.5 kernel is based on 2.6.32. But there are two changing > >> from 2.6.35: > >> 1. socket struct is changed > >> It wrappered previous wait_queue_head_t of socket to > >> struct socket_wq. So for the kernel older than 2.6.35, we should > >> directly use socket->wait instead. > >> > >> 2. new function sk_sleep() > >> This function is implemented from 2.6.35 to obtain wait queue > >> from struct sock. This patch adds a macro in kni/compat.h > >> to be compatible with older kernels. > > I don't understand the relation between RHEL-6.5 and the kernel 2.6.35. > > The patch seems not related to RHEL at all. > > Please start your explanations by describing what is the problem > > you want to solve. > > Hi Thomas, > > This patch is working for resolving the problem I found on RHEL6.5: > http://dpdk.org/ml/archives/dev/2014-December/009827.html > > Because the root cause is socket struct change from 2.6.35, so this > patch also fits for all kernels older than 2.6.35. > > Sorry for the ambiguous description, I think the title should be: > "kni: more compatibility for kernel older than 2.6.35" Applied with title "kni: fix build with kernel < 2.6.35 and vhost debug enabled" and error log. Thanks -- Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-17 23:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-11 5:27 [PATCH] kni: fix build on RHEL6.5 Jincheng Miao
[not found] ` <1418275627-17145-1-git-send-email-jmiao-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-16 15:21 ` Thomas Monjalon
2014-12-17 3:26 ` Jincheng Miao
[not found] ` <5490F801.3020807-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-17 23:39 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).