From: Ferruh Yigit Date: Mon, 30 May 2016 11:22:32 +0000 (+0100) Subject: kni: fix build with kernel 4.7 X-Git-Tag: spdx-start~6841 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e2dc61c806e3681d1f12300d62df9dcd4402190f;p=dpdk.git kni: fix build with kernel 4.7 Fix compile error because of Linux API change, 'trans_start' field removed from 'struct net_device'. Linux: 9b36627acecd ("net: remove dev->trans_start") Signed-off-by: Ferruh Yigit --- diff --git a/lib/librte_eal/linuxapp/kni/compat.h b/lib/librte_eal/linuxapp/kni/compat.h index cf100b6742..0e939e4ee6 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 4095382755..076372c37b 100644 --- a/lib/librte_eal/linuxapp/kni/kni_net.c +++ b/lib/librte_eal/linuxapp/kni/kni_net.c @@ -38,6 +38,8 @@ #include #include + +#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)