DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1
@ 2015-06-25 19:09 Miguel Bernal Marin
  2015-06-25 19:09 ` [dpdk-dev] [PATCH 1/2] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-25 19:09 UTC (permalink / raw)
  To: dev

Due to API changes in netdevice.h in 4.1 kernel release, KNI modules
would not build.  This patch set adds the properly checks to fix
compilation.

Miguel Bernal Marin (2):
  kni: fix igb_ndo_bridge_getlink in 4.1
  kni: fix header_ops in 4.1

 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 10 ++++++++++
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  5 +++++
 lib/librte_eal/linuxapp/kni/kni_net.c              |  4 ++++
 3 files changed, 19 insertions(+)

-- 
2.3.3

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

* [dpdk-dev] [PATCH 1/2] kni: fix igb_ndo_bridge_getlink to build with 4.1
  2015-06-25 19:09 [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 Miguel Bernal Marin
@ 2015-06-25 19:09 ` Miguel Bernal Marin
  2015-06-25 19:09 ` [dpdk-dev] [PATCH 2/2] kni: fix header_ops " Miguel Bernal Marin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-25 19:09 UTC (permalink / raw)
  To: dev

ndo_bridge_getlink has changed in kernel release 4.1. It
adds new parameter which brakes compilation.

This patch add the properly checks to fix it.

Fixes: 46c264daaaa5 ("bridge/nl: remove wrong use of NLM_F_MULTI")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 10 ++++++++++
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index fa24d16..47198bb 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -2250,8 +2250,14 @@ static int igb_ndo_bridge_setlink(struct net_device *dev,
 }
 
 #ifdef HAVE_BRIDGE_FILTER
+#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
+static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
+				  struct net_device *dev, u32 filter_mask,
+				  int nlflags)
+#else
 static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 				  struct net_device *dev, u32 filter_mask)
+#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
 #else
 static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 				  struct net_device *dev)
@@ -2269,7 +2275,11 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 		mode = BRIDGE_MODE_VEPA;
 
 #ifdef HAVE_NDO_FDB_ADD_VID
+#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
+	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags);
+#else
 	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
+#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
 #else
 	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
 #endif /* HAVE_NDO_FDB_ADD_VID */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 44b9ebf..96d68a2 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3891,4 +3891,9 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #define vlan_tx_tag_present skb_vlan_tag_present
 #define HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS
 #endif /* 4.0.0 */
+
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) )
+/* ndo_bridge_getlink adds new nlflags parameter */
+#define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
+#endif /* >= 4.1.0 */
 #endif /* _KCOMPAT_H_ */
-- 
2.3.3

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

* [dpdk-dev] [PATCH 2/2] kni: fix header_ops to build with 4.1
  2015-06-25 19:09 [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 Miguel Bernal Marin
  2015-06-25 19:09 ` [dpdk-dev] [PATCH 1/2] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
@ 2015-06-25 19:09 ` Miguel Bernal Marin
  2015-06-25 21:56 ` [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
  2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
  3 siblings, 0 replies; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-25 19:09 UTC (permalink / raw)
  To: dev

rebuild member was removed from headers_ops in kernel release
4.1. Therefore kni module compilation breaks.

This patch add the properly checks to fix it.

Fixes: d476059e77d1 ("net: Kill dev_rebuild_header")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 lib/librte_eal/linuxapp/kni/kni_net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index e34a0fd..ab5add4 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -605,6 +605,7 @@ kni_net_header(struct sk_buff *skb, struct net_device *dev,
 /*
  * Re-fill the eth header
  */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0))
 static int
 kni_net_rebuild_header(struct sk_buff *skb)
 {
@@ -616,6 +617,7 @@ kni_net_rebuild_header(struct sk_buff *skb)
 
 	return 0;
 }
+#endif /* < 4.1.0  */
 
 /**
  * kni_net_set_mac - Change the Ethernet Address of the KNI NIC
@@ -646,7 +648,9 @@ static int kni_net_change_carrier(struct net_device *dev, bool new_carrier)
 
 static const struct header_ops kni_net_header_ops = {
 	.create  = kni_net_header,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0))
 	.rebuild = kni_net_rebuild_header,
+#endif /* < 4.1.0  */
 	.cache   = NULL,  /* disable caching */
 };
 
-- 
2.3.3

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

