Skip to contentSkip to conversation

build fixes for recent distros

PATCH Superseded Thomas Monjalon 2 participants 20 messages Jul 29, 2013 – Sep 16, 2013 12 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover build fixes for recent distros

KNI is an out-of-tree kernel driver, so it needs some updates to follow recent API changes in Linux.

There is also a patch to build with latest GCC.

Needless to say, these patches are totally useless for Debian users :)

---

Thomas Monjalon (4):
kni: fix build with kernel 3.8
kni: fix build with kernel 3.9
kni: fix build with kernel 3.10
app: fix build with gcc 4.8

 app/test/test_cmdline_string.c                     |    2 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h      |   17 -
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |  507 ++------------------
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |   46 +-
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h  |    6 +-
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c     |   14 +-
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c        |   16 +-
 .../linuxapp/kni/ethtool/ixgbe/kcompat.h           |   51 +-
 8 files changed, 132 insertions(+), 527 deletions(-)
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): cover.1375101416.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 1/4 kni: fix build with kernel 3.8

- timecompare has been removed.
(see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c)

- annotations __devinit and __devexit have been removed.

---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h      |   17 -
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |  460 --------------------
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |   20 +
 3 files changed, 20 insertions(+), 477 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h +0 -17
index 3cebff5..ea120af 100644
@@ -44,12 +44,6 @@
 #include <linux/ethtool.h>
 #endif
 
-#ifdef HAVE_HW_TIME_STAMP
-#include <linux/clocksource.h>
-#include <linux/timecompare.h>
-#include <linux/net_tstamp.h>
-
-#endif
 struct igb_adapter;
 
 #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
@@ -59,11 +53,6 @@ struct igb_adapter;
 #include <linux/dca.h>
 #endif
 
-#ifndef HAVE_HW_TIME_STAMP
-#undef IGB_PER_PKT_TIMESTAMP
-#endif
-
-
 #include "kcompat.h"
 
 #ifdef HAVE_SCTP
@@ -505,12 +494,6 @@ struct igb_adapter {
 #ifndef IGB_NO_LRO
 	struct igb_lro_stats lro_stats;
 #endif
-#ifdef HAVE_HW_TIME_STAMP
-	struct cyclecounter cycles;
-	struct timecounter clock;
-	struct timecompare compare;
-	struct hwtstamp_config hwtstamp_config;
-#endif
 
 	/* structs defined in e1000_hw.h */
 	struct e1000_hw hw;
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +0 -460

537 lines not on this page · raw message

lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +20 -0
index a2aa361..8af7e22 100644
@@ -3040,4 +3040,24 @@ typedef netdev_features_t kni_netdev_features_t;
 #else
 #define HAVE_FDB_OPS
 #endif /* < 3.5.0 */
+
+/*****************************************************************************/
+/* 3.8 */
+
+#ifndef __devinit
+#define __devinit
+#endif
+
+#ifndef __devinitdata
+#define __devinitdata
+#endif
+
+#ifndef __devexit
+#define __devexit
+#endif
+
+#ifndef __devexit_p
+#define __devexit_p
+#endif
+
 #endif /* _KCOMPAT_H_ */
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 43d7bb3e9a8b8c379c69c782370aa2fbce47398d.1375101416.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH 1/4] kni: fix build with kernel 3.8

Quoted 2 lines · Thomas Monjalon

- timecompare has been removed.
(see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c)

All this code is between 'ifdef HAVE_HW_TIME_STAMP'. Maybe just deactivating it will help to port patches on this driver in the future.

Quoted 2 lines

- annotations __devinit and __devexit have been removed.

Done in 54b956b90360 Remove __dev* markings from init.h

#5 lore raw

PATCH 2/4 kni: fix build with kernel 3.9

In reply to a message not in the archive

hlist API has changes.
See Linux commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a.

---
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c     |   12 +++---
 .../linuxapp/kni/ethtool/ixgbe/kcompat.h           |   39 +++++++++++++-------
 2 files changed, 32 insertions(+), 19 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c +6 -6
index 11472bd..fcff294 100644
@@ -2294,13 +2294,13 @@ static int ixgbe_get_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 	union ixgbe_atr_input *mask = &adapter->fdir_mask;
 	struct ethtool_rx_flow_spec *fsp =
 		(struct ethtool_rx_flow_spec *)&cmd->fs;
-	struct hlist_node *node, *node2;
+	struct hlist_node *node;
 	struct ixgbe_fdir_filter *rule = NULL;
 
 	/* report total rule count */
 	cmd->data = (1024 << adapter->fdir_pballoc) - 2;
 
