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
This commit is contained in:
Intel 2013-09-18 12:00:00 +02:00 committed by Thomas Monjalon
parent 47cda8c470
commit 4583570637
3 changed files with 43 additions and 3 deletions

View File

@ -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)

View File

@ -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_ */

View File

@ -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_ */