* Re: [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1
  2015-06-25 19:09 [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 Miguel Bernal Marin
  2015-06-25 19:09 ` [dpdk-dev] [PATCH 1/2] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
  2015-06-25 19:09 ` [dpdk-dev] [PATCH 2/2] kni: fix header_ops " Miguel Bernal Marin
@ 2015-06-25 21:56 ` De Lara Guarch, Pablo
  2015-06-26 14:36   ` Miguel Bernal Marin
  2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
  3 siblings, 1 reply; 17+ messages in thread
From: De Lara Guarch, Pablo @ 2015-06-25 21:56 UTC (permalink / raw)
  To: Miguel Bernal Marin, dev

Hi Miguel,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Miguel Bernal
> Marin
> Sent: Thursday, June 25, 2015 8:10 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1
> 
> Due to API changes in netdevice.h in 4.1 kernel release, KNI modules
> would not build.  This patch set adds the properly checks to fix
> compilation.
> 
> Miguel Bernal Marin (2):
>   kni: fix igb_ndo_bridge_getlink in 4.1
>   kni: fix header_ops in 4.1
> 
>  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 10 ++++++++++
>  lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  5 +++++
>  lib/librte_eal/linuxapp/kni/kni_net.c              |  4 ++++
>  3 files changed, 19 insertions(+)
> 
> --
> 2.3.3

I have tested your fix and it works for kernel 4.1, but I get and error if CONFIG_RTE_KNI_VHOST=y:

  CC [M]  /root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.o
/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:593:2: error: initialization from incompatible pointer type [-Werror]
  .sendmsg = kni_sock_sndmsg,
  ^
/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:593:2: error: (near initialization for 'kni_socket_ops.sendmsg') [-Werror]
/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:594:2: error: initialization from incompatible pointer type [-Werror]
  .recvmsg = kni_sock_rcvmsg,
  ^
/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:594:2: error: (near initialization for 'kni_socket_ops.recvmsg') [-Werror]
cc1: all warnings being treated as errors
/home/kernel_test/kernels_rc/linux-4.1/scripts/Makefile.build:258: recipe for target '/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.o' failed
make[10]: *** [/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.o] Error 1
/home/kernel_test/kernels_rc/linux-4.1/Makefile:1383: recipe for target '_module_/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni' failed

The fix for this is to remove struct socket *sock from  kni_sock_sndmsg and kni_sock_rcvmsg in kni_vhost.c.

Could you send a v2 with this fix as well?

Thanks for this,
Pablo

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

* Re: [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1
  2015-06-25 21:56 ` [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
@ 2015-06-26 14:36   ` Miguel Bernal Marin
  0 siblings, 0 replies; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-26 14:36 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev



On 06/25/2015 04:56 PM, De Lara Guarch, Pablo wrote:
> Hi Miguel,
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Miguel Bernal
>> Marin
>> Sent: Thursday, June 25, 2015 8:10 PM
>> To: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1
>>
>> Due to API changes in netdevice.h in 4.1 kernel release, KNI modules
>> would not build.  This patch set adds the properly checks to fix
>> compilation.
>>
>> Miguel Bernal Marin (2):
>>    kni: fix igb_ndo_bridge_getlink in 4.1
>>    kni: fix header_ops in 4.1
>>
>>   lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 10 ++++++++++
>>   lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  5 +++++
>>   lib/librte_eal/linuxapp/kni/kni_net.c              |  4 ++++
>>   3 files changed, 19 insertions(+)
>>
>> --
>> 2.3.3
>
> I have tested your fix and it works for kernel 4.1, but I get and error if CONFIG_RTE_KNI_VHOST=y:
>
>    CC [M]  /root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.o
> /root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:593:2: error: initialization from incompatible pointer type [-Werror]
>    .sendmsg = kni_sock_sndmsg,
>    ^
> /root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:593:2: error: (near initialization for 'kni_socket_ops.sendmsg') [-Werror]
> /root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:594:2: error: initialization from incompatible pointer type [-Werror]
>    .recvmsg = kni_sock_rcvmsg,
>    ^
> /root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.c:594:2: error: (near initialization for 'kni_socket_ops.recvmsg') [-Werror]
> cc1: all warnings being treated as errors
> /home/kernel_test/kernels_rc/linux-4.1/scripts/Makefile.build:258: recipe for target '/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.o' failed
> make[10]: *** [/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni/kni_vhost.o] Error 1
> /home/kernel_test/kernels_rc/linux-4.1/Makefile:1383: recipe for target '_module_/root/dpdk-latest/x86_64-native-linuxapp-gcc/build/lib/librte_eal/linuxapp/kni' failed
>
> The fix for this is to remove struct socket *sock from  kni_sock_sndmsg and kni_sock_rcvmsg in kni_vhost.c.
>
> Could you send a v2 with this fix as well?


Sure, I forgot to enable KNI_VHOST with 4.1.
Doing V2 and sending


>
> Thanks for this,
> Pablo
>
>

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

* [dpdk-dev] [PATCH v2 0/4] kni: fix build with kernel 4.1
  2015-06-25 19:09 [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 Miguel Bernal Marin
                   ` (2 preceding siblings ...)
  2015-06-25 21:56 ` [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
@ 2015-06-26 22:14 ` Miguel Bernal Marin
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 1/4] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
                     ` (4 more replies)
  3 siblings, 5 replies; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-26 22:14 UTC (permalink / raw)
  To: dev

Due to API changes in netdevice.h in 4.1 kernel release, KNI modules
would not build.  This patch set adds the properly checks to fix
compilation.

Changes in v2:

 - Fixed vHost module build errors.

Miguel Bernal Marin (4):
  kni: fix igb_ndo_bridge_getlink to buid with 4.1
  kni: fix header_ops to build with 4.1
  kni: fix function parameter from proto_ops pointers
  kni: fix missing validation when vhost HDR is enabled

 lib/librte_eal/linuxapp/kni/compat.h               |  4 ++++
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 10 ++++++++++
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  5 +++++
 lib/librte_eal/linuxapp/kni/kni_net.c              |  4 ++++
 lib/librte_eal/linuxapp/kni/kni_vhost.c            | 17 ++++++++++++++++-
 5 files changed, 39 insertions(+), 1 deletion(-)

-- 
2.4.4

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

* [dpdk-dev] [PATCH v2 1/4] kni: fix igb_ndo_bridge_getlink to build with 4.1
  2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
@ 2015-06-26 22:14   ` Miguel Bernal Marin
  2015-07-10 15:41     ` Zhang, Helin
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 2/4] kni: fix header_ops " Miguel Bernal Marin
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-26 22:14 UTC (permalink / raw)
  To: dev

ndo_bridge_getlink has changed in kernel release 4.1. It
adds new parameter which brakes compilation.

This patch add the properly checks to fix it.

Fixes: 46c264daaaa5 ("bridge/nl: remove wrong use of NLM_F_MULTI")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 10 ++++++++++
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
index fa24d16..47198bb 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -2250,8 +2250,14 @@ static int igb_ndo_bridge_setlink(struct net_device *dev,
 }
 
 #ifdef HAVE_BRIDGE_FILTER
+#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
+static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
+				  struct net_device *dev, u32 filter_mask,
+				  int nlflags)
+#else
 static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 				  struct net_device *dev, u32 filter_mask)
+#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
 #else
 static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 				  struct net_device *dev)
@@ -2269,7 +2275,11 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 		mode = BRIDGE_MODE_VEPA;
 
 #ifdef HAVE_NDO_FDB_ADD_VID
+#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
+	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags);
+#else
 	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
