1 --- a/Embedded/src/GbE/kcompat.h
2 +++ b/Embedded/src/GbE/kcompat.h
3 @@ -590,6 +590,10 @@ static inline void _kc_synchronize_irq()
4 #define ETHTOOL_OPS_COMPAT
7 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
8 +#define HAVE_NETIF_MSG 1
11 #ifndef HAVE_NETIF_MSG
12 #define HAVE_NETIF_MSG 1
14 --- a/Embedded/src/GbE/iegbe_main.c
15 +++ b/Embedded/src/GbE/iegbe_main.c
16 @@ -159,9 +159,9 @@ static void iegbe_smartspeed(struct iegb
17 static inline int iegbe_82547_fifo_workaround(struct iegbe_adapter *adapter,
20 -static void iegbe_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
21 -static void iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
22 -static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
23 +static bool iegbe_vlan_used(struct iegbe_adapter *adapter);
24 +static int iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
25 +static int iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
26 static void iegbe_restore_vlan(struct iegbe_adapter *adapter);
28 static int iegbe_notify_reboot(struct notifier_block *,
29 @@ -324,8 +324,8 @@ static void iegbe_update_mng_vlan(struct
30 struct net_device *netdev = adapter->netdev;
31 u16 vid = hw->mng_cookie.vlan_id;
32 u16 old_vid = adapter->mng_vlan_id;
33 - if (adapter->vlgrp) {
34 - if (!vlan_group_get_device(adapter->vlgrp, vid)) {
35 + if (iegbe_vlan_used(adapter)) {
36 + if (!test_bit(old_vid, adapter->active_vlans)) {
37 if (hw->mng_cookie.status &
38 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
39 iegbe_vlan_rx_add_vid(netdev, vid);
40 @@ -335,7 +335,7 @@ static void iegbe_update_mng_vlan(struct
42 if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
44 - !vlan_group_get_device(adapter->vlgrp, old_vid))
45 + !test_bit(old_vid, adapter->active_vlans))
46 iegbe_vlan_rx_kill_vid(netdev, old_vid);
48 adapter->mng_vlan_id = vid;
49 @@ -736,7 +736,6 @@ static const struct net_device_ops iegbe
50 .ndo_do_ioctl = iegbe_ioctl,
51 .ndo_validate_addr = eth_validate_addr,
53 - .ndo_vlan_rx_register = iegbe_vlan_rx_register,
54 .ndo_vlan_rx_add_vid = iegbe_vlan_rx_add_vid,
55 .ndo_vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid,
56 #ifdef CONFIG_NET_POLL_CONTROLLER
57 @@ -767,7 +766,6 @@ static int __devinit iegbe_probe(struct
59 u16 eeprom_apme_mask = E1000_EEPROM_APME;
61 - DECLARE_MAC_BUF(mac);
63 bars = pci_select_bars(pdev, IORESOURCE_MEM);
64 err = pci_enable_device(pdev);
65 @@ -1247,8 +1245,7 @@ static int iegbe_close(struct net_device
67 if ((hw->mng_cookie.status &
68 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
70 - vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) {
71 + !test_bit(adapter->mng_vlan_id, adapter->active_vlans)) {
72 iegbe_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
75 @@ -2163,11 +2160,13 @@ static void iegbe_set_rx_mode(struct net
76 struct iegbe_hw *hw = &adapter->hw;
77 struct netdev_hw_addr *ha;
79 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
80 struct dev_addr_list *mc_ptr;
83 - int i, rar_entries = E1000_RAR_ENTRIES;
84 int mta_reg_count = E1000_NUM_MTA_REGISTERS;
87 + int i, rar_entries = E1000_RAR_ENTRIES;
89 /* reserve RAR[14] for LAA over-write work-around */
90 if (hw->mac_type == iegbe_82571)
91 @@ -2220,6 +2219,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
93 WARN_ON(i == rar_entries);
95 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
96 mc_ptr = netdev->mc_list;
98 for (; i < rar_entries; i++) {
99 @@ -2247,6 +2247,7 @@ int mta_reg_count = E1000_NUM_MTA_REGIST
100 hash_value = iegbe_hash_mc_addr(hw, mc_ptr->da_addr);
101 iegbe_mta_set(hw, hash_value);
105 if (hw->mac_type == iegbe_82542_rev2_0)
106 iegbe_leave_82542_rst(adapter);
107 @@ -2821,14 +2822,14 @@ static int iegbe_tx_map(struct iegbe_ada
108 * Avoid terminating buffers within evenly-aligned
110 if(unlikely(adapter->pcix_82544 &&
111 - !((unsigned long)(frag->page+offset+size-1) & 4) &&
112 + !((unsigned long)(frag->page.p+offset+size-1) & 4) &&
116 buffer_info->length = size;
118 pci_map_page(adapter->pdev,
124 @@ -3131,7 +3132,7 @@ static int iegbe_xmit_frame(struct sk_bu
128 - if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
129 + if (unlikely(iegbe_vlan_used(adapter) && vlan_tx_tag_present(skb))) {
130 tx_flags |= E1000_TX_FLAGS_VLAN;
131 tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
133 @@ -3832,10 +3833,12 @@ static bool iegbe_clean_rx_irq(struct ie
135 skb->protocol = eth_type_trans(skb, netdev);
137 - if (unlikely(adapter->vlgrp &&
138 + if (unlikely(iegbe_vlan_used(adapter) &&
139 (status & E1000_RXD_STAT_VP))) {
140 - vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
141 - le16_to_cpu(rx_desc->special));
144 + vid = le16_to_cpu(rx_desc->special);
145 + __vlan_hwaccel_put_tag(skb, vid);
147 netif_receive_skb(skb);
149 @@ -3986,9 +3989,10 @@ copydone:
150 cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
151 adapter->rx_hdr_split++;
153 - if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
154 - vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
155 - le16_to_cpu(rx_desc->wb.middle.vlan));
156 + if(unlikely(iegbe_vlan_used(adapter) && (staterr & E1000_RXD_STAT_VP))) {
158 + vid = le16_to_cpu(rx_desc->wb.middle.vlan);
159 + __vlan_hwaccel_put_tag(skb, vid);
161 netif_receive_skb(skb);
163 @@ -4496,17 +4500,25 @@ iegbe_io_write(struct iegbe_hw *hw, unsi
167 -static void iegbe_vlan_rx_register(struct net_device *netdev,
168 - struct vlan_group *grp)
169 +static bool iegbe_vlan_used(struct iegbe_adapter *adapter)
173 + for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
179 +static void iegbe_vlan_mode(struct net_device *netdev, bool vlan_on)
181 struct iegbe_adapter *adapter = netdev_priv(netdev);
184 if (!test_bit(__E1000_DOWN, &adapter->flags))
185 iegbe_irq_disable(adapter);
186 - adapter->vlgrp = grp;
190 /* enable VLAN tag insert/strip */
191 ctrl = E1000_READ_REG(&adapter->hw, CTRL);
192 ctrl |= E1000_CTRL_VME;
193 @@ -4538,30 +4550,37 @@ static void iegbe_vlan_rx_register(struc
194 iegbe_irq_enable(adapter);
197 -static void iegbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
198 +static int iegbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
200 struct iegbe_adapter *adapter = netdev_priv(netdev);
201 uint32_t vfta, index;
202 if((adapter->hw.mng_cookie.status &
203 E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
204 (vid == adapter->mng_vlan_id)) {
209 + if (!iegbe_vlan_used(adapter))
210 + iegbe_vlan_mode(netdev, true);
212 /* add VID to filter table */
213 index = (vid >> 0x5) & 0x7F;
214 vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
215 vfta |= (0x1 << (vid & 0x1F));
216 iegbe_write_vfta(&adapter->hw, index, vfta);
218 + set_bit(vid, adapter->active_vlans);
223 -static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
224 +static int iegbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
226 struct iegbe_adapter *adapter = netdev_priv(netdev);
229 if (!test_bit(__E1000_DOWN, &adapter->flags))
230 iegbe_irq_disable(adapter);
231 - vlan_group_set_device(adapter->vlgrp, vid, NULL);
232 if (!test_bit(__E1000_DOWN, &adapter->flags))
233 iegbe_irq_enable(adapter);
235 @@ -4570,21 +4589,26 @@ static void iegbe_vlan_rx_kill_vid(struc
236 vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
237 vfta &= ~(0x1 << (vid & 0x1F));
238 iegbe_write_vfta(&adapter->hw, index, vfta);
240 + clear_bit(vid, adapter->active_vlans);
242 + if (!iegbe_vlan_used(adapter))
243 + iegbe_vlan_mode(netdev, false);
248 static void iegbe_restore_vlan(struct iegbe_adapter *adapter)
250 - iegbe_vlan_rx_register(adapter->netdev, adapter->vlgrp);
252 - if (adapter->vlgrp) {
254 - for (vid = 0x0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
255 - if (!vlan_group_get_device(adapter->vlgrp, vid))
258 + if (!iegbe_vlan_used(adapter))
261 + iegbe_vlan_mode(adapter->netdev, true);
262 + for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
263 iegbe_vlan_rx_add_vid(adapter->netdev, vid);
269 int iegbe_set_spd_dplx(struct iegbe_adapter *adapter, u16 spddplx)
270 @@ -4864,10 +4888,11 @@ iegbe_resume(struct pci_dev *pdev)
281 #ifdef CONFIG_NET_POLL_CONTROLLER
283 --- a/Embedded/src/GbE/iegbe_ethtool.c
284 +++ b/Embedded/src/GbE/iegbe_ethtool.c
285 @@ -327,6 +327,7 @@ iegbe_set_pauseparam(struct net_device *
289 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
291 iegbe_get_rx_csum(struct net_device *netdev)
293 @@ -392,6 +393,7 @@ iegbe_set_tso(struct net_device *netdev,
296 #endif /* NETIF_F_TSO */
297 +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
300 iegbe_get_msglevel(struct net_device *netdev)
301 @@ -807,6 +809,7 @@ err_setup_rx:
302 E1000_82542_##R : E1000_##R; \
305 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
307 iegbe_reg_test(struct iegbe_adapter *adapter, uint64_t *data)
309 @@ -1710,6 +1713,7 @@ iegbe_diag_test(struct net_device *netde
311 msleep_interruptible(0xfa0);
313 +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
316 iegbe_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
317 @@ -1812,6 +1816,7 @@ iegbe_set_wol(struct net_device *netdev,
318 /* bit defines for adapter->led_status */
319 #define E1000_LED_ON 0
321 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
323 iegbe_led_blink_callback(unsigned long data)
325 @@ -1864,6 +1869,7 @@ iegbe_phys_id(struct net_device *netdev,
332 iegbe_nway_reset(struct net_device *netdev)
333 @@ -1876,11 +1882,13 @@ iegbe_nway_reset(struct net_device *netd
337 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
339 iegbe_get_stats_count(struct net_device *netdev)
341 return E1000_STATS_LEN;
346 iegbe_get_ethtool_stats(struct net_device *netdev,
347 @@ -1936,6 +1944,8 @@ struct ethtool_ops iegbe_ethtool_ops = {
348 .set_ringparam = iegbe_set_ringparam,
349 .get_pauseparam = iegbe_get_pauseparam,
350 .set_pauseparam = iegbe_set_pauseparam,
352 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
353 .get_rx_csum = iegbe_get_rx_csum,
354 .set_rx_csum = iegbe_set_rx_csum,
355 .get_tx_csum = iegbe_get_tx_csum,
356 @@ -1946,11 +1956,13 @@ struct ethtool_ops iegbe_ethtool_ops = {
357 .get_tso = ethtool_op_get_tso,
358 .set_tso = iegbe_set_tso,
361 .self_test_count = iegbe_diag_test_count,
362 .self_test = iegbe_diag_test,
363 - .get_strings = iegbe_get_strings,
364 .phys_id = iegbe_phys_id,
365 .get_stats_count = iegbe_get_stats_count,
367 + .get_strings = iegbe_get_strings,
368 .get_ethtool_stats = iegbe_get_ethtool_stats,
371 --- a/Embedded/src/GbE/gcu_main.c
372 +++ b/Embedded/src/GbE/gcu_main.c
373 @@ -93,7 +93,7 @@ static struct pci_driver gcu_driver = {
376 static struct gcu_adapter *global_adapter = 0;
377 -static spinlock_t global_adapter_spinlock = SPIN_LOCK_UNLOCKED;
378 +static DEFINE_SPINLOCK(global_adapter_spinlock);
379 static unsigned long g_intflags = 0;
381 MODULE_AUTHOR("Intel(R) Corporation");
382 --- a/Embedded/src/GbE/iegbe.h
383 +++ b/Embedded/src/GbE/iegbe.h
384 @@ -257,7 +257,7 @@ struct iegbe_adapter {
385 struct timer_list tx_fifo_stall_timer;
386 struct timer_list watchdog_timer;
387 struct timer_list phy_info_timer;
388 - struct vlan_group *vlgrp;
389 + unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
390 uint16_t mng_vlan_id;
392 uint32_t rx_buffer_len;