-	hlist_for_each_entry_safe(rule, node, node2,
+	hlist_for_each_entry_safe(rule, node,
 				  &adapter->fdir_filter_list, fdir_node) {
 		if (fsp->location <= rule->sw_idx)
 			break;
@@ -2361,14 +2361,14 @@ static int ixgbe_get_ethtool_fdir_all(struct ixgbe_adapter *adapter,
 				      struct ethtool_rxnfc *cmd,
 				      u32 *rule_locs)
 {
-	struct hlist_node *node, *node2;
+	struct hlist_node *node;
 	struct ixgbe_fdir_filter *rule;
 	int cnt = 0;
 
 	/* report total rule count */
 	cmd->data = (1024 << adapter->fdir_pballoc) - 2;
 
-	hlist_for_each_entry_safe(rule, node, node2,
+	hlist_for_each_entry_safe(rule, node,
 				  &adapter->fdir_filter_list, fdir_node) {
 		if (cnt == cmd->rule_cnt)
 			return -EMSGSIZE;
@@ -2464,14 +2464,14 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 					   u16 sw_idx)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	struct hlist_node *node, *node2, *parent;
+	struct hlist_node *node, *parent;
 	struct ixgbe_fdir_filter *rule;
 	int err = -EINVAL;
 
 	parent = NULL;
 	rule = NULL;
 
-	hlist_for_each_entry_safe(rule, node, node2,
+	hlist_for_each_entry_safe(rule, node,
 				  &adapter->fdir_filter_list, fdir_node) {
 		/* hash found, or no matching entry */
 		if (rule->sw_idx >= sw_idx)
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h +26 -13
index 6ac890a..925beeb 100644
@@ -1213,19 +1213,6 @@ static inline void INIT_HLIST_NODE(struct hlist_node *h)
 	h->next = NULL;
 	h->pprev = NULL;
 }
-#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
-
-#define hlist_for_each_entry(tpos, pos, head, member)                    \
-	for (pos = (head)->first;                                        \
-	     pos && ({ prefetch(pos->next); 1;}) &&                      \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = pos->next)
-
-#define hlist_for_each_entry_safe(tpos, pos, n, head, member)            \
-	for (pos = (head)->first;                                        \
-	     pos && ({ n = pos->next; 1; }) &&                           \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = n)
 
 #ifndef might_sleep
 #define might_sleep()
@@ -3106,4 +3093,30 @@ typedef netdev_features_t kni_netdev_features_t;
 #else
 #define HAVE_FDB_OPS
 #endif /* < 3.5.0 */
+
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) )
+
+#undef  hlist_entry
+#define hlist_entry(ptr, type, member) \
+	container_of(ptr,type,member)
+
+#undef  hlist_entry_safe
+#define hlist_entry_safe(ptr, type, member) \
+	(ptr) ? hlist_entry(ptr, type, member) : NULL
+
+#undef  hlist_for_each_entry
+#define hlist_for_each_entry(pos, head, member) \
+	for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
+	     pos;                                                           \
+	     pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
+
+#undef  hlist_for_each_entry_safe
+#define hlist_for_each_entry_safe(pos, n, head, member) \
+	for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \
+	     pos && ({ n = pos->member.next; 1; });                       \
+	     pos = hlist_entry_safe(n, typeof(*pos), member))
+
+#endif /* < 3.9.0 */
+
 #endif /* _KCOMPAT_H_ */
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 97597bb012c4142e522f2e127b8e10dd3b59f331.1375101416.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

PATCH 3/4 kni: fix build with kernel 3.10

In reply to a message not in the archive

- The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*. See Linux commit f646968f8f7c624587de729115d802372b9063dd.

- The VLAN protocol must be specified.
See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c and 80d5c3689b886308247da295a228a54df49a44f6.

---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |   47 +++++++++++++-------
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |   26 ++++++++++-
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h  |    6 +--
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c     |    2 +-
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c        |   16 +++----
 .../linuxapp/kni/ethtool/ixgbe/kcompat.h           |   12 ++++-
 6 files changed, 79 insertions(+), 30 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +31 -16
index 4462464..d687412 100644
@@ -148,7 +148,10 @@ static void igb_reset_task(struct work_struct *);
 #ifdef HAVE_VLAN_RX_REGISTER
 static void igb_vlan_mode(struct net_device *, struct vlan_group *);
 #endif
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
+static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
 static int igb_vlan_rx_add_vid(struct net_device *, u16);
 static int igb_vlan_rx_kill_vid(struct net_device *, u16);
 #else
@@ -1807,8 +1810,8 @@ static kni_netdev_features_t igb_fix_features(struct net_device *netdev,
 	 * Since there is no support for separate tx vlan accel
 	 * enabled make sure tx flag is cleared if rx is.
 	 */
-	if (!(features & NETIF_F_HW_VLAN_RX))
-		features &= ~NETIF_F_HW_VLAN_TX;
+	if (!(features & NETIF_F_HW_VLAN_CTAG_RX))
+		features &= ~NETIF_F_HW_VLAN_CTAG_TX;
 
 	/* If Rx checksum is disabled, then LRO should also be disabled */
 	if (!(features & NETIF_F_RXCSUM))
@@ -1822,7 +1825,7 @@ static int igb_set_features(struct net_device *netdev,
 {
 	u32 changed = netdev->features ^ features;
 
-	if (changed & NETIF_F_HW_VLAN_RX)
+	if (changed & NETIF_F_HW_VLAN_CTAG_RX)
 		igb_vlan_mode(netdev, features);
 
 	return 0;
@@ -1898,7 +1901,7 @@ void igb_assign_vmdq_netdev_ops(struct net_device *vnetdev)
 #ifdef HAVE_TX_TIMEOUT
 	dev->tx_timeout = &igb_vmdq_tx_timeout;
 #endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 	dev->vlan_rx_register = &igb_vmdq_vlan_rx_register;
 	dev->vlan_rx_add_vid = &igb_vmdq_vlan_rx_add_vid;
 	dev->vlan_rx_kill_vid = &igb_vmdq_vlan_rx_kill_vid;
@@ -2138,8 +2141,8 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 #ifdef HAVE_NDO_SET_FEATURES
 			    NETIF_F_RXCSUM |
 #endif
-			    NETIF_F_HW_VLAN_RX |
-			    NETIF_F_HW_VLAN_TX;
+			    NETIF_F_HW_VLAN_CTAG_RX |
+			    NETIF_F_HW_VLAN_CTAG_TX;
 
 #ifdef HAVE_NDO_SET_FEATURES
 	/* copy netdev features into list of user selectable features */
@@ -2158,7 +2161,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 #endif
 
 	/* set this bit last since it cannot be part of hw_features */
-	netdev->features |= NETIF_F_HW_VLAN_FILTER;
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
 #ifdef HAVE_NETDEV_VLAN_FEATURES
 	netdev->vlan_features |= NETIF_F_TSO |
@@ -6409,7 +6412,7 @@ static void igb_rx_vlan(struct igb_ring *ring,
 	} else {
 		IGB_CB(skb)->vid = 0;
 #else
-		__vlan_hwaccel_put_tag(skb, vid);
+		__kc__vlan_hwaccel_put_tag(skb, vid);
 #endif
 	}
 }
@@ -7271,7 +7274,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
 	if (!test_bit(__IGB_DOWN, &adapter->state))
 		igb_irq_enable(adapter);
 #else
-	bool enable = !!(features & NETIF_F_HW_VLAN_RX);
+	bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
 #endif
 
 	if (enable) {
@@ -7311,7 +7314,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
 #else
 		struct net_device *vnetdev;
 		vnetdev = adapter->vmdq_netdev[i-1];
-		enable = !!(vnetdev->features & NETIF_F_HW_VLAN_RX);
+		enable = !!(vnetdev->features & NETIF_F_HW_VLAN_CTAG_RX);
 #endif
 		igb_set_vf_vlan_strip(adapter, 
 				      adapter->vfs_allocated_count + i,
@@ -7322,7 +7325,9 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
 	igb_rlpml_set(adapter);
 }
 
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
 static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
 #else
 static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
@@ -7361,7 +7366,9 @@ static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
 #endif
 }
 
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
 static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
 #else
 static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
@@ -7405,7 +7412,11 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
 		for (vid = 0; vid < VLAN_N_VID; vid++) {
 			if (!vlan_group_get_device(adapter->vlgrp, vid))
 				continue;
+#ifdef HAVE_VLAN_PROTO
+			igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
 			igb_vlan_rx_add_vid(adapter->netdev, vid);
+#endif
 		}
 	}
 #else
@@ -7414,8 +7425,12 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
 	igb_vlan_mode(adapter->netdev, adapter->netdev->features);
 
 	for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
+#ifdef HAVE_VLAN_PROTO
+		igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
 		igb_vlan_rx_add_vid(adapter->netdev, vid);
 #endif
+#endif
 }
 
 int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx)
@@ -8404,8 +8419,8 @@ int igb_kni_probe(struct pci_dev *pdev,
 #ifdef HAVE_NDO_SET_FEATURES
 			    NETIF_F_RXCSUM |
 #endif
-			    NETIF_F_HW_VLAN_RX |
-			    NETIF_F_HW_VLAN_TX;
+			    NETIF_F_HW_VLAN_CTAG_RX |
+			    NETIF_F_HW_VLAN_CTAG_TX;
 
 #ifdef HAVE_NDO_SET_FEATURES
 	/* copy netdev features into list of user selectable features */
@@ -8424,7 +8439,7 @@ int igb_kni_probe(struct pci_dev *pdev,
 #endif
 
 	/* set this bit last since it cannot be part of hw_features */
-	netdev->features |= NETIF_F_HW_VLAN_FILTER;
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
 #ifdef HAVE_NETDEV_VLAN_FEATURES
 	netdev->vlan_features |= NETIF_F_TSO |
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +25 -1
index 8af7e22..5b33e90 100644
@@ -287,7 +287,17 @@ struct msix_entry {
 #define IS_ALIGNED(x,a)         (((x) % ((typeof(x))(a))) == 0)
 #endif
 
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX     && defined NETIF_F_HW_VLAN_TX
+#define      NETIF_F_HW_VLAN_CTAG_TX                NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX     && defined NETIF_F_HW_VLAN_RX
+#define      NETIF_F_HW_VLAN_CTAG_RX                NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define      NETIF_F_HW_VLAN_CTAG_FILTER            NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
 struct _kc_vlan_ethhdr {
 	unsigned char	h_dest[ETH_ALEN];
 	unsigned char	h_source[ETH_ALEN];
@@ -3060,4 +3070,18 @@ typedef netdev_features_t kni_netdev_features_t;
 #define __devexit_p
 #endif
 
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) )
+
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+	__vlan_hwaccel_put_tag(skb, vlan_tci)
+
+#else
+
+#define HAVE_VLAN_PROTO
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+	__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci)
+
+#endif /* < 3.10.0 */
+
 #endif /* _KCOMPAT_H_ */
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h +3 -3
index 222c2c7..eb15858 100644
@@ -42,7 +42,7 @@
 #ifdef SIOCETHTOOL
 #include <linux/ethtool.h>
 #endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 #include <linux/if_vlan.h>
 #endif
 #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
@@ -549,13 +549,13 @@ struct ixgbe_therm_proc_data {
 
 /* board specific private data structure */
 struct ixgbe_adapter {
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 #ifdef HAVE_VLAN_RX_REGISTER
 	struct vlan_group *vlgrp; /* must be first, see ixgbe_receive_skb */
 #else
 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
 #endif
-#endif /* NETIF_F_HW_VLAN_TX */
+#endif /* NETIF_F_HW_VLAN_CTAG_TX */
 	/* OS defined structs */
 	struct net_device *netdev;
 	struct pci_dev *pdev;
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c +1 -1
index fcff294..4bda1fb 100644
@@ -2162,7 +2162,7 @@ static int ixgbe_set_tso(struct net_device *netdev, u32 data)
 #endif
 	} else {
 #ifndef HAVE_NETDEV_VLAN_FEATURES
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 		struct ixgbe_adapter *adapter = netdev_priv(netdev);
 		/* disable TSO on all VLANs if they're present */
 		if (adapter->vlgrp) {
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c +8 -8
index 947be44..1f7c9f2 100755
@@ -331,7 +331,7 @@ void ixgbe_vlan_mode(struct net_device *netdev, u32 features)
 #ifdef HAVE_VLAN_RX_REGISTER
 	enable = (grp || (adapter->flags & IXGBE_FLAG_DCB_ENABLED));
 #else
-	enable = !!(features & NETIF_F_HW_VLAN_RX);
+	enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
 #endif
 	if (enable)
 		/* enable VLAN tag insert/strip */
@@ -629,7 +629,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
 				vmolr |= IXGBE_VMOLR_ROMPE;
 			}
 		}
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 		/* enable hardware vlan filtering */
 		vlnctrl |= IXGBE_VLNCTRL_VFE;
 #endif
@@ -812,7 +812,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
 	ixgbe_configure_dcb(adapter);
 
 	ixgbe_set_rx_mode(adapter->netdev);
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 	ixgbe_restore_vlan(adapter);
 #endif
 
@@ -2514,9 +2514,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
 	netdev->features |= NETIF_F_IPV6_CSUM;
 #endif
 
-#ifdef NETIF_F_HW_VLAN_TX
-	netdev->features |= NETIF_F_HW_VLAN_TX |
-			    NETIF_F_HW_VLAN_RX;
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_TX |
+			    NETIF_F_HW_VLAN_CTAG_RX;
 #endif
 #ifdef NETIF_F_TSO
 	netdev->features |= NETIF_F_TSO;
@@ -2548,9 +2548,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
 #endif /* NETIF_F_GRO */
 #endif
 
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 	/* set this bit last since it cannot be part of hw_features */
-	netdev->features |= NETIF_F_HW_VLAN_FILTER;
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 #endif
 	switch (adapter->hw.mac.type) {
 	case ixgbe_mac_82599EB:
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h +11 -1
index 925beeb..740579e 100644
@@ -304,7 +304,17 @@ struct msix_entry {
 #define IS_ALIGNED(x,a)         (((x) % ((typeof(x))(a))) == 0)
 #endif
 
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX     && defined NETIF_F_HW_VLAN_TX
+#define      NETIF_F_HW_VLAN_CTAG_TX                NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX     && defined NETIF_F_HW_VLAN_RX
+#define      NETIF_F_HW_VLAN_CTAG_RX                NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define      NETIF_F_HW_VLAN_CTAG_FILTER            NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
 struct _kc_vlan_ethhdr {
 	unsigned char	h_dest[ETH_ALEN];
 	unsigned char	h_source[ETH_ALEN];
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): c0332cb4401728a101b8d69ea86092b6dfd26166.1375101416.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

#12 lore raw

Re: [PATCH 3/4] kni: fix build with kernel 3.10

Quoted 8 lines · Thomas Monjalon

- The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*. See Linux commit f646968f8f7c624587de729115d802372b9063dd.

- The VLAN protocol must be specified.
See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c and 80d5c3689b886308247da295a228a54df49a44f6.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [PATCH 3/4] kni: fix build with kernel 3.10

12/09/2013 18:09, Nicolas Dichtel :

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

- The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*. See Linux commit f646968f8f7c624587de729115d802372b9063dd.

Quoted 7 lines
Quoted 5 lines

- The VLAN protocol must be specified.
See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c and 80d5c3689b886308247da295a228a54df49a44f6.

pushed

Signature · 1 line
Thomas
#15 lore raw

PATCH 4/4 app: fix build with gcc 4.8

In reply to a message not in the archive

GCC 4.8 was producing this error:
argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the second source; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]

---
 app/test/test_cmdline_string.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cmdline_string.c +1 -1
index 7b358cf..84a82ce 100644
@@ -383,7 +383,7 @@ test_parse_string_valid(void)
 			return -1;
 		}
 		if (strncmp(buf, string_elt_strs[i].result,
-				sizeof(string_elt_strs[i].result)) != 0) {
+				sizeof(buf)) != 0) {
 			printf("Error: result mismatch!\n");
 			return -1;
 		}
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 6c57bdadc99eb8febc7344c7dfbbccde8aa42734.1375101416.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

#17 lore raw

Re: [PATCH 4/4] app: fix build with gcc 4.8

Quoted 15 lines · Thomas Monjalon

GCC 4.8 was producing this error:
argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the second source; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]

---
  app/test/test_cmdline_string.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cmdline_string.c +0 -0
index 7b358cf..84a82ce 100644

app/test/test_cmdline_string.c test_parse_string_valid(void) · line 386

Quoted 5 lines
app/test/test_cmdline_string.c +1 -1
@@ -383,7 +383,7 @@ test_parse_string_valid(void)
  			return -1;
  		}
  		if (strncmp(buf, string_elt_strs[i].result,
-				sizeof(string_elt_strs[i].result)) != 0) {
+				sizeof(buf)) != 0) {

In fact, it seems you can use strcmp() instead of strncmp(). Or, if the intention was really to check the length, use strlen(), but this one will not include the last '\0'.

#18 lore raw

v2 cover build fixes for recent distros

In reply to a message not in the archive

KNI is an out-of-tree kernel driver, so it needs some updates to follow recent API changes in Linux.

There is also a patch to build with latest GCC.

v2 changes:
* for kernel 3.8
- undef HAVE_HW_TIME_STAMP instead of removing code
* for gcc 4.8
- use strncmp instead of strncmp

---

Thomas Monjalon (4):
kni: fix build with kernel 3.8
kni: fix build with kernel 3.9
kni: fix build with kernel 3.10
app: fix build with gcc 4.8

 app/test/test_cmdline_string.c                     |    3 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h      |    5 +-
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |   47 ++++++++++++------
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |   49 ++++++++++++++++++-
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h  |    6 +--
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c     |   14 +++---
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c        |   16 +++---
 .../linuxapp/kni/ethtool/ixgbe/kcompat.h           |   51 ++++++++++++++------
 8 files changed, 137 insertions(+), 54 deletions(-)

A message that is not in the archive (sent off-list or not yet received): cover.1379081595.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

#20 lore raw

PATCH v2 1/4 kni: fix build with kernel 3.8

- timecompare (used for hardware timestamping) has been removed. (see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c) Simply disable HW_TIME_STAMP feature because it is not used by KNI. For this purpose, kcompat.h must be included before testing for HAVE_HW_TIME_STAMP.

- annotations __devinit and __devexit have been removed. (see Linux commit 54b956b903607f8f8878754dd4352da6a54a1da2)

---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h     |    5 ++---
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h |   23 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/igb/igb.h +2 -3
index 3cebff5..5567a6c 100644
@@ -30,6 +30,8 @@
 #ifndef _IGB_H_
 #define _IGB_H_
 
+#include "kcompat.h"
+
 #include <linux/kobject.h>
 
 #ifndef IGB_NO_LRO
@@ -63,9 +65,6 @@ struct igb_adapter;
 #undef IGB_PER_PKT_TIMESTAMP
 #endif
 
-
-#include "kcompat.h"
-
 #ifdef HAVE_SCTP
 #include <linux/sctp.h>
 #endif
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +23 -0
index a2aa361..f6e82c1 100644
@@ -3040,4 +3040,27 @@ typedef netdev_features_t kni_netdev_features_t;
 #else
 #define HAVE_FDB_OPS
 #endif /* < 3.5.0 */
+
+/*****************************************************************************/
+/* 3.8 */
+
+/* timecompare has been removed and HW_TIME_STAMP is not used by KNI ethtool */
+#undef HAVE_HW_TIME_STAMP
+
+#ifndef __devinit
+#define __devinit
+#endif
+
+#ifndef __devinitdata
+#define __devinitdata
+#endif
+
+#ifndef __devexit
+#define __devexit
+#endif
+
+#ifndef __devexit_p
+#define __devexit_p
+#endif
+
 #endif /* _KCOMPAT_H_ */
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 95c752508913ea02f74b36c53eb7d5ae88a29dc0.1379081595.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

#22 lore raw

Re: [PATCH v2 1/4] kni: fix build with kernel 3.8

Quoted 11 lines · Thomas Monjalon

- timecompare (used for hardware timestamping) has been removed. (see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c) Simply disable HW_TIME_STAMP feature because it is not used by KNI. For this purpose, kcompat.h must be included before testing for HAVE_HW_TIME_STAMP.

- annotations __devinit and __devexit have been removed. (see Linux commit 54b956b903607f8f8878754dd4352da6a54a1da2)

A message that is not in the archive (sent off-list or not yet received): [email protected]

#24 lore raw

Re: [PATCH v2 1/4] kni: fix build with kernel 3.8

16/09/2013 13:21, Nicolas Dichtel :

Quoted 7 lines · Thomas Monjalon
Quoted 6 lines

- timecompare (used for hardware timestamping) has been removed. (see Linux commit 65f8f9a1c1db831e5159e3e3e50912d1f214cd0c) Simply disable HW_TIME_STAMP feature because it is not used by KNI. For this purpose, kcompat.h must be included before testing for HAVE_HW_TIME_STAMP.

Quoted 7 lines
Quoted 5 lines

- annotations __devinit and __devexit have been removed. (see Linux commit 54b956b903607f8f8878754dd4352da6a54a1da2)

pushed, thanks for the review

Signature · 1 line
Thomas
#25 lore raw

PATCH v2 2/4 kni: fix build with kernel 3.9

In reply to a message not in the archive

hlist API has changes.
See Linux commit b67bfe0d42cac56c512dd5da4b1b347a23f4b70a.

---
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c     |   12 +++---
 .../linuxapp/kni/ethtool/ixgbe/kcompat.h           |   39 +++++++++++++-------
 2 files changed, 32 insertions(+), 19 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c +6 -6
index 11472bd..fcff294 100644
@@ -2294,13 +2294,13 @@ static int ixgbe_get_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 	union ixgbe_atr_input *mask = &adapter->fdir_mask;
 	struct ethtool_rx_flow_spec *fsp =
 		(struct ethtool_rx_flow_spec *)&cmd->fs;
-	struct hlist_node *node, *node2;
+	struct hlist_node *node;
 	struct ixgbe_fdir_filter *rule = NULL;
 
 	/* report total rule count */
 	cmd->data = (1024 << adapter->fdir_pballoc) - 2;
 
-	hlist_for_each_entry_safe(rule, node, node2,
+	hlist_for_each_entry_safe(rule, node,
 				  &adapter->fdir_filter_list, fdir_node) {
 		if (fsp->location <= rule->sw_idx)
 			break;
@@ -2361,14 +2361,14 @@ static int ixgbe_get_ethtool_fdir_all(struct ixgbe_adapter *adapter,
 				      struct ethtool_rxnfc *cmd,
 				      u32 *rule_locs)
 {
-	struct hlist_node *node, *node2;
+	struct hlist_node *node;
 	struct ixgbe_fdir_filter *rule;
 	int cnt = 0;
 
 	/* report total rule count */
 	cmd->data = (1024 << adapter->fdir_pballoc) - 2;
 
-	hlist_for_each_entry_safe(rule, node, node2,
+	hlist_for_each_entry_safe(rule, node,
 				  &adapter->fdir_filter_list, fdir_node) {
 		if (cnt == cmd->rule_cnt)
 			return -EMSGSIZE;
@@ -2464,14 +2464,14 @@ static int ixgbe_update_ethtool_fdir_entry(struct ixgbe_adapter *adapter,
 					   u16 sw_idx)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	struct hlist_node *node, *node2, *parent;
+	struct hlist_node *node, *parent;
 	struct ixgbe_fdir_filter *rule;
 	int err = -EINVAL;
 
 	parent = NULL;
 	rule = NULL;
 
-	hlist_for_each_entry_safe(rule, node, node2,
+	hlist_for_each_entry_safe(rule, node,
 				  &adapter->fdir_filter_list, fdir_node) {
 		/* hash found, or no matching entry */
 		if (rule->sw_idx >= sw_idx)
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h +26 -13
index 6ac890a..925beeb 100644
@@ -1213,19 +1213,6 @@ static inline void INIT_HLIST_NODE(struct hlist_node *h)
 	h->next = NULL;
 	h->pprev = NULL;
 }
-#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
-
-#define hlist_for_each_entry(tpos, pos, head, member)                    \
-	for (pos = (head)->first;                                        \
-	     pos && ({ prefetch(pos->next); 1;}) &&                      \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = pos->next)
-
-#define hlist_for_each_entry_safe(tpos, pos, n, head, member)            \
-	for (pos = (head)->first;                                        \
-	     pos && ({ n = pos->next; 1; }) &&                           \
-		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
-	     pos = n)
 
 #ifndef might_sleep
 #define might_sleep()
@@ -3106,4 +3093,30 @@ typedef netdev_features_t kni_netdev_features_t;
 #else
 #define HAVE_FDB_OPS
 #endif /* < 3.5.0 */
+
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) )
+
+#undef  hlist_entry
+#define hlist_entry(ptr, type, member) \
+	container_of(ptr,type,member)
+
+#undef  hlist_entry_safe
+#define hlist_entry_safe(ptr, type, member) \
+	(ptr) ? hlist_entry(ptr, type, member) : NULL
+
+#undef  hlist_for_each_entry
+#define hlist_for_each_entry(pos, head, member) \
+	for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \
+	     pos;                                                           \
+	     pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
+
+#undef  hlist_for_each_entry_safe
+#define hlist_for_each_entry_safe(pos, n, head, member) \
+	for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \
+	     pos && ({ n = pos->member.next; 1; });                       \
+	     pos = hlist_entry_safe(n, typeof(*pos), member))
+
+#endif /* < 3.9.0 */
+
 #endif /* _KCOMPAT_H_ */
Signature · 1 line
1.7.10.4
#26 lore raw

PATCH v2 3/4 kni: fix build with kernel 3.10

In reply to a message not in the archive

- The flags NETIF_F_HW_VLAN_* have been renamed to NETIF_F_HW_VLAN_CTAG_*. See Linux commit f646968f8f7c624587de729115d802372b9063dd.

- The VLAN protocol must be specified.
See Linux commits 86a9bad3ab6b6f858fd4443b48738cabbb6d094c and 80d5c3689b886308247da295a228a54df49a44f6.

---
 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c |   47 +++++++++++++-------
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |   26 ++++++++++-
 lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h  |    6 +--
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c     |    2 +-
 .../linuxapp/kni/ethtool/ixgbe/ixgbe_main.c        |   16 +++----
 .../linuxapp/kni/ethtool/ixgbe/kcompat.h           |   12 ++++-
 6 files changed, 79 insertions(+), 30 deletions(-)
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c +31 -16
index 9d772fa..cf1af86 100644
@@ -151,7 +151,10 @@ static void igb_reset_task(struct work_struct *);
 #ifdef HAVE_VLAN_RX_REGISTER
 static void igb_vlan_mode(struct net_device *, struct vlan_group *);
 #endif
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *, __be16, u16);
+static int igb_vlan_rx_kill_vid(struct net_device *, __be16, u16);
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
 static int igb_vlan_rx_add_vid(struct net_device *, u16);
 static int igb_vlan_rx_kill_vid(struct net_device *, u16);
 #else
@@ -1838,8 +1841,8 @@ static kni_netdev_features_t igb_fix_features(struct net_device *netdev,
 	 * Since there is no support for separate tx vlan accel
 	 * enabled make sure tx flag is cleared if rx is.
 	 */
-	if (!(features & NETIF_F_HW_VLAN_RX))
-		features &= ~NETIF_F_HW_VLAN_TX;
+	if (!(features & NETIF_F_HW_VLAN_CTAG_RX))
+		features &= ~NETIF_F_HW_VLAN_CTAG_TX;
 
 	/* If Rx checksum is disabled, then LRO should also be disabled */
 	if (!(features & NETIF_F_RXCSUM))
@@ -1853,7 +1856,7 @@ static int igb_set_features(struct net_device *netdev,
 {
 	u32 changed = netdev->features ^ features;
 
-	if (changed & NETIF_F_HW_VLAN_RX)
+	if (changed & NETIF_F_HW_VLAN_CTAG_RX)
 		igb_vlan_mode(netdev, features);
 
 	return 0;
@@ -1929,7 +1932,7 @@ void igb_assign_vmdq_netdev_ops(struct net_device *vnetdev)
 #ifdef HAVE_TX_TIMEOUT
 	dev->tx_timeout = &igb_vmdq_tx_timeout;
 #endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 	dev->vlan_rx_register = &igb_vmdq_vlan_rx_register;
 	dev->vlan_rx_add_vid = &igb_vmdq_vlan_rx_add_vid;
 	dev->vlan_rx_kill_vid = &igb_vmdq_vlan_rx_kill_vid;
@@ -2169,8 +2172,8 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 #ifdef HAVE_NDO_SET_FEATURES
 			    NETIF_F_RXCSUM |
 #endif
-			    NETIF_F_HW_VLAN_RX |
-			    NETIF_F_HW_VLAN_TX;
+			    NETIF_F_HW_VLAN_CTAG_RX |
+			    NETIF_F_HW_VLAN_CTAG_TX;
 
 #ifdef HAVE_NDO_SET_FEATURES
 	/* copy netdev features into list of user selectable features */
@@ -2189,7 +2192,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 #endif
 
 	/* set this bit last since it cannot be part of hw_features */
-	netdev->features |= NETIF_F_HW_VLAN_FILTER;
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
 #ifdef HAVE_NETDEV_VLAN_FEATURES
 	netdev->vlan_features |= NETIF_F_TSO |
@@ -6678,7 +6681,7 @@ static void igb_rx_vlan(struct igb_ring *ring,
 	} else {
 		IGB_CB(skb)->vid = 0;
 #else
-		__vlan_hwaccel_put_tag(skb, vid);
+		__kc__vlan_hwaccel_put_tag(skb, vid);
 #endif
 	}
 }
@@ -7726,7 +7729,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
 	if (!test_bit(__IGB_DOWN, &adapter->state))
 		igb_irq_enable(adapter);
 #else
-	bool enable = !!(features & NETIF_F_HW_VLAN_RX);
+	bool enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
 #endif
 
 	if (enable) {
@@ -7766,7 +7769,7 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
 #else
 		struct net_device *vnetdev;
 		vnetdev = adapter->vmdq_netdev[i-1];
-		enable = !!(vnetdev->features & NETIF_F_HW_VLAN_RX);
+		enable = !!(vnetdev->features & NETIF_F_HW_VLAN_CTAG_RX);
 #endif
 		igb_set_vf_vlan_strip(adapter, 
 				      adapter->vfs_allocated_count + i,
@@ -7777,7 +7780,9 @@ void igb_vlan_mode(struct net_device *netdev, u32 features)
 	igb_rlpml_set(adapter);
 }
 
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
 static int igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
 #else
 static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
@@ -7816,7 +7821,9 @@ static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
 #endif
 }
 
-#ifdef HAVE_INT_NDO_VLAN_RX_ADD_VID
+#ifdef HAVE_VLAN_PROTO
+static int igb_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid)
+#elif defined HAVE_INT_NDO_VLAN_RX_ADD_VID
 static int igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
 #else
 static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
@@ -7860,7 +7867,11 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
 		for (vid = 0; vid < VLAN_N_VID; vid++) {
 			if (!vlan_group_get_device(adapter->vlgrp, vid))
 				continue;
+#ifdef HAVE_VLAN_PROTO
+			igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
 			igb_vlan_rx_add_vid(adapter->netdev, vid);
+#endif
 		}
 	}
 #else
@@ -7869,8 +7880,12 @@ static void igb_restore_vlan(struct igb_adapter *adapter)
 	igb_vlan_mode(adapter->netdev, adapter->netdev->features);
 
 	for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
+#ifdef HAVE_VLAN_PROTO
+		igb_vlan_rx_add_vid(adapter->netdev, htons(ETH_P_8021Q), vid);
+#else
 		igb_vlan_rx_add_vid(adapter->netdev, vid);
 #endif
+#endif
 }
 
 int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx)
@@ -8859,8 +8874,8 @@ int igb_kni_probe(struct pci_dev *pdev,
 #ifdef HAVE_NDO_SET_FEATURES
 			    NETIF_F_RXCSUM |
 #endif
-			    NETIF_F_HW_VLAN_RX |
-			    NETIF_F_HW_VLAN_TX;
+			    NETIF_F_HW_VLAN_CTAG_RX |
+			    NETIF_F_HW_VLAN_CTAG_TX;
 
 #ifdef HAVE_NDO_SET_FEATURES
 	/* copy netdev features into list of user selectable features */
@@ -8879,7 +8894,7 @@ int igb_kni_probe(struct pci_dev *pdev,
 #endif
 
 	/* set this bit last since it cannot be part of hw_features */
-	netdev->features |= NETIF_F_HW_VLAN_FILTER;
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 
 #ifdef HAVE_NETDEV_VLAN_FEATURES
 	netdev->vlan_features |= NETIF_F_TSO |
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +25 -1
index f6e82c1..0e6157e 100644
@@ -287,7 +287,17 @@ struct msix_entry {
 #define IS_ALIGNED(x,a)         (((x) % ((typeof(x))(a))) == 0)
 #endif
 
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX     && defined NETIF_F_HW_VLAN_TX
+#define      NETIF_F_HW_VLAN_CTAG_TX                NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX     && defined NETIF_F_HW_VLAN_RX
+#define      NETIF_F_HW_VLAN_CTAG_RX                NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define      NETIF_F_HW_VLAN_CTAG_FILTER            NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
 struct _kc_vlan_ethhdr {
 	unsigned char	h_dest[ETH_ALEN];
 	unsigned char	h_source[ETH_ALEN];
@@ -3063,4 +3073,18 @@ typedef netdev_features_t kni_netdev_features_t;
 #define __devexit_p
 #endif
 
+/*****************************************************************************/
+#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) )
+
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+	__vlan_hwaccel_put_tag(skb, vlan_tci)
+
+#else
+
+#define HAVE_VLAN_PROTO
+#define __kc__vlan_hwaccel_put_tag(skb, vlan_tci) \
+	__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci)
+
+#endif /* < 3.10.0 */
+
 #endif /* _KCOMPAT_H_ */
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h +3 -3
index 222c2c7..eb15858 100644
@@ -42,7 +42,7 @@
 #ifdef SIOCETHTOOL
 #include <linux/ethtool.h>
 #endif
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 #include <linux/if_vlan.h>
 #endif
 #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
@@ -549,13 +549,13 @@ struct ixgbe_therm_proc_data {
 
 /* board specific private data structure */
 struct ixgbe_adapter {
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 #ifdef HAVE_VLAN_RX_REGISTER
 	struct vlan_group *vlgrp; /* must be first, see ixgbe_receive_skb */
 #else
 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
 #endif
-#endif /* NETIF_F_HW_VLAN_TX */
+#endif /* NETIF_F_HW_VLAN_CTAG_TX */
 	/* OS defined structs */
 	struct net_device *netdev;
 	struct pci_dev *pdev;
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c +1 -1
index fcff294..4bda1fb 100644
@@ -2162,7 +2162,7 @@ static int ixgbe_set_tso(struct net_device *netdev, u32 data)
 #endif
 	} else {
 #ifndef HAVE_NETDEV_VLAN_FEATURES
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 		struct ixgbe_adapter *adapter = netdev_priv(netdev);
 		/* disable TSO on all VLANs if they're present */
 		if (adapter->vlgrp) {
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c +8 -8
index 947be44..1f7c9f2 100755
@@ -331,7 +331,7 @@ void ixgbe_vlan_mode(struct net_device *netdev, u32 features)
 #ifdef HAVE_VLAN_RX_REGISTER
 	enable = (grp || (adapter->flags & IXGBE_FLAG_DCB_ENABLED));
 #else
-	enable = !!(features & NETIF_F_HW_VLAN_RX);
+	enable = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
 #endif
 	if (enable)
 		/* enable VLAN tag insert/strip */
@@ -629,7 +629,7 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
 				vmolr |= IXGBE_VMOLR_ROMPE;
 			}
 		}
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 		/* enable hardware vlan filtering */
 		vlnctrl |= IXGBE_VLNCTRL_VFE;
 #endif
@@ -812,7 +812,7 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
 	ixgbe_configure_dcb(adapter);
 
 	ixgbe_set_rx_mode(adapter->netdev);
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 	ixgbe_restore_vlan(adapter);
 #endif
 
@@ -2514,9 +2514,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
 	netdev->features |= NETIF_F_IPV6_CSUM;
 #endif
 
-#ifdef NETIF_F_HW_VLAN_TX
-	netdev->features |= NETIF_F_HW_VLAN_TX |
-			    NETIF_F_HW_VLAN_RX;
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_TX |
+			    NETIF_F_HW_VLAN_CTAG_RX;
 #endif
 #ifdef NETIF_F_TSO
 	netdev->features |= NETIF_F_TSO;
@@ -2548,9 +2548,9 @@ int ixgbe_kni_probe(struct pci_dev *pdev,
 #endif /* NETIF_F_GRO */
 #endif
 
-#ifdef NETIF_F_HW_VLAN_TX
+#ifdef NETIF_F_HW_VLAN_CTAG_TX
 	/* set this bit last since it cannot be part of hw_features */
-	netdev->features |= NETIF_F_HW_VLAN_FILTER;
+	netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
 #endif
 	switch (adapter->hw.mac.type) {
 	case ixgbe_mac_82599EB:
lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h +11 -1
index 925beeb..740579e 100644
@@ -304,7 +304,17 @@ struct msix_entry {
 #define IS_ALIGNED(x,a)         (((x) % ((typeof(x))(a))) == 0)
 #endif
 
-#ifndef NETIF_F_HW_VLAN_TX
+#if !defined NETIF_F_HW_VLAN_CTAG_TX     && defined NETIF_F_HW_VLAN_TX
+#define      NETIF_F_HW_VLAN_CTAG_TX                NETIF_F_HW_VLAN_TX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_RX     && defined NETIF_F_HW_VLAN_RX
+#define      NETIF_F_HW_VLAN_CTAG_RX                NETIF_F_HW_VLAN_RX
+#endif
+#if !defined NETIF_F_HW_VLAN_CTAG_FILTER && defined NETIF_F_HW_VLAN_FILTER
+#define      NETIF_F_HW_VLAN_CTAG_FILTER            NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
 struct _kc_vlan_ethhdr {
 	unsigned char	h_dest[ETH_ALEN];
 	unsigned char	h_source[ETH_ALEN];
Signature · 1 line
1.7.10.4
#27 lore raw

PATCH v2 4/4 app: fix build with gcc 4.8

In reply to a message not in the archive

GCC 4.8 was producing this error:
argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the second source; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]

---
 app/test/test_cmdline_string.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
app/test/test_cmdline_string.c +1 -2
index 7b358cf..4b7e066 100644
@@ -382,8 +382,7 @@ test_parse_string_valid(void)
 			printf("Error: getting string element failed!\n");
 			return -1;
 		}
-		if (strncmp(buf, string_elt_strs[i].result,
-				sizeof(string_elt_strs[i].result)) != 0) {
+		if (strcmp(buf, string_elt_strs[i].result) != 0) {
 			printf("Error: result mismatch!\n");
 			return -1;
 		}
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 4960b865443e982857323637c3df35d106286bf0.1379081595.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

A message that is not in the archive (sent off-list or not yet received): [email protected]

#31 lore raw

Re: [PATCH v2 4/4] app: fix build with gcc 4.8

16/09/2013 13:22, Nicolas Dichtel :

Quoted 9 lines · Thomas Monjalon
Quoted 6 lines

GCC 4.8 was producing this error:
argument to ‘sizeof’ in ‘strncmp’ call is the same expression as the second source; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]

pushed

Signature · 1 line
Thomas