+#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
 #else
 	return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
 #endif /* HAVE_NDO_FDB_ADD_VID */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 44b9ebf..96d68a2 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3891,4 +3891,9 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #define vlan_tx_tag_present skb_vlan_tag_present
 #define HAVE_NDO_BRIDGE_SET_DEL_LINK_FLAGS
 #endif /* 4.0.0 */
+
+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) )
+/* ndo_bridge_getlink adds new nlflags parameter */
+#define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
+#endif /* >= 4.1.0 */
 #endif /* _KCOMPAT_H_ */
-- 
2.4.4

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

* [dpdk-dev] [PATCH v2 2/4] kni: fix header_ops to build with 4.1
  2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 1/4] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
@ 2015-06-26 22:14   ` Miguel Bernal Marin
  2015-07-10 15:31     ` Zhang, Helin
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops pointers Miguel Bernal Marin
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-26 22:14 UTC (permalink / raw)
  To: dev

rebuild member was removed from headers_ops in kernel release
4.1. Therefore kni module compilation breaks.

This patch add the properly checks to fix it.

Fixes: d476059e77d1 ("net: Kill dev_rebuild_header")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 lib/librte_eal/linuxapp/kni/kni_net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index e34a0fd..ab5add4 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -605,6 +605,7 @@ kni_net_header(struct sk_buff *skb, struct net_device *dev,
 /*
  * Re-fill the eth header
  */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0))
 static int
 kni_net_rebuild_header(struct sk_buff *skb)
 {
@@ -616,6 +617,7 @@ kni_net_rebuild_header(struct sk_buff *skb)
 
 	return 0;
 }
