DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7
@ 2016-05-30 11:22 Ferruh Yigit
  2016-05-30 11:22 ` [dpdk-dev] [PATCH 2/3] kni: compat.h syntax update Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ferruh Yigit @ 2016-05-30 11:22 UTC (permalink / raw)
  To: dev; +Cc: Helin Zhang, Ferruh Yigit

Fix compile error becuase of Linux API change, 'trans_start' field
removed from 'struct net_device'.

Linux: 9b36627acecd ("net: remove dev->trans_start")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_eal/linuxapp/kni/compat.h  | 4 ++++
 lib/librte_eal/linuxapp/kni/kni_net.c | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index cf100b6..0e939e4 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -27,3 +27,7 @@
 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) )
 #define HAVE_KIOCB_MSG_PARAM
 #endif /* < 4.1.0 */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
+#define HAVE_TRANS_START_HELPER
+#endif
diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index 4095382..076372c 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -38,6 +38,8 @@
 
 #include <exec-env/rte_kni_common.h>
 #include <kni_fifo.h>
+
+#include "compat.h"
 #include "kni_dev.h"
 
 #define WD_TIMEOUT 5 /*jiffies */
@@ -426,7 +428,12 @@ kni_net_tx(struct sk_buff *skb, struct net_device *dev)
 	struct rte_kni_mbuf *pkt_kva = NULL;
 	struct rte_kni_mbuf *pkt_va = NULL;
 
-	dev->trans_start = jiffies; /* save the timestamp */
+	/* save the timestamp */
+#ifdef HAVE_TRANS_START_HELPER
+	netif_trans_update(dev);
+#else
+	dev->trans_start = jiffies;
+#endif
 
 	/* Check if the length of skb is less than mbuf size */
 	if (skb->len > kni->mbuf_size)
-- 
2.5.5

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

* [dpdk-dev] [PATCH 2/3] kni: compat.h syntax update
  2016-05-30 11:22 [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7 Ferruh Yigit
@ 2016-05-30 11:22 ` Ferruh Yigit
  2016-05-30 11:22 ` [dpdk-dev] [PATCH 3/3] kni: move more kernel version check to compat header Ferruh Yigit
  2016-06-07  9:22 ` [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7 Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2016-05-30 11:22 UTC (permalink / raw)
  To: dev; +Cc: Helin Zhang, Ferruh Yigit

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_eal/linuxapp/kni/compat.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index 0e939e4..d10040d 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -14,19 +14,17 @@
 
 #endif /* < 2.6.39 */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
 #define sk_sleep(s) (s)->sk_sleep
+#endif
 
-#endif /* < 2.6.35 */
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
 #define HAVE_IOV_ITER_MSGHDR
 #endif
 
-#if ( LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) )
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
 #define HAVE_KIOCB_MSG_PARAM
-#endif /* < 4.1.0 */
+#endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
 #define HAVE_TRANS_START_HELPER
-- 
2.5.5

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

* [dpdk-dev] [PATCH 3/3] kni: move more kernel version check to compat header
  2016-05-30 11:22 [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7 Ferruh Yigit
  2016-05-30 11:22 ` [dpdk-dev] [PATCH 2/3] kni: compat.h syntax update Ferruh Yigit
@ 2016-05-30 11:22 ` Ferruh Yigit
  2016-06-07  9:22 ` [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7 Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2016-05-30 11:22 UTC (permalink / raw)
  To: dev; +Cc: Helin Zhang, Ferruh Yigit

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_eal/linuxapp/kni/compat.h   |  9 +++++++++
 lib/librte_eal/linuxapp/kni/kni_misc.c | 30 ++++++++++++++++--------------
 lib/librte_eal/linuxapp/kni/kni_net.c  |  8 ++++----
 3 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h
index d10040d..647ba3c 100644
--- a/lib/librte_eal/linuxapp/kni/compat.h
+++ b/lib/librte_eal/linuxapp/kni/compat.h
@@ -14,16 +14,25 @@
 
 #endif /* < 2.6.39 */
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
+#define HAVE_SIMPLIFIED_PERNET_OPERATIONS
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
 #define sk_sleep(s) (s)->sk_sleep
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
+#define HAVE_CHANGE_CARRIER_CB
+#endif
+
 #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
+#define HAVE_REBUILD_HEADER
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index e1ec443..4f34232 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -35,6 +35,8 @@
 #include <net/netns/generic.h>
 
 #include <exec-env/rte_kni_common.h>
+
+#include "compat.h"
 #include "kni_dev.h"
 
 MODULE_LICENSE("Dual BSD/GPL");
@@ -105,7 +107,7 @@ struct kni_net {
 
 static int __net_init kni_init_net(struct net *net)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
+#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 	struct kni_net *knet = net_generic(net, kni_net_id);
 #else
 	struct kni_net *knet;
@@ -116,7 +118,7 @@ static int __net_init kni_init_net(struct net *net)
 		ret = -ENOMEM;
 		return ret;
 	}
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) */
+#endif
 
 	/* Clear the bit of device in use */
 	clear_bit(KNI_DEV_IN_USE_BIT_NUM, &knet->device_in_use);
@@ -124,7 +126,7 @@ static int __net_init kni_init_net(struct net *net)
 	init_rwsem(&knet->kni_list_lock);
 	INIT_LIST_HEAD(&knet->kni_list_head);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
+#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 	return 0;
 #else
 	ret = net_assign_generic(net, kni_net_id, knet);
@@ -132,25 +134,25 @@ static int __net_init kni_init_net(struct net *net)
 		kfree(knet);
 
 	return ret;
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) */
+#endif
 }
 
 static void __net_exit kni_exit_net(struct net *net)
 {
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 32)
+#ifndef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 	struct kni_net *knet = net_generic(net, kni_net_id);
 
 	kfree(knet);
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) */
+#endif
 }
 
 static struct pernet_operations kni_net_ops = {
 	.init = kni_init_net,
 	.exit = kni_exit_net,
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
+#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 	.id   = &kni_net_id,
 	.size = sizeof(struct kni_net),
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) */
+#endif
 };
 
 static int __init
@@ -165,11 +167,11 @@ kni_init(void)
 		return -EINVAL;
 	}
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
+#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 	rc = register_pernet_subsys(&kni_net_ops);
 #else
 	rc = register_pernet_gen_subsys(&kni_net_id, &kni_net_ops);
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) */
+#endif
 	if (rc)
 		return -EPERM;
 
@@ -187,11 +189,11 @@ kni_init(void)
 	return 0;
 
 out:
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
+#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 	unregister_pernet_subsys(&kni_net_ops);
 #else
 	register_pernet_gen_subsys(&kni_net_id, &kni_net_ops);
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) */
+#endif
 	return rc;
 }
 
@@ -199,11 +201,11 @@ static void __exit
 kni_exit(void)
 {
 	misc_deregister(&kni_misc);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
+#ifdef HAVE_SIMPLIFIED_PERNET_OPERATIONS
 	unregister_pernet_subsys(&kni_net_ops);
 #else
 	register_pernet_gen_subsys(&kni_net_id, &kni_net_ops);
-#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32) */
+#endif
 	KNI_PRINT("####### DPDK kni module unloaded  #######\n");
 }
 
diff --git a/lib/librte_eal/linuxapp/kni/kni_net.c b/lib/librte_eal/linuxapp/kni/kni_net.c
index 076372c..fc82193 100644
--- a/lib/librte_eal/linuxapp/kni/kni_net.c
+++ b/lib/librte_eal/linuxapp/kni/kni_net.c
@@ -641,7 +641,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))
+#ifdef HAVE_REBUILD_HEADER
 static int
 kni_net_rebuild_header(struct sk_buff *skb)
 {
@@ -671,7 +671,7 @@ static int kni_net_set_mac(struct net_device *netdev, void *p)
 	return 0;
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0))
+#ifdef HAVE_CHANGE_CARRIER_CB
 static int kni_net_change_carrier(struct net_device *dev, bool new_carrier)
 {
 	if (new_carrier)
@@ -684,7 +684,7 @@ 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))
+#ifdef HAVE_REBUILD_HEADER
 	.rebuild = kni_net_rebuild_header,
 #endif /* < 4.1.0  */
 	.cache   = NULL,  /* disable caching */
@@ -701,7 +701,7 @@ static const struct net_device_ops kni_net_netdev_ops = {
 	.ndo_get_stats = kni_net_stats,
 	.ndo_tx_timeout = kni_net_tx_timeout,
 	.ndo_set_mac_address = kni_net_set_mac,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0))
+#ifdef HAVE_CHANGE_CARRIER_CB
 	.ndo_change_carrier = kni_net_change_carrier,
 #endif
 };
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7
  2016-05-30 11:22 [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7 Ferruh Yigit
  2016-05-30 11:22 ` [dpdk-dev] [PATCH 2/3] kni: compat.h syntax update Ferruh Yigit
  2016-05-30 11:22 ` [dpdk-dev] [PATCH 3/3] kni: move more kernel version check to compat header Ferruh Yigit
@ 2016-06-07  9:22 ` Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-06-07  9:22 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Helin Zhang

2016-05-30 12:22, Ferruh Yigit:
> Fix compile error becuase of Linux API change, 'trans_start' field
> removed from 'struct net_device'.
> 
> Linux: 9b36627acecd ("net: remove dev->trans_start")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Series applied, thanks

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

end of thread, other threads:[~2016-06-07  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-30 11:22 [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7 Ferruh Yigit
2016-05-30 11:22 ` [dpdk-dev] [PATCH 2/3] kni: compat.h syntax update Ferruh Yigit
2016-05-30 11:22 ` [dpdk-dev] [PATCH 3/3] kni: move more kernel version check to compat header Ferruh Yigit
2016-06-07  9:22 ` [dpdk-dev] [PATCH 1/3] kni: fix compile error for Linux 4.7 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).