[dpdk-dev,v2,3/4] kni: fix function parameter from proto_ops pointers

Message ID 1435356878-10304-4-git-send-email-miguel.bernal.marin@linux.intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Miguel Bernal Marin June 26, 2015, 10:14 p.m. UTC
  Parameters from sendmsg and recvmsg has been changed in 4.1 kernel.
The function pointers belong to proto_ops structure were updated removing 
the struct kiocb parameter.

Fixes: 1b784140474e ("net: Remove iocb argument from sendmsg and recvmsg")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 lib/librte_eal/linuxapp/kni/compat.h    |  4 ++++
 lib/librte_eal/linuxapp/kni/kni_vhost.c | 10 ++++++++++
 2 files changed, 14 insertions(+)
  

Comments

Zhang, Helin July 10, 2015, 3:34 p.m. UTC | #1
Could one of you guys help to review the KNI vhost part?

Thanks,
Helin

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Miguel Bernal Marin
> Sent: Friday, June 26, 2015 3:15 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops
> pointers
> 
> Parameters from sendmsg and recvmsg has been changed in 4.1 kernel.
> The function pointers belong to proto_ops structure were updated removing the
> struct kiocb parameter.
> 
> Fixes: 1b784140474e ("net: Remove iocb argument from sendmsg and recvmsg")
> 
> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
> ---
>  lib/librte_eal/linuxapp/kni/compat.h    |  4 ++++
>  lib/librte_eal/linuxapp/kni/kni_vhost.c | 10 ++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/compat.h
> b/lib/librte_eal/linuxapp/kni/compat.h
> index 1ad22ba..cf100b6 100644
> --- a/lib/librte_eal/linuxapp/kni/compat.h
> +++ b/lib/librte_eal/linuxapp/kni/compat.h
> @@ -23,3 +23,7 @@
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)  #define
> HAVE_IOV_ITER_MSGHDR  #endif
> +
> +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) ) #define
> +HAVE_KIOCB_MSG_PARAM #endif /* < 4.1.0 */
> diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c
> b/lib/librte_eal/linuxapp/kni/kni_vhost.c
> index e01420a..f21b47e 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
> @@ -353,8 +353,13 @@ except:
>  }
> 
>  static int
> +#ifdef HAVE_KIOCB_MSG_PARAM
>  kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
>  	   struct msghdr *m, size_t total_len)
> +#else
> +kni_sock_sndmsg(struct socket *sock,
> +	   struct msghdr *m, size_t total_len) #endif /*
> HAVE_KIOCB_MSG_PARAM
> +*/
>  {
>  	struct kni_vhost_queue *q =
>  		container_of(sock->sk, struct kni_vhost_queue, sk); @@ -387,8
> +392,13 @@ kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,  }
> 
>  static int
> +#ifdef HAVE_KIOCB_MSG_PARAM
>  kni_sock_rcvmsg(struct kiocb *iocb, struct socket *sock,
>  	   struct msghdr *m, size_t len, int flags)
> +#else
> +kni_sock_rcvmsg(struct socket *sock,
> +	   struct msghdr *m, size_t len, int flags) #endif /*
> +HAVE_KIOCB_MSG_PARAM */
>  {
>  	int vnet_hdr_len = 0;
>  	int pkt_len = 0;
> --
> 2.4.4
  
Thomas Monjalon July 10, 2015, 3:42 p.m. UTC | #2
2015-07-10 15:34, Zhang, Helin:
> Could one of you guys help to review the KNI vhost part?

This series is already applied.
Thanks
  

Patch

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index 1ad22ba..cf100b6 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -23,3 +23,7 @@ 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
 #define HAVE_IOV_ITER_MSGHDR
 #endif
+
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) )
+#define HAVE_KIOCB_MSG_PARAM
+#endif /* < 4.1.0 */
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index e01420a..f21b47e 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -353,8 +353,13 @@  except:
 }
 
 static int
+#ifdef HAVE_KIOCB_MSG_PARAM
 kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
 	   struct msghdr *m, size_t total_len)
+#else
+kni_sock_sndmsg(struct socket *sock,
+	   struct msghdr *m, size_t total_len)
+#endif /* HAVE_KIOCB_MSG_PARAM */
 {
 	struct kni_vhost_queue *q =
 		container_of(sock->sk, struct kni_vhost_queue, sk);
@@ -387,8 +392,13 @@  kni_sock_sndmsg(struct kiocb *iocb, struct socket *sock,
 }
 
 static int
+#ifdef HAVE_KIOCB_MSG_PARAM
 kni_sock_rcvmsg(struct kiocb *iocb, struct socket *sock,
 	   struct msghdr *m, size_t len, int flags)
+#else
+kni_sock_rcvmsg(struct socket *sock,
+	   struct msghdr *m, size_t len, int flags)
+#endif /* HAVE_KIOCB_MSG_PARAM */
 {
 	int vnet_hdr_len = 0;
 	int pkt_len = 0;