+#endif /* < 4.1.0  */
 
 /**
  * kni_net_set_mac - Change the Ethernet Address of the KNI NIC
@@ -646,7 +648,9 @@ static int kni_net_change_carrier(struct net_device *dev, bool new_carrier)
 
 static const struct header_ops kni_net_header_ops = {
 	.create  = kni_net_header,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0))
 	.rebuild = kni_net_rebuild_header,
+#endif /* < 4.1.0  */
 	.cache   = NULL,  /* disable caching */
 };
 
-- 
2.4.4

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

* [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops pointers
  2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 1/4] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 2/4] kni: fix header_ops " Miguel Bernal Marin
@ 2015-06-26 22:14   ` Miguel Bernal Marin
  2015-07-10 15:34     ` Zhang, Helin
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 4/4] kni: fix missing validation when vhost HDR is enabled Miguel Bernal Marin
  2015-07-01 13:14   ` [dpdk-dev] [PATCH v2 0/4] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
  4 siblings, 1 reply; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-26 22:14 UTC (permalink / raw)
  To: dev

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

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

* [dpdk-dev] [PATCH v2 4/4] kni: fix missing validation when vhost HDR is enabled
  2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
                     ` (2 preceding siblings ...)
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops pointers Miguel Bernal Marin
@ 2015-06-26 22:14   ` Miguel Bernal Marin
  2015-07-10 15:35     ` Zhang, Helin
  2015-07-01 13:14   ` [dpdk-dev] [PATCH v2 0/4] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
  4 siblings, 1 reply; 17+ messages in thread
From: Miguel Bernal Marin @ 2015-06-26 22:14 UTC (permalink / raw)
  To: dev

A missing port from memcpy_toiovecend to copy_to_iter
is showed when vHost HDR is enabled. DPDK would not build.

This patch add this validation to build with kernel > 3.19.

Fixes: 45e63ba8db31 ("kni: fix vhost build with kernels 3.19 and 4.0")
Fixes: ba7438aed924 ("vhost: don't bother copying iovecs in handle_rx(), kill memcpy_toiovecend()")

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
 lib/librte_eal/linuxapp/kni/kni_vhost.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index f21b47e..013a677 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -427,10 +427,15 @@ kni_sock_rcvmsg(struct socket *sock,
 
 #ifdef RTE_KNI_VHOST_VNET_HDR_EN
 	/* no need to copy hdr when no pkt received */
+#ifdef HAVE_IOV_ITER_MSGHDR
+	if (unlikely(copy_to_iter((void *)&vnet_hdr, vnet_hdr_len,
+		&m->msg_iter)))
+#else
 	if (unlikely(memcpy_toiovecend(m->msg_iov,
 		(void *)&vnet_hdr, 0, vnet_hdr_len)))
+#endif /* HAVE_IOV_ITER_MSGHDR */
 		return -EFAULT;
-#endif
+#endif /* RTE_KNI_VHOST_VNET_HDR_EN */
 	KNI_DBG_RX("kni_rcvmsg expect_len %ld, flags 0x%08x, pkt_len %d\n",
 		   (unsigned long)len, q->flags, pkt_len);
 
-- 
2.4.4

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

* Re: [dpdk-dev] [PATCH v2 0/4] kni: fix build with kernel 4.1
  2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
                     ` (3 preceding siblings ...)
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 4/4] kni: fix missing validation when vhost HDR is enabled Miguel Bernal Marin
@ 2015-07-01 13:14   ` De Lara Guarch, Pablo
  2015-07-10 10:00     ` Thomas Monjalon
  4 siblings, 1 reply; 17+ messages in thread
