/[linux-patches]/genpatches-2.6/trunk/2.6.16/2400_sky2-1.1.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.16/2400_sky2-1.1.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 416 - (show annotations) (download) (as text)
Wed Apr 19 10:47:52 2006 UTC (14 years, 7 months ago) by johnm
File MIME type: text/x-diff
File size: 36801 byte(s)
fix patch offset
1 --- linux-2.6.16-gentoo/drivers/net/sky2.c 2006-03-20 15:45:48.000000000 +0000
2 +++ linux-dsd/drivers/net/sky2.c 2006-03-27 13:34:10.000000000 +0100
3 @@ -51,7 +51,7 @@
4 #include "sky2.h"
5
6 #define DRV_NAME "sky2"
7 -#define DRV_VERSION "0.15"
8 +#define DRV_VERSION "1.1"
9 #define PFX DRV_NAME " "
10
11 /*
12 @@ -61,10 +61,6 @@
13 * a receive requires one (or two if using 64 bit dma).
14 */
15
16 -#define is_ec_a1(hw) \
17 - unlikely((hw)->chip_id == CHIP_ID_YUKON_EC && \
18 - (hw)->chip_rev == CHIP_REV_YU_EC_A1)
19 -
20 #define RX_LE_SIZE 512
21 #define RX_LE_BYTES (RX_LE_SIZE*sizeof(struct sky2_rx_le))
22 #define RX_MAX_PENDING (RX_LE_SIZE/2 - 2)
23 @@ -96,6 +92,10 @@ static int copybreak __read_mostly = 256
24 module_param(copybreak, int, 0);
25 MODULE_PARM_DESC(copybreak, "Receive copy threshold");
26
27 +static int disable_msi = 0;
28 +module_param(disable_msi, int, 0);
29 +MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
30 +
31 static const struct pci_device_id sky2_id_table[] = {
32 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
33 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
34 @@ -504,9 +504,9 @@ static void sky2_phy_init(struct sky2_hw
35 /* Force a renegotiation */
36 static void sky2_phy_reinit(struct sky2_port *sky2)
37 {
38 - down(&sky2->phy_sema);
39 + spin_lock_bh(&sky2->phy_lock);
40 sky2_phy_init(sky2->hw, sky2->port);
41 - up(&sky2->phy_sema);
42 + spin_unlock_bh(&sky2->phy_lock);
43 }
44
45 static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
46 @@ -571,9 +571,9 @@ static void sky2_mac_init(struct sky2_hw
47
48 sky2_read16(hw, SK_REG(port, GMAC_IRQ_SRC));
49
50 - down(&sky2->phy_sema);
51 + spin_lock_bh(&sky2->phy_lock);
52 sky2_phy_init(hw, port);
53 - up(&sky2->phy_sema);
54 + spin_unlock_bh(&sky2->phy_lock);
55
56 /* MIB clear */
57 reg = gma_read16(hw, port, GM_PHY_ADDR);
58 @@ -725,37 +725,11 @@ static inline struct sky2_tx_le *get_tx_
59 return le;
60 }
61
62 -/*
63 - * This is a workaround code taken from SysKonnect sk98lin driver
64 - * to deal with chip bug on Yukon EC rev 0 in the wraparound case.
65 - */
66 -static void sky2_put_idx(struct sky2_hw *hw, unsigned q,
67 - u16 idx, u16 *last, u16 size)
68 +/* Update chip's next pointer */
69 +static inline void sky2_put_idx(struct sky2_hw *hw, unsigned q, u16 idx)
70 {
71 wmb();
72 - if (is_ec_a1(hw) && idx < *last) {
73 - u16 hwget = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX));
74 -
75 - if (hwget == 0) {
76 - /* Start prefetching again */
77 - sky2_write8(hw, Y2_QADDR(q, PREF_UNIT_FIFO_WM), 0xe0);
78 - goto setnew;
79 - }
80 -
81 - if (hwget == size - 1) {
82 - /* set watermark to one list element */
83 - sky2_write8(hw, Y2_QADDR(q, PREF_UNIT_FIFO_WM), 8);
84 -
85 - /* set put index to first list element */
86 - sky2_write16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX), 0);
87 - } else /* have hardware go to end of list */
88 - sky2_write16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX),
89 - size - 1);
90 - } else {
91 -setnew:
92 - sky2_write16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX), idx);
93 - }
94 - *last = idx;
95 + sky2_write16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX), idx);
96 mmiowb();
97 }
98
99 @@ -878,7 +852,7 @@ static int sky2_ioctl(struct net_device
100 if (!netif_running(dev))
101 return -ENODEV; /* Phy still in reset */
102
103 - switch(cmd) {
104 + switch (cmd) {
105 case SIOCGMIIPHY:
106 data->phy_id = PHY_ADDR_MARV;
107
108 @@ -886,9 +860,9 @@ static int sky2_ioctl(struct net_device
109 case SIOCGMIIREG: {
110 u16 val = 0;
111
112 - down(&sky2->phy_sema);
113 + spin_lock_bh(&sky2->phy_lock);
114 err = __gm_phy_read(hw, sky2->port, data->reg_num & 0x1f, &val);
115 - up(&sky2->phy_sema);
116 + spin_unlock_bh(&sky2->phy_lock);
117
118 data->val_out = val;
119 break;
120 @@ -898,10 +872,10 @@ static int sky2_ioctl(struct net_device
121 if (!capable(CAP_NET_ADMIN))
122 return -EPERM;
123
124 - down(&sky2->phy_sema);
125 + spin_lock_bh(&sky2->phy_lock);
126 err = gm_phy_write(hw, sky2->port, data->reg_num & 0x1f,
127 data->val_in);
128 - up(&sky2->phy_sema);
129 + spin_unlock_bh(&sky2->phy_lock);
130 break;
131 }
132 return err;
133 @@ -1001,7 +975,6 @@ static int sky2_rx_start(struct sky2_por
134
135 /* Tell chip about available buffers */
136 sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put);
137 - sky2->rx_last_put = sky2_read16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX));
138 return 0;
139 nomem:
140 sky2_rx_clean(sky2);
141 @@ -1014,7 +987,7 @@ static int sky2_up(struct net_device *de
142 struct sky2_port *sky2 = netdev_priv(dev);
143 struct sky2_hw *hw = sky2->hw;
144 unsigned port = sky2->port;
145 - u32 ramsize, rxspace;
146 + u32 ramsize, rxspace, imask;
147 int err = -ENOMEM;
148
149 if (netif_msg_ifup(sky2))
150 @@ -1079,10 +1052,10 @@ static int sky2_up(struct net_device *de
151 goto err_out;
152
153 /* Enable interrupts from phy/mac for port */
154 - spin_lock_irq(&hw->hw_lock);
155 - hw->intr_mask |= (port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2;
156 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
157 - spin_unlock_irq(&hw->hw_lock);
158 + imask = sky2_read32(hw, B0_IMSK);
159 + imask |= (port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2;
160 + sky2_write32(hw, B0_IMSK, imask);
161 +
162 return 0;
163
164 err_out:
165 @@ -1202,7 +1175,7 @@ static int sky2_xmit_frame(struct sk_buf
166 /* just drop the packet if non-linear expansion fails */
167 if (skb_header_cloned(skb) &&
168 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
169 - dev_kfree_skb_any(skb);
170 + dev_kfree_skb(skb);
171 goto out_unlock;
172 }
173
174 @@ -1299,8 +1272,7 @@ static int sky2_xmit_frame(struct sk_buf
175 netif_stop_queue(dev);
176 }
177
178 - sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod,
179 - &sky2->tx_last_put, TX_RING_SIZE);
180 + sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
181
182 out_unlock:
183 spin_unlock(&sky2->tx_lock);
184 @@ -1332,7 +1304,7 @@ static void sky2_tx_complete(struct sky2
185 struct tx_ring_info *re = sky2->tx_ring + put;
186 struct sk_buff *skb = re->skb;
187
188 - nxt = re->idx;
189 + nxt = re->idx;
190 BUG_ON(nxt >= TX_RING_SIZE);
191 prefetch(sky2->tx_ring + nxt);
192
193 @@ -1348,15 +1320,15 @@ static void sky2_tx_complete(struct sky2
194 struct tx_ring_info *fre;
195 fre = sky2->tx_ring + (put + i + 1) % TX_RING_SIZE;
196 pci_unmap_page(pdev, pci_unmap_addr(fre, mapaddr),
197 - skb_shinfo(skb)->frags[i].size,
198 + skb_shinfo(skb)->frags[i].size,
199 PCI_DMA_TODEVICE);
200 }
201
202 - dev_kfree_skb_any(skb);
203 + dev_kfree_skb(skb);
204 }
205
206 sky2->tx_cons = put;
207 - if (netif_queue_stopped(dev) && tx_avail(sky2) > MAX_SKB_TX_LE)
208 + if (tx_avail(sky2) > MAX_SKB_TX_LE)
209 netif_wake_queue(dev);
210 }
211
212 @@ -1375,6 +1347,7 @@ static int sky2_down(struct net_device *
213 struct sky2_hw *hw = sky2->hw;
214 unsigned port = sky2->port;
215 u16 ctrl;
216 + u32 imask;
217
218 /* Never really got started! */
219 if (!sky2->tx_le)
220 @@ -1386,14 +1359,6 @@ static int sky2_down(struct net_device *
221 /* Stop more packets from being queued */
222 netif_stop_queue(dev);
223
224 - /* Disable port IRQ */
225 - spin_lock_irq(&hw->hw_lock);
226 - hw->intr_mask &= ~((sky2->port == 0) ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2);
227 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
228 - spin_unlock_irq(&hw->hw_lock);
229 -
230 - flush_scheduled_work();
231 -
232 sky2_phy_reset(hw, port);
233
234 /* Stop transmitter */
235 @@ -1437,6 +1402,11 @@ static int sky2_down(struct net_device *
236 sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
237 sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
238
239 + /* Disable port IRQ */
240 + imask = sky2_read32(hw, B0_IMSK);
241 + imask &= ~(sky2->port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2;
242 + sky2_write32(hw, B0_IMSK, imask);
243 +
244 /* turn off LED's */
245 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
246
247 @@ -1631,20 +1601,19 @@ static int sky2_autoneg_done(struct sky2
248 return 0;
249 }
250
251 -/*
252 - * Interrupt from PHY are handled outside of interrupt context
253 - * because accessing phy registers requires spin wait which might
254 - * cause excess interrupt latency.
255 - */
256 -static void sky2_phy_task(void *arg)
257 +/* Interrupt from PHY */
258 +static void sky2_phy_intr(struct sky2_hw *hw, unsigned port)
259 {
260 - struct sky2_port *sky2 = arg;
261 - struct sky2_hw *hw = sky2->hw;
262 + struct net_device *dev = hw->dev[port];
263 + struct sky2_port *sky2 = netdev_priv(dev);
264 u16 istatus, phystat;
265
266 - down(&sky2->phy_sema);
267 - istatus = gm_phy_read(hw, sky2->port, PHY_MARV_INT_STAT);
268 - phystat = gm_phy_read(hw, sky2->port, PHY_MARV_PHY_STAT);
269 + spin_lock(&sky2->phy_lock);
270 + istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT);
271 + phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT);
272 +
273 + if (!netif_running(dev))
274 + goto out;
275
276 if (netif_msg_intr(sky2))
277 printk(KERN_INFO PFX "%s: phy interrupt status 0x%x 0x%x\n",
278 @@ -1670,12 +1639,7 @@ static void sky2_phy_task(void *arg)
279 sky2_link_down(sky2);
280 }
281 out:
282 - up(&sky2->phy_sema);
283 -
284 - spin_lock_irq(&hw->hw_lock);
285 - hw->intr_mask |= (sky2->port == 0) ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2;
286 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
287 - spin_unlock_irq(&hw->hw_lock);
288 + spin_unlock(&sky2->phy_lock);
289 }
290
291
292 @@ -1687,31 +1651,40 @@ static void sky2_tx_timeout(struct net_d
293 struct sky2_port *sky2 = netdev_priv(dev);
294 struct sky2_hw *hw = sky2->hw;
295 unsigned txq = txqaddr[sky2->port];
296 - u16 ridx;
297 -
298 - /* Maybe we just missed an status interrupt */
299 - spin_lock(&sky2->tx_lock);
300 - ridx = sky2_read16(hw,
301 - sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX);
302 - sky2_tx_complete(sky2, ridx);
303 - spin_unlock(&sky2->tx_lock);
304 -
305 - if (!netif_queue_stopped(dev)) {
306 - if (net_ratelimit())
307 - pr_info(PFX "transmit interrupt missed? recovered\n");
308 - return;
309 - }
310 + u16 report, done;
311
312 if (netif_msg_timer(sky2))
313 printk(KERN_ERR PFX "%s: tx timeout\n", dev->name);
314
315 - sky2_write32(hw, Q_ADDR(txq, Q_CSR), BMU_STOP);
316 - sky2_write32(hw, Y2_QADDR(txq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET);
317 + report = sky2_read16(hw, sky2->port == 0 ? STAT_TXA1_RIDX : STAT_TXA2_RIDX);
318 + done = sky2_read16(hw, Q_ADDR(txq, Q_DONE));
319
320 - sky2_tx_clean(sky2);
321 + printk(KERN_DEBUG PFX "%s: transmit ring %u .. %u report=%u done=%u\n",
322 + dev->name,
323 + sky2->tx_cons, sky2->tx_prod, report, done);
324 +
325 + if (report != done) {
326 + printk(KERN_INFO PFX "status burst pending (irq moderation?)\n");
327 +
328 + sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP);
329 + sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START);
330 + } else if (report != sky2->tx_cons) {
331 + printk(KERN_INFO PFX "status report lost?\n");
332 +
333 + spin_lock_bh(&sky2->tx_lock);
334 + sky2_tx_complete(sky2, report);
335 + spin_unlock_bh(&sky2->tx_lock);
336 + } else {
337 + printk(KERN_INFO PFX "hardware hung? flushing\n");
338
339 - sky2_qset(hw, txq);
340 - sky2_prefetch_init(hw, txq, sky2->tx_le_map, TX_RING_SIZE - 1);
341 + sky2_write32(hw, Q_ADDR(txq, Q_CSR), BMU_STOP);
342 + sky2_write32(hw, Y2_QADDR(txq, PREF_UNIT_CTRL), PREF_UNIT_RST_SET);
343 +
344 + sky2_tx_clean(sky2);
345 +
346 + sky2_qset(hw, txq);
347 + sky2_prefetch_init(hw, txq, sky2->tx_le_map, TX_RING_SIZE - 1);
348 + }
349 }
350
351
352 @@ -1730,6 +1703,7 @@ static int sky2_change_mtu(struct net_de
353 struct sky2_hw *hw = sky2->hw;
354 int err;
355 u16 ctl, mode;
356 + u32 imask;
357
358 if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
359 return -EINVAL;
360 @@ -1742,12 +1716,15 @@ static int sky2_change_mtu(struct net_de
361 return 0;
362 }
363
364 + imask = sky2_read32(hw, B0_IMSK);
365 sky2_write32(hw, B0_IMSK, 0);
366
367 dev->trans_start = jiffies; /* prevent tx timeout */
368 netif_stop_queue(dev);
369 netif_poll_disable(hw->dev[0]);
370
371 + synchronize_irq(hw->pdev->irq);
372 +
373 ctl = gma_read16(hw, sky2->port, GM_GP_CTRL);
374 gma_write16(hw, sky2->port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
375 sky2_rx_stop(sky2);
376 @@ -1766,7 +1743,7 @@ static int sky2_change_mtu(struct net_de
377 sky2_write8(hw, RB_ADDR(rxqaddr[sky2->port], RB_CTRL), RB_ENA_OP_MD);
378
379 err = sky2_rx_start(sky2);
380 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
381 + sky2_write32(hw, B0_IMSK, imask);
382
383 if (err)
384 dev_close(dev);
385 @@ -1843,8 +1820,7 @@ resubmit:
386 sky2_rx_add(sky2, re->mapaddr);
387
388 /* Tell receiver about new buffers. */
389 - sky2_put_idx(sky2->hw, rxqaddr[sky2->port], sky2->rx_put,
390 - &sky2->rx_last_put, RX_LE_SIZE);
391 + sky2_put_idx(sky2->hw, rxqaddr[sky2->port], sky2->rx_put);
392
393 return skb;
394
395 @@ -1871,76 +1847,51 @@ error:
396 goto resubmit;
397 }
398
399 -/*
400 - * Check for transmit complete
401 - */
402 -#define TX_NO_STATUS 0xffff
403 -
404 -static void sky2_tx_check(struct sky2_hw *hw, int port, u16 last)
405 +/* Transmit complete */
406 +static inline void sky2_tx_done(struct net_device *dev, u16 last)
407 {
408 - if (last != TX_NO_STATUS) {
409 - struct net_device *dev = hw->dev[port];
410 - if (dev && netif_running(dev)) {
411 - struct sky2_port *sky2 = netdev_priv(dev);
412 + struct sky2_port *sky2 = netdev_priv(dev);
413
414 - spin_lock(&sky2->tx_lock);
415 - sky2_tx_complete(sky2, last);
416 - spin_unlock(&sky2->tx_lock);
417 - }
418 + if (netif_running(dev)) {
419 + spin_lock(&sky2->tx_lock);
420 + sky2_tx_complete(sky2, last);
421 + spin_unlock(&sky2->tx_lock);
422 }
423 }
424
425 -/*
426 - * Both ports share the same status interrupt, therefore there is only
427 - * one poll routine.
428 - */
429 -static int sky2_poll(struct net_device *dev0, int *budget)
430 +/* Process status response ring */
431 +static int sky2_status_intr(struct sky2_hw *hw, int to_do)
432 {
433 - struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw;
434 - unsigned int to_do = min(dev0->quota, *budget);
435 - unsigned int work_done = 0;
436 - u16 hwidx;
437 - u16 tx_done[2] = { TX_NO_STATUS, TX_NO_STATUS };
438 -
439 - sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
440 -
441 - /*
442 - * Kick the STAT_LEV_TIMER_CTRL timer.
443 - * This fixes my hangs on Yukon-EC (0xb6) rev 1.
444 - * The if clause is there to start the timer only if it has been
445 - * configured correctly and not been disabled via ethtool.
446 - */
447 - if (sky2_read8(hw, STAT_LEV_TIMER_CTRL) == TIM_START) {
448 - sky2_write8(hw, STAT_LEV_TIMER_CTRL, TIM_STOP);
449 - sky2_write8(hw, STAT_LEV_TIMER_CTRL, TIM_START);
450 - }
451 + int work_done = 0;
452
453 - hwidx = sky2_read16(hw, STAT_PUT_IDX);
454 - BUG_ON(hwidx >= STATUS_RING_SIZE);
455 rmb();
456
457 - while (hwidx != hw->st_idx) {
458 + for(;;) {
459 struct sky2_status_le *le = hw->st_le + hw->st_idx;
460 struct net_device *dev;
461 struct sky2_port *sky2;
462 struct sk_buff *skb;
463 u32 status;
464 u16 length;
465 + u8 link, opcode;
466 +
467 + opcode = le->opcode;
468 + if (!opcode)
469 + break;
470 + opcode &= ~HW_OWNER;
471
472 - le = hw->st_le + hw->st_idx;
473 hw->st_idx = (hw->st_idx + 1) % STATUS_RING_SIZE;
474 - prefetch(hw->st_le + hw->st_idx);
475 + le->opcode = 0;
476
477 - BUG_ON(le->link >= 2);
478 - dev = hw->dev[le->link];
479 - if (dev == NULL || !netif_running(dev))
480 - continue;
481 + link = le->link;
482 + BUG_ON(link >= 2);
483 + dev = hw->dev[link];
484
485 sky2 = netdev_priv(dev);
486 - status = le32_to_cpu(le->status);
487 - length = le16_to_cpu(le->length);
488 + length = le->length;
489 + status = le->status;
490
491 - switch (le->opcode & ~HW_OWNER) {
492 + switch (opcode) {
493 case OP_RXSTAT:
494 skb = sky2_receive(sky2, length, status);
495 if (!skb)
496 @@ -1980,42 +1931,23 @@ static int sky2_poll(struct net_device *
497
498 case OP_TXINDEXLE:
499 /* TX index reports status for both ports */
500 - tx_done[0] = status & 0xffff;
501 - tx_done[1] = ((status >> 24) & 0xff)
502 - | (u16)(length & 0xf) << 8;
503 + sky2_tx_done(hw->dev[0], status & 0xffff);
504 + if (hw->dev[1])
505 + sky2_tx_done(hw->dev[1],
506 + ((status >> 24) & 0xff)
507 + | (u16)(length & 0xf) << 8);
508 break;
509
510 default:
511 if (net_ratelimit())
512 printk(KERN_WARNING PFX
513 - "unknown status opcode 0x%x\n", le->opcode);
514 + "unknown status opcode 0x%x\n", opcode);
515 break;
516 }
517 }
518
519 exit_loop:
520 - sky2_tx_check(hw, 0, tx_done[0]);
521 - sky2_tx_check(hw, 1, tx_done[1]);
522 -
523 - if (sky2_read8(hw, STAT_TX_TIMER_CTRL) == TIM_START) {
524 - sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP);
525 - sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START);
526 - }
527 -
528 - if (likely(work_done < to_do)) {
529 - spin_lock_irq(&hw->hw_lock);
530 - __netif_rx_complete(dev0);
531 -
532 - hw->intr_mask |= Y2_IS_STAT_BMU;
533 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
534 - spin_unlock_irq(&hw->hw_lock);
535 -
536 - return 0;
537 - } else {
538 - *budget -= work_done;
539 - dev0->quota -= work_done;
540 - return 1;
541 - }
542 + return work_done;
543 }
544
545 static void sky2_hw_error(struct sky2_hw *hw, unsigned port, u32 status)
546 @@ -2134,57 +2066,97 @@ static void sky2_mac_intr(struct sky2_hw
547 }
548 }
549
550 -static void sky2_phy_intr(struct sky2_hw *hw, unsigned port)
551 +/* This should never happen it is a fatal situation */
552 +static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port,
553 + const char *rxtx, u32 mask)
554 {
555 struct net_device *dev = hw->dev[port];
556 struct sky2_port *sky2 = netdev_priv(dev);
557 + u32 imask;
558
559 - hw->intr_mask &= ~(port == 0 ? Y2_IS_IRQ_PHY1 : Y2_IS_IRQ_PHY2);
560 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
561 + printk(KERN_ERR PFX "%s: %s descriptor error (hardware problem)\n",
562 + dev ? dev->name : "<not registered>", rxtx);
563
564 - schedule_work(&sky2->phy_task);
565 + imask = sky2_read32(hw, B0_IMSK);
566 + imask &= ~mask;
567 + sky2_write32(hw, B0_IMSK, imask);
568 +
569 + if (dev) {
570 + spin_lock(&sky2->phy_lock);
571 + sky2_link_down(sky2);
572 + spin_unlock(&sky2->phy_lock);
573 + }
574 }
575
576 -static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs)
577 +static int sky2_poll(struct net_device *dev0, int *budget)
578 {
579 - struct sky2_hw *hw = dev_id;
580 - struct net_device *dev0 = hw->dev[0];
581 - u32 status;
582 + struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw;
583 + int work_limit = min(dev0->quota, *budget);
584 + int work_done = 0;
585 + u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
586
587 - status = sky2_read32(hw, B0_Y2_SP_ISRC2);
588 - if (status == 0 || status == ~0)
589 - return IRQ_NONE;
590 + if (unlikely(status & ~Y2_IS_STAT_BMU)) {
591 + if (status & Y2_IS_HW_ERR)
592 + sky2_hw_intr(hw);
593
594 - spin_lock(&hw->hw_lock);
595 - if (status & Y2_IS_HW_ERR)
596 - sky2_hw_intr(hw);
597 + if (status & Y2_IS_IRQ_PHY1)
598 + sky2_phy_intr(hw, 0);
599
600 - /* Do NAPI for Rx and Tx status */
601 - if (status & Y2_IS_STAT_BMU) {
602 - hw->intr_mask &= ~Y2_IS_STAT_BMU;
603 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
604 + if (status & Y2_IS_IRQ_PHY2)
605 + sky2_phy_intr(hw, 1);
606
607 - if (likely(__netif_rx_schedule_prep(dev0))) {
608 - prefetch(&hw->st_le[hw->st_idx]);
609 - __netif_rx_schedule(dev0);
610 - }
611 + if (status & Y2_IS_IRQ_MAC1)
612 + sky2_mac_intr(hw, 0);
613 +
614 + if (status & Y2_IS_IRQ_MAC2)
615 + sky2_mac_intr(hw, 1);
616 +
617 + if (status & Y2_IS_CHK_RX1)
618 + sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1);
619 +
620 + if (status & Y2_IS_CHK_RX2)
621 + sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2);
622 +
623 + if (status & Y2_IS_CHK_TXA1)
624 + sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1);
625 +
626 + if (status & Y2_IS_CHK_TXA2)
627 + sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2);
628 }
629
630 - if (status & Y2_IS_IRQ_PHY1)
631 - sky2_phy_intr(hw, 0);
632 + if (status & Y2_IS_STAT_BMU) {
633 + work_done = sky2_status_intr(hw, work_limit);
634 + *budget -= work_done;
635 + dev0->quota -= work_done;
636
637 - if (status & Y2_IS_IRQ_PHY2)
638 - sky2_phy_intr(hw, 1);
639 + if (work_done >= work_limit)
640 + return 1;
641
642 - if (status & Y2_IS_IRQ_MAC1)
643 - sky2_mac_intr(hw, 0);
644 + sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
645 + }
646
647 - if (status & Y2_IS_IRQ_MAC2)
648 - sky2_mac_intr(hw, 1);
649 + netif_rx_complete(dev0);
650
651 - sky2_write32(hw, B0_Y2_SP_ICR, 2);
652 + status = sky2_read32(hw, B0_Y2_SP_LISR);
653 + return 0;
654 +}
655 +
656 +static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs)
657 +{
658 + struct sky2_hw *hw = dev_id;
659 + struct net_device *dev0 = hw->dev[0];
660 + u32 status;
661
662 - spin_unlock(&hw->hw_lock);
663 + /* Reading this mask interrupts as side effect */
664 + status = sky2_read32(hw, B0_Y2_SP_ISRC2);
665 + if (status == 0 || status == ~0)
666 + return IRQ_NONE;
667 +
668 + prefetch(&hw->st_le[hw->st_idx]);
669 + if (likely(__netif_rx_schedule_prep(dev0)))
670 + __netif_rx_schedule(dev0);
671 + else
672 + printk(KERN_DEBUG PFX "irq race detected\n");
673
674 return IRQ_HANDLED;
675 }
676 @@ -2238,6 +2210,23 @@ static int sky2_reset(struct sky2_hw *hw
677 return -EOPNOTSUPP;
678 }
679
680 + hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4;
681 +
682 + /* This rev is really old, and requires untested workarounds */
683 + if (hw->chip_id == CHIP_ID_YUKON_EC && hw->chip_rev == CHIP_REV_YU_EC_A1) {
684 + printk(KERN_ERR PFX "%s: unsupported revision Yukon-%s (0x%x) rev %d\n",
685 + pci_name(hw->pdev), yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL],
686 + hw->chip_id, hw->chip_rev);
687 + return -EOPNOTSUPP;
688 + }
689 +
690 + /* This chip is new and not tested yet */
691 + if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
692 + pr_info(PFX "%s: is a version of Yukon 2 chipset that has not been tested yet.\n",
693 + pci_name(hw->pdev));
694 + pr_info("Please report success/failure to maintainer <shemminger@osdl.org>\n");
695 + }
696 +
697 /* disable ASF */
698 if (hw->chip_id <= CHIP_ID_YUKON_EC) {
699 sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
700 @@ -2258,7 +2247,7 @@ static int sky2_reset(struct sky2_hw *hw
701 sky2_write8(hw, B0_CTST, CS_MRST_CLR);
702
703 /* clear any PEX errors */
704 - if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP))
705 + if (pci_find_capability(hw->pdev, PCI_CAP_ID_EXP))
706 sky2_pci_write32(hw, PEX_UNC_ERR_STAT, 0xffffffffUL);
707
708
709 @@ -2271,7 +2260,6 @@ static int sky2_reset(struct sky2_hw *hw
710 if (!(sky2_read8(hw, B2_Y2_CLK_GATE) & Y2_STATUS_LNK2_INAC))
711 ++hw->ports;
712 }
713 - hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4;
714
715 sky2_set_power_state(hw, PCI_D0);
716
717 @@ -2337,30 +2325,18 @@ static int sky2_reset(struct sky2_hw *hw
718 /* Set the list last index */
719 sky2_write16(hw, STAT_LAST_IDX, STATUS_RING_SIZE - 1);
720
721 - /* These status setup values are copied from SysKonnect's driver */
722 - if (is_ec_a1(hw)) {
723 - /* WA for dev. #4.3 */
724 - sky2_write16(hw, STAT_TX_IDX_TH, 0xfff); /* Tx Threshold */
725 -
726 - /* set Status-FIFO watermark */
727 - sky2_write8(hw, STAT_FIFO_WM, 0x21); /* WA for dev. #4.18 */
728 -
729 - /* set Status-FIFO ISR watermark */
730 - sky2_write8(hw, STAT_FIFO_ISR_WM, 0x07); /* WA for dev. #4.18 */
731 - sky2_write32(hw, STAT_TX_TIMER_INI, sky2_us2clk(hw, 10000));
732 - } else {
733 - sky2_write16(hw, STAT_TX_IDX_TH, 10);
734 - sky2_write8(hw, STAT_FIFO_WM, 16);
735 + sky2_write16(hw, STAT_TX_IDX_TH, 10);
736 + sky2_write8(hw, STAT_FIFO_WM, 16);
737
738 - /* set Status-FIFO ISR watermark */
739 - if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev == 0)
740 - sky2_write8(hw, STAT_FIFO_ISR_WM, 4);
741 - else
742 - sky2_write8(hw, STAT_FIFO_ISR_WM, 16);
743 + /* set Status-FIFO ISR watermark */
744 + if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev == 0)
745 + sky2_write8(hw, STAT_FIFO_ISR_WM, 4);
746 + else
747 + sky2_write8(hw, STAT_FIFO_ISR_WM, 16);
748
749 - sky2_write32(hw, STAT_TX_TIMER_INI, sky2_us2clk(hw, 1000));
750 - sky2_write32(hw, STAT_ISR_TIMER_INI, sky2_us2clk(hw, 7));
751 - }
752 + sky2_write32(hw, STAT_TX_TIMER_INI, sky2_us2clk(hw, 1000));
753 + sky2_write32(hw, STAT_ISR_TIMER_INI, sky2_us2clk(hw, 20));
754 + sky2_write32(hw, STAT_LEV_TIMER_INI, sky2_us2clk(hw, 100));
755
756 /* enable status unit */
757 sky2_write32(hw, STAT_CTRL, SC_STAT_OP_ON);
758 @@ -2502,17 +2478,34 @@ static const struct sky2_stat {
759 { "rx_unicast", GM_RXF_UC_OK },
760 { "tx_mac_pause", GM_TXF_MPAUSE },
761 { "rx_mac_pause", GM_RXF_MPAUSE },
762 - { "collisions", GM_TXF_SNG_COL },
763 + { "collisions", GM_TXF_COL },
764 { "late_collision",GM_TXF_LAT_COL },
765 { "aborted", GM_TXF_ABO_COL },
766 + { "single_collisions", GM_TXF_SNG_COL },
767 { "multi_collisions", GM_TXF_MUL_COL },
768 - { "fifo_underrun", GM_TXE_FIFO_UR },
769 - { "fifo_overflow", GM_RXE_FIFO_OV },
770 - { "rx_toolong", GM_RXF_LNG_ERR },
771 - { "rx_jabber", GM_RXF_JAB_PKT },
772 +
773 + { "rx_short", GM_RXF_SHT },
774 { "rx_runt", GM_RXE_FRAG },
775 + { "rx_64_byte_packets", GM_RXF_64B },
776 + { "rx_65_to_127_byte_packets", GM_RXF_127B },
777 + { "rx_128_to_255_byte_packets", GM_RXF_255B },
778 + { "rx_256_to_511_byte_packets", GM_RXF_511B },
779 + { "rx_512_to_1023_byte_packets", GM_RXF_1023B },
780 + { "rx_1024_to_1518_byte_packets", GM_RXF_1518B },
781 + { "rx_1518_to_max_byte_packets", GM_RXF_MAX_SZ },
782 { "rx_too_long", GM_RXF_LNG_ERR },
783 + { "rx_fifo_overflow", GM_RXE_FIFO_OV },
784 + { "rx_jabber", GM_RXF_JAB_PKT },
785 { "rx_fcs_error", GM_RXF_FCS_ERR },
786 +
787 + { "tx_64_byte_packets", GM_TXF_64B },
788 + { "tx_65_to_127_byte_packets", GM_TXF_127B },
789 + { "tx_128_to_255_byte_packets", GM_TXF_255B },
790 + { "tx_256_to_511_byte_packets", GM_TXF_511B },
791 + { "tx_512_to_1023_byte_packets", GM_TXF_1023B },
792 + { "tx_1024_to_1518_byte_packets", GM_TXF_1518B },
793 + { "tx_1519_to_max_byte_packets", GM_TXF_MAX_SZ },
794 + { "tx_fifo_underrun", GM_TXE_FIFO_UR },
795 };
796
797 static u32 sky2_get_rx_csum(struct net_device *dev)
798 @@ -2614,7 +2607,7 @@ static struct net_device_stats *sky2_get
799 sky2->net_stats.rx_bytes = data[1];
800 sky2->net_stats.tx_packets = data[2] + data[4] + data[6];
801 sky2->net_stats.rx_packets = data[3] + data[5] + data[7];
802 - sky2->net_stats.multicast = data[5] + data[7];
803 + sky2->net_stats.multicast = data[3] + data[5];
804 sky2->net_stats.collisions = data[10];
805 sky2->net_stats.tx_aborted_errors = data[12];
806
807 @@ -2743,7 +2736,7 @@ static int sky2_phys_id(struct net_devic
808 ms = data * 1000;
809
810 /* save initial values */
811 - down(&sky2->phy_sema);
812 + spin_lock_bh(&sky2->phy_lock);
813 if (hw->chip_id == CHIP_ID_YUKON_XL) {
814 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
815 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
816 @@ -2759,9 +2752,9 @@ static int sky2_phys_id(struct net_devic
817 sky2_led(hw, port, onoff);
818 onoff = !onoff;
819
820 - up(&sky2->phy_sema);
821 + spin_unlock_bh(&sky2->phy_lock);
822 interrupted = msleep_interruptible(250);
823 - down(&sky2->phy_sema);
824 + spin_lock_bh(&sky2->phy_lock);
825
826 ms -= 250;
827 }
828 @@ -2776,7 +2769,7 @@ static int sky2_phys_id(struct net_devic
829 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
830 gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover);
831 }
832 - up(&sky2->phy_sema);
833 + spin_unlock_bh(&sky2->phy_lock);
834
835 return 0;
836 }
837 @@ -2806,38 +2799,6 @@ static int sky2_set_pauseparam(struct ne
838 return err;
839 }
840
841 -#ifdef CONFIG_PM
842 -static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
843 -{
844 - struct sky2_port *sky2 = netdev_priv(dev);
845 -
846 - wol->supported = WAKE_MAGIC;
847 - wol->wolopts = sky2->wol ? WAKE_MAGIC : 0;
848 -}
849 -
850 -static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
851 -{
852 - struct sky2_port *sky2 = netdev_priv(dev);
853 - struct sky2_hw *hw = sky2->hw;
854 -
855 - if (wol->wolopts != WAKE_MAGIC && wol->wolopts != 0)
856 - return -EOPNOTSUPP;
857 -
858 - sky2->wol = wol->wolopts == WAKE_MAGIC;
859 -
860 - if (sky2->wol) {
861 - memcpy_toio(hw->regs + WOL_MAC_ADDR, dev->dev_addr, ETH_ALEN);
862 -
863 - sky2_write16(hw, WOL_CTRL_STAT,
864 - WOL_CTL_ENA_PME_ON_MAGIC_PKT |
865 - WOL_CTL_ENA_MAGIC_PKT_UNIT);
866 - } else
867 - sky2_write16(hw, WOL_CTRL_STAT, WOL_CTL_DEFAULT);
868 -
869 - return 0;
870 -}
871 -#endif
872 -
873 static int sky2_get_coalesce(struct net_device *dev,
874 struct ethtool_coalesce *ecmd)
875 {
876 @@ -2878,19 +2839,11 @@ static int sky2_set_coalesce(struct net_
877 {
878 struct sky2_port *sky2 = netdev_priv(dev);
879 struct sky2_hw *hw = sky2->hw;
880 - const u32 tmin = sky2_clk2us(hw, 1);
881 - const u32 tmax = 5000;
882 -
883 - if (ecmd->tx_coalesce_usecs != 0 &&
884 - (ecmd->tx_coalesce_usecs < tmin || ecmd->tx_coalesce_usecs > tmax))
885 - return -EINVAL;
886 + const u32 tmax = sky2_clk2us(hw, 0x0ffffff);
887
888 - if (ecmd->rx_coalesce_usecs != 0 &&
889 - (ecmd->rx_coalesce_usecs < tmin || ecmd->rx_coalesce_usecs > tmax))
890 - return -EINVAL;
891 -
892 - if (ecmd->rx_coalesce_usecs_irq != 0 &&
893 - (ecmd->rx_coalesce_usecs_irq < tmin || ecmd->rx_coalesce_usecs_irq > tmax))
894 + if (ecmd->tx_coalesce_usecs > tmax ||
895 + ecmd->rx_coalesce_usecs > tmax ||
896 + ecmd->rx_coalesce_usecs_irq > tmax)
897 return -EINVAL;
898
899 if (ecmd->tx_max_coalesced_frames >= TX_RING_SIZE-1)
900 @@ -3025,10 +2978,6 @@ static struct ethtool_ops sky2_ethtool_o
901 .set_ringparam = sky2_set_ringparam,
902 .get_pauseparam = sky2_get_pauseparam,
903 .set_pauseparam = sky2_set_pauseparam,
904 -#ifdef CONFIG_PM
905 - .get_wol = sky2_get_wol,
906 - .set_wol = sky2_set_wol,
907 -#endif
908 .phys_id = sky2_phys_id,
909 .get_stats_count = sky2_get_stats_count,
910 .get_ethtool_stats = sky2_get_ethtool_stats,
911 @@ -3082,16 +3031,15 @@ static __devinit struct net_device *sky2
912 sky2->speed = -1;
913 sky2->advertising = sky2_supported_modes(hw);
914
915 - /* Receive checksum disabled for Yukon XL
916 + /* Receive checksum disabled for Yukon XL
917 * because of observed problems with incorrect
918 * values when multiple packets are received in one interrupt
919 */
920 sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
921
922 - INIT_WORK(&sky2->phy_task, sky2_phy_task, sky2);
923 - init_MUTEX(&sky2->phy_sema);
924 + spin_lock_init(&sky2->phy_lock);
925 sky2->tx_pending = TX_DEF_PENDING;
926 - sky2->rx_pending = is_ec_a1(hw) ? 8 : RX_DEF_PENDING;
927 + sky2->rx_pending = RX_DEF_PENDING;
928 sky2->rx_bufsize = sky2_buf_size(ETH_DATA_LEN);
929
930 hw->dev[port] = dev;
931 @@ -3133,6 +3081,66 @@ static void __devinit sky2_show_addr(str
932 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
933 }
934
935 +/* Handle software interrupt used during MSI test */
936 +static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id,
937 + struct pt_regs *regs)
938 +{
939 + struct sky2_hw *hw = dev_id;
940 + u32 status = sky2_read32(hw, B0_Y2_SP_ISRC2);
941 +
942 + if (status == 0)
943 + return IRQ_NONE;
944 +
945 + if (status & Y2_IS_IRQ_SW) {
946 + hw->msi_detected = 1;
947 + wake_up(&hw->msi_wait);
948 + sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
949 + }
950 + sky2_write32(hw, B0_Y2_SP_ICR, 2);
951 +
952 + return IRQ_HANDLED;
953 +}
954 +
955 +/* Test interrupt path by forcing a a software IRQ */
956 +static int __devinit sky2_test_msi(struct sky2_hw *hw)
957 +{
958 + struct pci_dev *pdev = hw->pdev;
959 + int err;
960 +
961 + sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
962 +
963 + err = request_irq(pdev->irq, sky2_test_intr, SA_SHIRQ, DRV_NAME, hw);
964 + if (err) {
965 + printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
966 + pci_name(pdev), pdev->irq);
967 + return err;
968 + }
969 +
970 + init_waitqueue_head (&hw->msi_wait);
971 +
972 + sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ);
973 + wmb();
974 +
975 + wait_event_timeout(hw->msi_wait, hw->msi_detected, HZ/10);
976 +
977 + if (!hw->msi_detected) {
978 + /* MSI test failed, go back to INTx mode */
979 + printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, "
980 + "switching to INTx mode. Please report this failure to "
981 + "the PCI maintainer and include system chipset information.\n",
982 + pci_name(pdev));
983 +
984 + err = -EOPNOTSUPP;
985 + sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ);
986 + }
987 +
988 + sky2_write32(hw, B0_IMSK, 0);
989 +
990 + free_irq(pdev->irq, hw);
991 +
992 + return err;
993 +}
994 +
995 static int __devinit sky2_probe(struct pci_dev *pdev,
996 const struct pci_device_id *ent)
997 {
998 @@ -3201,7 +3209,6 @@ static int __devinit sky2_probe(struct p
999 goto err_out_free_hw;
1000 }
1001 hw->pm_cap = pm_cap;
1002 - spin_lock_init(&hw->hw_lock);
1003
1004 #ifdef __BIG_ENDIAN
1005 /* byte swap descriptors in hardware */
1006 @@ -3254,21 +3261,29 @@ static int __devinit sky2_probe(struct p
1007 }
1008 }
1009
1010 - err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ, DRV_NAME, hw);
1011 + if (!disable_msi && pci_enable_msi(pdev) == 0) {
1012 + err = sky2_test_msi(hw);
1013 + if (err == -EOPNOTSUPP)
1014 + pci_disable_msi(pdev);
1015 + else if (err)
1016 + goto err_out_unregister;
1017 + }
1018 +
1019 + err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ, DRV_NAME, hw);
1020 if (err) {
1021 printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
1022 pci_name(pdev), pdev->irq);
1023 goto err_out_unregister;
1024 }
1025
1026 - hw->intr_mask = Y2_IS_BASE;
1027 - sky2_write32(hw, B0_IMSK, hw->intr_mask);
1028 + sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
1029
1030 pci_set_drvdata(pdev, hw);
1031
1032 return 0;
1033
1034 err_out_unregister:
1035 + pci_disable_msi(pdev);
1036 if (dev1) {
1037 unregister_netdev(dev1);
1038 free_netdev(dev1);
1039 @@ -3311,6 +3326,7 @@ static void __devexit sky2_remove(struct
1040 sky2_read8(hw, B0_CTST);
1041
1042 free_irq(pdev->irq, hw);
1043 + pci_disable_msi(pdev);
1044 pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma);
1045 pci_release_regions(pdev);
1046 pci_disable_device(pdev);
1047 --- linux/drivers/net/sky2.h 2006-04-19 09:13:28.000000000 +0000
1048 +++ linux/drivers/net/sky2.h 2006-04-19 10:19:11.000000000 +0000
1049 @@ -278,13 +278,11 @@ enum {
1050 Y2_IS_CHK_TXS1 = 1<<1, /* Descriptor error TXS 1 */
1051 Y2_IS_CHK_TXA1 = 1<<0, /* Descriptor error TXA 1 */
1052
1053 - Y2_IS_BASE = Y2_IS_HW_ERR | Y2_IS_STAT_BMU |
1054 - Y2_IS_POLL_CHK | Y2_IS_TWSI_RDY |
1055 - Y2_IS_IRQ_SW | Y2_IS_TIMINT,
1056 - Y2_IS_PORT_1 = Y2_IS_IRQ_PHY1 | Y2_IS_IRQ_MAC1 |
1057 - Y2_IS_CHK_RX1 | Y2_IS_CHK_TXA1 | Y2_IS_CHK_TXS1,
1058 - Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2 |
1059 - Y2_IS_CHK_RX2 | Y2_IS_CHK_TXA2 | Y2_IS_CHK_TXS2,
1060 + Y2_IS_BASE = Y2_IS_HW_ERR | Y2_IS_STAT_BMU,
1061 + Y2_IS_PORT_1 = Y2_IS_IRQ_PHY1 | Y2_IS_IRQ_MAC1
1062 + | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1,
1063 + Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2
1064 + | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2,
1065 };
1066
1067 /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */
1068 @@ -1375,31 +1373,30 @@ enum {
1069 GM_SMI_CTRL = 0x0080, /* 16 bit r/w SMI Control Register */
1070 GM_SMI_DATA = 0x0084, /* 16 bit r/w SMI Data Register */
1071 GM_PHY_ADDR = 0x0088, /* 16 bit r/w GPHY Address Register */
1072 -};
1073 -
1074 /* MIB Counters */
1075 -#define GM_MIB_CNT_BASE 0x0100 /* Base Address of MIB Counters */
1076 -#define GM_MIB_CNT_SIZE 44 /* Number of MIB Counters */
1077 -#define GM_MIB_CNT_END 0x025C /* Last MIB counter */
1078 + GM_MIB_CNT_BASE = 0x0100, /* Base Address of MIB Counters */
1079 + GM_MIB_CNT_SIZE = 256, /* Number of MIB Counters */
1080 + GM_MIB_CNT_END = 0x025C, /* Last MIB counter */
1081 +};
1082
1083 /*
1084 * MIB Counters base address definitions (low word) -
1085 * use offset 4 for access to high word (32 bit r/o)
1086 */
1087 enum {
1088 - GM_RXF_UC_OK = GM_MIB_CNT_BASE + 0, /* Unicast Frames Received OK */
1089 - GM_RXF_BC_OK = GM_MIB_CNT_BASE + 8, /* Broadcast Frames Received OK */
1090 - GM_RXF_MPAUSE = GM_MIB_CNT_BASE + 16, /* Pause MAC Ctrl Frames Received */
1091 - GM_RXF_MC_OK = GM_MIB_CNT_BASE + 24, /* Multicast Frames Received OK */
1092 - GM_RXF_FCS_ERR = GM_MIB_CNT_BASE + 32, /* Rx Frame Check Seq. Error */
1093 - /* GM_MIB_CNT_BASE + 40: reserved */
1094 - GM_RXO_OK_LO = GM_MIB_CNT_BASE + 48, /* Octets Received OK Low */
1095 - GM_RXO_OK_HI = GM_MIB_CNT_BASE + 56, /* Octets Received OK High */
1096 - GM_RXO_ERR_LO = GM_MIB_CNT_BASE + 64, /* Octets Received Invalid Low */
1097 - GM_RXO_ERR_HI = GM_MIB_CNT_BASE + 72, /* Octets Received Invalid High */
1098 - GM_RXF_SHT = GM_MIB_CNT_BASE + 80, /* Frames <64 Byte Received OK */
1099 - GM_RXE_FRAG = GM_MIB_CNT_BASE + 88, /* Frames <64 Byte Received with FCS Err */
1100 - GM_RXF_64B = GM_MIB_CNT_BASE + 96, /* 64 Byte Rx Frame */
1101 + GM_RXF_UC_OK = GM_MIB_CNT_BASE + 0, /* Unicast Frames Received OK */
1102 + GM_RXF_BC_OK = GM_MIB_CNT_BASE + 8, /* Broadcast Frames Received OK */
1103 + GM_RXF_MPAUSE = GM_MIB_CNT_BASE + 16, /* Pause MAC Ctrl Frames Received */
1104 + GM_RXF_MC_OK = GM_MIB_CNT_BASE + 24, /* Multicast Frames Received OK */
1105 + GM_RXF_FCS_ERR = GM_MIB_CNT_BASE + 32, /* Rx Frame Check Seq. Error */
1106 +
1107 + GM_RXO_OK_LO = GM_MIB_CNT_BASE + 48, /* Octets Received OK Low */
1108 + GM_RXO_OK_HI = GM_MIB_CNT_BASE + 56, /* Octets Received OK High */
1109 + GM_RXO_ERR_LO = GM_MIB_CNT_BASE + 64, /* Octets Received Invalid Low */
1110 + GM_RXO_ERR_HI = GM_MIB_CNT_BASE + 72, /* Octets Received Invalid High */
1111 + GM_RXF_SHT = GM_MIB_CNT_BASE + 80, /* Frames <64 Byte Received OK */
1112 + GM_RXE_FRAG = GM_MIB_CNT_BASE + 88, /* Frames <64 Byte Received with FCS Err */
1113 + GM_RXF_64B = GM_MIB_CNT_BASE + 96, /* 64 Byte Rx Frame */
1114 GM_RXF_127B = GM_MIB_CNT_BASE + 104, /* 65-127 Byte Rx Frame */
1115 GM_RXF_255B = GM_MIB_CNT_BASE + 112, /* 128-255 Byte Rx Frame */
1116 GM_RXF_511B = GM_MIB_CNT_BASE + 120, /* 256-511 Byte Rx Frame */
1117 @@ -1408,9 +1405,9 @@ enum {
1118 GM_RXF_MAX_SZ = GM_MIB_CNT_BASE + 144, /* 1519-MaxSize Byte Rx Frame */
1119 GM_RXF_LNG_ERR = GM_MIB_CNT_BASE + 152, /* Rx Frame too Long Error */
1120 GM_RXF_JAB_PKT = GM_MIB_CNT_BASE + 160, /* Rx Jabber Packet Frame */
1121 - /* GM_MIB_CNT_BASE + 168: reserved */
1122 +
1123 GM_RXE_FIFO_OV = GM_MIB_CNT_BASE + 176, /* Rx FIFO overflow Event */
1124 - /* GM_MIB_CNT_BASE + 184: reserved */
1125 +
1126 GM_TXF_UC_OK = GM_MIB_CNT_BASE + 192, /* Unicast Frames Xmitted OK */
1127 GM_TXF_BC_OK = GM_MIB_CNT_BASE + 200, /* Broadcast Frames Xmitted OK */
1128 GM_TXF_MPAUSE = GM_MIB_CNT_BASE + 208, /* Pause MAC Ctrl Frames Xmitted */
1129 @@ -1833,6 +1830,7 @@ struct sky2_port {
1130 struct net_device *netdev;
1131 unsigned port;
1132 u32 msg_enable;
1133 + spinlock_t phy_lock;
1134
1135 spinlock_t tx_lock ____cacheline_aligned_in_smp;
1136 struct tx_ring_info *tx_ring;
1137 @@ -1841,7 +1839,6 @@ struct sky2_port {
1138 u16 tx_prod; /* next le to use */
1139 u32 tx_addr64;
1140 u16 tx_pending;
1141 - u16 tx_last_put;
1142 u16 tx_last_mss;
1143
1144 struct ring_info *rx_ring ____cacheline_aligned_in_smp;
1145 @@ -1850,7 +1847,6 @@ struct sky2_port {
1146 u16 rx_next; /* next re to check */
1147 u16 rx_put; /* next le index to use */
1148 u16 rx_pending;
1149 - u16 rx_last_put;
1150 u16 rx_bufsize;
1151 #ifdef SKY2_VLAN_TAG_USED
1152 u16 rx_tag;
1153 @@ -1866,20 +1862,14 @@ struct sky2_port {
1154 u8 rx_pause;
1155 u8 tx_pause;
1156 u8 rx_csum;
1157 - u8 wol;
1158
1159 struct net_device_stats net_stats;
1160 -
1161 - struct work_struct phy_task;
1162 - struct semaphore phy_sema;
1163 };
1164
1165 struct sky2_hw {
1166 void __iomem *regs;
1167 struct pci_dev *pdev;
1168 struct net_device *dev[2];
1169 - spinlock_t hw_lock;
1170 - u32 intr_mask;
1171
1172 int pm_cap;
1173 u8 chip_id;
1174 @@ -1890,6 +1880,8 @@ struct sky2_hw {
1175 struct sky2_status_le *st_le;
1176 u32 st_idx;
1177 dma_addr_t st_dma;
1178 + int msi_detected;
1179 + wait_queue_head_t msi_wait;
1180 };
1181
1182 /* Register accessor for memory mapped device */

  ViewVC Help
Powered by ViewVC 1.1.20