All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kni: fix compilation issue with KNI_VHOST enabled
@ 2015-11-16 14:07 Pablo de Lara
  2015-11-16 15:18 ` Zhang, Helin
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo de Lara @ 2015-11-16 14:07 UTC (permalink / raw)
  To: dev

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 <pablo.de.lara.guarch@intel.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kni: fix compilation issue with KNI_VHOST enabled
  2015-11-16 14:07 [PATCH] kni: fix compilation issue with KNI_VHOST enabled Pablo de Lara
@ 2015-11-16 15:18 ` Zhang, Helin
  2015-11-16 15:27   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Helin @ 2015-11-16 15:18 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev



-----Original Message-----
From: De Lara Guarch, Pablo 
Sent: Monday, November 16, 2015 10:08 PM
To: dev@dpdk.org
Cc: Zhang, Helin <helin.zhang@intel.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
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 <pablo.de.lara.guarch@intel.com>
---
 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)))
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;
+#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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kni: fix compilation issue with KNI_VHOST enabled
  2015-11-16 15:18 ` Zhang, Helin
@ 2015-11-16 15:27   ` De Lara Guarch, Pablo
  2015-11-18  7:42     ` Zhang, Helin
  0 siblings, 1 reply; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2015-11-16 15:27 UTC (permalink / raw)
  To: Zhang, Helin, dev



> -----Original Message-----
> From: Zhang, Helin
> Sent: Monday, November 16, 2015 3:19 PM
> To: De Lara Guarch, Pablo; dev@dpdk.org
> Subject: RE: [PATCH] kni: fix compilation issue with KNI_VHOST enabled
> 
> 
> 
> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Monday, November 16, 2015 10:08 PM
> To: dev@dpdk.org
> Cc: Zhang, Helin <helin.zhang@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> 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 <pablo.de.lara.guarch@intel.com>
> ---
>  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)))
> Is this a kernel socket or else?

Yes, that's for kernel socket. Should we put a 1? In most parts of the kernel,
"kern" is passed, but we don't have such variable. In others, they pass 0.

Thanks,
Pablo
> 
> /Helin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kni: fix compilation issue with KNI_VHOST enabled
  2015-11-16 15:27   ` De Lara Guarch, Pablo
@ 2015-11-18  7:42     ` Zhang, Helin
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Helin @ 2015-11-18  7:42 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev



> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Monday, November 16, 2015 11:28 PM
> To: Zhang, Helin; dev@dpdk.org
> Subject: RE: [PATCH] kni: fix compilation issue with KNI_VHOST enabled
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Helin
> > Sent: Monday, November 16, 2015 3:19 PM
> > To: De Lara Guarch, Pablo; dev@dpdk.org
> > Subject: RE: [PATCH] kni: fix compilation issue with KNI_VHOST enabled
> >
> >
> >
> > -----Original Message-----
> > From: De Lara Guarch, Pablo
> > Sent: Monday, November 16, 2015 10:08 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Helin <helin.zhang@intel.com>; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>
> > 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 <pablo.de.lara.guarch@intel.com>
> > ---
> >  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)))
> > Is this a kernel socket or else?
> 
> Yes, that's for kernel socket. Should we put a 1? In most parts of the kernel,
> "kern" is passed, but we don't have such variable. In others, they pass 0.
Sorry for the delay!
Yes, I think it shouldn't use 0, as it is triggered and used in kernel space.
/Helin

> 
> Thanks,
> Pablo
> >
> > /Helin


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-18  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 14:07 [PATCH] kni: fix compilation issue with KNI_VHOST enabled Pablo de Lara
2015-11-16 15:18 ` Zhang, Helin
2015-11-16 15:27   ` De Lara Guarch, Pablo
2015-11-18  7:42     ` Zhang, Helin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.