From: De Lara Guarch, Pablo @ 2015-07-01 13:14 UTC (permalink / raw)
  To: Miguel Bernal Marin, dev

Hi

> -----Original Message-----
> From: Miguel Bernal Marin [mailto:miguel.bernal.marin@linux.intel.com]
> Sent: Friday, June 26, 2015 11:15 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo
> Subject: [PATCH v2 0/4] kni: fix build with kernel 4.1
> 
> Due to API changes in netdevice.h in 4.1 kernel release, KNI modules
> would not build.  This patch set adds the properly checks to fix
> compilation.
> 
> Changes in v2:
> 
>  - Fixed vHost module build errors.
> 
> Miguel Bernal Marin (4):
>   kni: fix igb_ndo_bridge_getlink to buid with 4.1
>   kni: fix header_ops to build with 4.1
>   kni: fix function parameter from proto_ops pointers
>   kni: fix missing validation when vhost HDR is enabled
> 
>  lib/librte_eal/linuxapp/kni/compat.h               |  4 ++++
>  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 10 ++++++++++
>  lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  5 +++++
>  lib/librte_eal/linuxapp/kni/kni_net.c              |  4 ++++
>  lib/librte_eal/linuxapp/kni/kni_vhost.c            | 17 ++++++++++++++++-
>  5 files changed, 39 insertions(+), 1 deletion(-)
> 
> --
> 2.4.4

Thanks!

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

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

* Re: [dpdk-dev] [PATCH v2 0/4] kni: fix build with kernel 4.1
  2015-07-01 13:14   ` [dpdk-dev] [PATCH v2 0/4] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
@ 2015-07-10 10:00     ` Thomas Monjalon
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Monjalon @ 2015-07-10 10:00 UTC (permalink / raw)
  To: Miguel Bernal Marin; +Cc: dev

> > Due to API changes in netdevice.h in 4.1 kernel release, KNI modules
> > would not build.  This patch set adds the properly checks to fix
> > compilation.
> > 
> > Changes in v2:
> > 
> >  - Fixed vHost module build errors.
> > 
> > Miguel Bernal Marin (4):
> >   kni: fix igb_ndo_bridge_getlink to buid with 4.1
> >   kni: fix header_ops to build with 4.1
> >   kni: fix function parameter from proto_ops pointers
> >   kni: fix missing validation when vhost HDR is enabled
> 
> Thanks!
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks

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

* Re: [dpdk-dev] [PATCH v2 2/4] kni: fix header_ops to build with 4.1
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 2/4] kni: fix header_ops " Miguel Bernal Marin
@ 2015-07-10 15:31     ` Zhang, Helin
  0 siblings, 0 replies; 17+ messages in thread
From: Zhang, Helin @ 2015-07-10 15:31 UTC (permalink / raw)
  To: Miguel Bernal Marin; +Cc: dev



> -----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 2/4] kni: fix header_ops to build with 4.1
> 
> rebuild member was removed from headers_ops in kernel release 4.1. Therefore
> kni module compilation breaks.
> 
> This patch add the properly checks to fix it.
> 
> Fixes: d476059e77d1 ("net: Kill dev_rebuild_header")
> 
> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

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

* Re: [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops pointers
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops pointers Miguel Bernal Marin
@ 2015-07-10 15:34     ` Zhang, Helin
  2015-07-10 15:42       ` Thomas Monjalon
  0 siblings, 1 reply; 17+ messages in thread
From: Zhang, Helin @ 2015-07-10 15:34 UTC (permalink / raw)
  To: Xie, Huawei, Ouyang, Changchun, Liang, Cunming; +Cc: dev

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

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

* Re: [dpdk-dev] [PATCH v2 4/4] kni: fix missing validation when vhost HDR is enabled
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 4/4] kni: fix missing validation when vhost HDR is enabled Miguel Bernal Marin
@ 2015-07-10 15:35     ` Zhang, Helin
  0 siblings, 0 replies; 17+ messages in thread
From: Zhang, Helin @ 2015-07-10 15:35 UTC (permalink / raw)
  To: Xie, Huawei, Ouyang, Changchun, Liang, Cunming; +Cc: dev

