From 4583570637e26d22bb7b8c39d165e66c4ce015d9 Mon Sep 17 00:00:00 2001 From: Intel Date: Wed, 18 Sep 2013 12:00:00 +0200 Subject: [PATCH] kni: fix build with kernel 3.10 - 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: Intel --- .../linuxapp/kni/ethtool/igb/igb_main.c | 25 ++++++++++++++++--- .../linuxapp/kni/ethtool/igb/kcompat.h | 11 ++++++++ .../linuxapp/kni/ethtool/ixgbe/kcompat.h | 10 ++++++++ 3 files changed, 43 insertions(+), 3 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 f0728bb2ef..c2c1dde042 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_PROTOCOL +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 @@ -6678,7 +6681,14 @@ static void igb_rx_vlan(struct igb_ring *ring, } else { IGB_CB(skb)->vid = 0; #else + +#ifdef HAVE_VLAN_PROTOCOL + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); +#else __vlan_hwaccel_put_tag(skb, vid); +#endif + + #endif } } @@ -7777,7 +7787,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_PROTOCOL +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 +7828,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_PROTOCOL +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) @@ -7869,8 +7883,13 @@ 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_PROTOCOL + 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) diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h index 7a36007c1f..0a578be751 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h @@ -301,9 +301,11 @@ struct _kc_vlan_hdr { __be16 h_vlan_encapsulated_proto; }; #define vlan_hdr _kc_vlan_hdr +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) ) #define vlan_tx_tag_present(_skb) 0 #define vlan_tx_tag_get(_skb) 0 #endif +#endif #ifndef VLAN_PRIO_SHIFT #define VLAN_PRIO_SHIFT 13 @@ -3049,4 +3051,13 @@ typedef u32 netdev_features_t; #else #define HAVE_FDB_OPS #endif /* < 3.5.0 */ + +/*****************************************************************************/ +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ) +#define NETIF_F_HW_VLAN_TX NETIF_F_HW_VLAN_CTAG_TX +#define NETIF_F_HW_VLAN_RX NETIF_F_HW_VLAN_CTAG_RX +#define NETIF_F_HW_VLAN_FILTER NETIF_F_HW_VLAN_CTAG_FILTER +#define HAVE_VLAN_PROTOCOL +#endif /* >= 3.10.0 */ + #endif /* _KCOMPAT_H_ */ diff --git a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h index 43e6bd8408..ea94ef67a1 100644 --- a/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h +++ b/lib/librte_eal/linuxapp/kni/ethtool/ixgbe/kcompat.h @@ -318,9 +318,11 @@ struct _kc_vlan_hdr { __be16 h_vlan_encapsulated_proto; }; #define vlan_hdr _kc_vlan_hdr +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) ) #define vlan_tx_tag_present(_skb) 0 #define vlan_tx_tag_get(_skb) 0 #endif +#endif #ifndef VLAN_PRIO_SHIFT #define VLAN_PRIO_SHIFT 13 @@ -3106,4 +3108,12 @@ typedef u32 netdev_features_t; #else #define HAVE_FDB_OPS #endif /* < 3.5.0 */ + +/*****************************************************************************/ +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ) +#define NETIF_F_HW_VLAN_TX NETIF_F_HW_VLAN_CTAG_TX +#define NETIF_F_HW_VLAN_RX NETIF_F_HW_VLAN_CTAG_RX +#define NETIF_F_HW_VLAN_FILTER NETIF_F_HW_VLAN_CTAG_FILTER +#endif /* >= 3.10.0 */ + #endif /* _KCOMPAT_H_ */ -- 2.20.1