Root/package/ep80579-drivers/patches/711-3.3-gbe-fixes.patch

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
5 #endif
6 
7+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
8+#define HAVE_NETIF_MSG 1
9+#endif
10+
11 #ifndef HAVE_NETIF_MSG
12 #define HAVE_NETIF_MSG 1
13 enum {
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,
18                           struct sk_buff *skb);
19 
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);
27 
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
41 
42                         if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
43                                         (vid != old_vid) &&
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);
47                 } else
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,
52 
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
58     u16 eeprom_data = 0;
59     u16 eeprom_apme_mask = E1000_EEPROM_APME;
60     int bars;
61- DECLARE_MAC_BUF(mac);
62 
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
66 
67     if ((hw->mng_cookie.status &
68               E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
69- !(adapter->vlgrp &&
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);
73     }
74     return 0;
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;
78     bool use_uc = false;
79+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
80     struct dev_addr_list *mc_ptr;
81- u32 rctl;
82     u32 hash_value;
83- int i, rar_entries = E1000_RAR_ENTRIES;
84 int mta_reg_count = E1000_NUM_MTA_REGISTERS;
85+#endif
86+ u32 rctl;
87+ int i, rar_entries = E1000_RAR_ENTRIES;
88 
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
92 
93     WARN_ON(i == rar_entries);
94 
95+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
96     mc_ptr = netdev->mc_list;
97 
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);
102     }
103+#endif
104 
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
109              * dwords. */
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) &&
113                size > 4))
114                 size -= 4;
115 
116             buffer_info->length = size;
117             buffer_info->dma =
118                 pci_map_page(adapter->pdev,
119- frag->page,
120+ frag->page.p,
121                     offset,
122                     size,
123                     PCI_DMA_TODEVICE);
124@@ -3131,7 +3132,7 @@ static int iegbe_xmit_frame(struct sk_bu
125         }
126     }
127 
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);
132     }
133@@ -3832,10 +3833,12 @@ static bool iegbe_clean_rx_irq(struct ie
134 
135         skb->protocol = eth_type_trans(skb, netdev);
136 
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));
142+ u16 vid;
143+
144+ vid = le16_to_cpu(rx_desc->special);
145+ __vlan_hwaccel_put_tag(skb, vid);
146         } else {
147             netif_receive_skb(skb);
148         }
149@@ -3986,9 +3989,10 @@ copydone:
150                cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
151             adapter->rx_hdr_split++;
152 
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))) {
157+ u16 vid;
158+ vid = le16_to_cpu(rx_desc->wb.middle.vlan);
159+ __vlan_hwaccel_put_tag(skb, vid);
160         } else {
161             netif_receive_skb(skb);
162         }
163@@ -4496,17 +4500,25 @@ iegbe_io_write(struct iegbe_hw *hw, unsi
164     outl(value, port);
165 }
166 
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)
170+{
171+ u16 vid;
172+
173+ for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
174+ return true;
175+
176+ return false;
177+}
178+
179+static void iegbe_vlan_mode(struct net_device *netdev, bool vlan_on)
180 {
181     struct iegbe_adapter *adapter = netdev_priv(netdev);
182     uint32_t ctrl, rctl;
183 
184     if (!test_bit(__E1000_DOWN, &adapter->flags))
185     iegbe_irq_disable(adapter);
186- adapter->vlgrp = grp;
187 
188- if(grp) {
189+ if(vlan_on) {
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);
195 }
196 
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)
199 {
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)) {
205- return;
206+ return 0;
207     }
208+
209+ if (!iegbe_vlan_used(adapter))
210+ iegbe_vlan_mode(netdev, true);
211+
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);
217+
218+ set_bit(vid, adapter->active_vlans);
219+
220+ return 0;
221 }
222 
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)
225 {
226     struct iegbe_adapter *adapter = netdev_priv(netdev);
227     u32 vfta, index;
228 
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);
234 
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);
239+
240+ clear_bit(vid, adapter->active_vlans);
241+
242+ if (!iegbe_vlan_used(adapter))
243+ iegbe_vlan_mode(netdev, false);
244+
245+ return 0;
246 }
247 
248 static void iegbe_restore_vlan(struct iegbe_adapter *adapter)
249 {
250- iegbe_vlan_rx_register(adapter->netdev, adapter->vlgrp);
251-
252- if (adapter->vlgrp) {
253         u16 vid;
254- for (vid = 0x0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
255- if (!vlan_group_get_device(adapter->vlgrp, vid))
256- continue;
257+
258+ if (!iegbe_vlan_used(adapter))
259+ return;
260+
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);
264         }
265- }
266-}
267 
268 
269 int iegbe_set_spd_dplx(struct iegbe_adapter *adapter, u16 spddplx)
270@@ -4864,10 +4888,11 @@ iegbe_resume(struct pci_dev *pdev)
271     default:
272         break;
273     }
274-#endif
275 
276     return 0x0;
277 }
278+#endif
279+
280 
281 #ifdef CONFIG_NET_POLL_CONTROLLER
282 /*
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 *
286     return 0;
287 }
288 
289+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
290 static uint32_t
291 iegbe_get_rx_csum(struct net_device *netdev)
292 {
293@@ -392,6 +393,7 @@ iegbe_set_tso(struct net_device *netdev,
294     return 0;
295 }
296 #endif /* NETIF_F_TSO */
297+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
298 
299 static uint32_t
300 iegbe_get_msglevel(struct net_device *netdev)
301@@ -807,6 +809,7 @@ err_setup_rx:
302             E1000_82542_##R : E1000_##R; \
303         return 1; } }
304 
305+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
306 static int
307 iegbe_reg_test(struct iegbe_adapter *adapter, uint64_t *data)
308 {
309@@ -1710,6 +1713,7 @@ iegbe_diag_test(struct net_device *netde
310     }
311     msleep_interruptible(0xfa0);
312 }
313+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
314 
315 static void
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
320 
321+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
322 static void
323 iegbe_led_blink_callback(unsigned long data)
324 {
325@@ -1864,6 +1869,7 @@ iegbe_phys_id(struct net_device *netdev,
326 
327     return 0;
328 }
329+#endif
330 
331 static int
332 iegbe_nway_reset(struct net_device *netdev)
333@@ -1876,11 +1882,13 @@ iegbe_nway_reset(struct net_device *netd
334     return 0;
335 }
336 
337+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
338 static int
339 iegbe_get_stats_count(struct net_device *netdev)
340 {
341     return E1000_STATS_LEN;
342 }
343+#endif
344 
345 static void
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,
351+
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,
359 #endif
360+
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,
366+#endif
367+ .get_strings = iegbe_get_strings,
368     .get_ethtool_stats = iegbe_get_ethtool_stats,
369 };
370 
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 = {
374 };
375 
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;
380 
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;
391     uint32_t bd_number;
392     uint32_t rx_buffer_len;
393

Archive Download this file



interactive