Could one of you guys help to review the 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 4/4] kni: fix missing validation when vhost HDR is
> enabled
> 
> A missing port from memcpy_toiovecend to copy_to_iter is showed when vHost
> HDR is enabled. DPDK would not build.
> 
> This patch add this validation to build with kernel > 3.19.
> 
> Fixes: 45e63ba8db31 ("kni: fix vhost build with kernels 3.19 and 4.0")
> Fixes: ba7438aed924 ("vhost: don't bother copying iovecs in handle_rx(), kill
> memcpy_toiovecend()")
> 
> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
> ---
>  lib/librte_eal/linuxapp/kni/kni_vhost.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c
> b/lib/librte_eal/linuxapp/kni/kni_vhost.c
> index f21b47e..013a677 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
> @@ -427,10 +427,15 @@ kni_sock_rcvmsg(struct socket *sock,
> 
>  #ifdef RTE_KNI_VHOST_VNET_HDR_EN
>  	/* no need to copy hdr when no pkt received */
> +#ifdef HAVE_IOV_ITER_MSGHDR
> +	if (unlikely(copy_to_iter((void *)&vnet_hdr, vnet_hdr_len,
> +		&m->msg_iter)))
> +#else
>  	if (unlikely(memcpy_toiovecend(m->msg_iov,
>  		(void *)&vnet_hdr, 0, vnet_hdr_len)))
> +#endif /* HAVE_IOV_ITER_MSGHDR */
>  		return -EFAULT;
> -#endif
> +#endif /* RTE_KNI_VHOST_VNET_HDR_EN */
>  	KNI_DBG_RX("kni_rcvmsg expect_len %ld, flags 0x%08x, pkt_len %d\n",
>  		   (unsigned long)len, q->flags, pkt_len);
> 
> --
> 2.4.4

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

* Re: [dpdk-dev] [PATCH v2 1/4] kni: fix igb_ndo_bridge_getlink to build with 4.1
  2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 1/4] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
@ 2015-07-10 15:41     ` Zhang, Helin
  0 siblings, 0 replies; 17+ messages in thread
From: Zhang, Helin @ 2015-07-10 15:41 UTC (permalink / raw)
  To: Miguel Bernal Marin, dev



> -----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 1/4] kni: fix igb_ndo_bridge_getlink to build with
> 4.1
> 
> ndo_bridge_getlink has changed in kernel release 4.1. It adds new parameter
> which brakes compilation.
> 
> This patch add the properly checks to fix it.
> 
> Fixes: 46c264daaaa5 ("bridge/nl: remove wrong use of NLM_F_MULTI")
> 
> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

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

* Re: [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops pointers
  2015-07-10 15:34     ` Zhang, Helin
@ 2015-07-10 15:42       ` Thomas Monjalon
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Monjalon @ 2015-07-10 15:42 UTC (permalink / raw)
  To: Zhang, Helin; +Cc: dev

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

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

end of thread, other threads:[~2015-07-10 15:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25 19:09 [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 Miguel Bernal Marin
2015-06-25 19:09 ` [dpdk-dev] [PATCH 1/2] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
2015-06-25 19:09 ` [dpdk-dev] [PATCH 2/2] kni: fix header_ops " Miguel Bernal Marin
2015-06-25 21:56 ` [dpdk-dev] [PATCH 0/2] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
2015-06-26 14:36   ` Miguel Bernal Marin
2015-06-26 22:14 ` [dpdk-dev] [PATCH v2 0/4] " Miguel Bernal Marin
2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 1/4] kni: fix igb_ndo_bridge_getlink to build with 4.1 Miguel Bernal Marin
2015-07-10 15:41     ` Zhang, Helin
2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 2/4] kni: fix header_ops " Miguel Bernal Marin
2015-07-10 15:31     ` Zhang, Helin
2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 3/4] kni: fix function parameter from proto_ops pointers Miguel Bernal Marin
2015-07-10 15:34     ` Zhang, Helin
2015-07-10 15:42       ` Thomas Monjalon
2015-06-26 22:14   ` [dpdk-dev] [PATCH v2 4/4] kni: fix missing validation when vhost HDR is enabled Miguel Bernal Marin
2015-07-10 15:35     ` Zhang, Helin
2015-07-01 13:14   ` [dpdk-dev] [PATCH v2 0/4] kni: fix build with kernel 4.1 De Lara Guarch, Pablo
2015-07-10 10:00     ` 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).