[dpdk-dev] [PATCH v2 3/4] kni: fix build with kernel 3.10
Thomas Monjalon
thomas.monjalon at 6wind.com
Fri Sep 13 16:14:29 CEST 2013
- 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.
Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
Tested-by: David Nyström <david.c.nystrom at gmail.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel at 6wind.com>
---
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(-)
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 9d772fa..cf1af86 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
@@ -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 |
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index f6e82c1..0e6157e 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -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_ */
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
index 222c2c7..eb15858 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe.h
@@ -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;
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
index fcff294..4bda1fb 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_ethtool.c
@@ -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) {
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
index 947be44..1f7c9f2 100755
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/ixgbe_main.c
@@ -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:
diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
index 925beeb..740579e 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h
@@ -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];
--
1.7.10.4
More information about the dev
mailing list