DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: fix build with kernel < 3.3 with netdev_features_t backport
@ 2013-07-26 11:25 Adrien Mazarguil
  2013-07-26 13:21 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Adrien Mazarguil @ 2013-07-26 11:25 UTC (permalink / raw)
  To: dev

The netdev_features_t typedef appeared in Linux 3.3, but checking the kernel
version isn't enough with some distributions (such as Debian Wheezy) that
backported it into 3.2, causing a compilation failure due to redefinition.

Since the presence of a typedef can't be tested at compile time, this commit
adds type kni_netdev_features_t, which, depending on the kernel version,
translates either to u32 or netdev_features_t.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c  | 6 +++---
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h   | 3 ++-
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h | 3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)

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 f0728bb..9d772fa 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -1831,8 +1831,8 @@ void igb_reset(struct igb_adapter *adapter)
 }
 
 #ifdef HAVE_NDO_SET_FEATURES
-static netdev_features_t igb_fix_features(struct net_device *netdev,
-					  netdev_features_t features)
+static kni_netdev_features_t igb_fix_features(struct net_device *netdev,
+					      kni_netdev_features_t features)
 {
 	/*
 	 * Since there is no support for separate tx vlan accel
@@ -1849,7 +1849,7 @@ static netdev_features_t igb_fix_features(struct net_device *netdev,
 }
 
 static int igb_set_features(struct net_device *netdev,
-			    netdev_features_t features)
+			    kni_netdev_features_t features)
 {
 	u32 changed = netdev->features ^ features;
 
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index 553e1c0..a2aa361 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3012,8 +3012,9 @@ static inline void __kc_skb_frag_unref(skb_frag_t *frag)
 
 /*****************************************************************************/
 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) )
-typedef u32 netdev_features_t;
+typedef u32 kni_netdev_features_t;
 #else /* ! < 3.3.0 */
+typedef netdev_features_t kni_netdev_features_t;
 #define HAVE_INT_NDO_VLAN_RX_ADD_VID
 #ifdef ETHTOOL_SRXNTUPLE
 #undef ETHTOOL_SRXNTUPLE
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index a0e0698..6ac890a 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -3078,8 +3078,9 @@ static inline void __kc_skb_frag_unref(skb_frag_t *frag)
 
 /*****************************************************************************/
 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) )
-typedef u32 netdev_features_t;
+typedef u32 kni_netdev_features_t;
 #else /* ! < 3.3.0 */
+typedef netdev_features_t kni_netdev_features_t;
 #define HAVE_INT_NDO_VLAN_RX_ADD_VID
 #ifdef ETHTOOL_SRXNTUPLE
 #undef ETHTOOL_SRXNTUPLE
-- 
1.7.12

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

* Re: [dpdk-dev] [PATCH] kni: fix build with kernel < 3.3 with netdev_features_t backport
  2013-07-26 11:25 [dpdk-dev] [PATCH] kni: fix build with kernel < 3.3 with netdev_features_t backport Adrien Mazarguil
@ 2013-07-26 13:21 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2013-07-26 13:21 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: dev

26/07/2013 13:25, Adrien Mazarguil :
> The netdev_features_t typedef appeared in Linux 3.3, but checking the
> kernel version isn't enough with some distributions (such as Debian
> Wheezy) that backported it into 3.2, causing a compilation failure due to
> redefinition.
> 
> Since the presence of a typedef can't be tested at compile time, this
> commit adds type kni_netdev_features_t, which, depending on the kernel
> version, translates either to u32 or netdev_features_t.
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

acked and applied

-- 
Thomas

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

end of thread, other threads:[~2013-07-26 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-26 11:25 [dpdk-dev] [PATCH] kni: fix build with kernel < 3.3 with netdev_features_t backport Adrien Mazarguil
2013-07-26 13:21 ` 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).