/[linux-patches]/genpatches-2.6/trunk/2.6.16/2405_skge-1.5.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.16/2405_skge-1.5.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 344 - (show annotations) (download) (as text)
Mon Mar 27 12:30:15 2006 UTC (14 years, 8 months ago) by dsd
File MIME type: text/x-diff
File size: 20667 byte(s)
skge update, hopefully solves performance issues
1 --- linux-2.6.16-gentoo/drivers/net/skge.c 2006-03-20 15:45:48.000000000 +0000
2 +++ linux-dsd/drivers/net/skge.c 2006-03-27 13:28:41.000000000 +0100
3 @@ -44,7 +44,7 @@
4 #include "skge.h"
5
6 #define DRV_NAME "skge"
7 -#define DRV_VERSION "1.3"
8 +#define DRV_VERSION "1.5"
9 #define PFX DRV_NAME " "
10
11 #define DEFAULT_TX_RING_SIZE 128
12 @@ -104,7 +104,6 @@ static const int txqaddr[] = { Q_XA1, Q_
13 static const int rxqaddr[] = { Q_R1, Q_R2 };
14 static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F };
15 static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F };
16 -static const u32 portirqmask[] = { IS_PORT_1, IS_PORT_2 };
17
18 static int skge_get_regs_len(struct net_device *dev)
19 {
20 @@ -358,7 +357,7 @@ static struct net_device_stats *skge_get
21 skge->net_stats.rx_bytes = data[1];
22 skge->net_stats.tx_packets = data[2] + data[4] + data[6];
23 skge->net_stats.rx_packets = data[3] + data[5] + data[7];
24 - skge->net_stats.multicast = data[5] + data[7];
25 + skge->net_stats.multicast = data[3] + data[5];
26 skge->net_stats.collisions = data[10];
27 skge->net_stats.tx_aborted_errors = data[12];
28
29 @@ -728,19 +727,18 @@ static struct ethtool_ops skge_ethtool_o
30 * Allocate ring elements and chain them together
31 * One-to-one association of board descriptors with ring elements
32 */
33 -static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u64 base)
34 +static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base)
35 {
36 struct skge_tx_desc *d;
37 struct skge_element *e;
38 int i;
39
40 - ring->start = kmalloc(sizeof(*e)*ring->count, GFP_KERNEL);
41 + ring->start = kcalloc(sizeof(*e), ring->count, GFP_KERNEL);
42 if (!ring->start)
43 return -ENOMEM;
44
45 for (i = 0, e = ring->start, d = vaddr; i < ring->count; i++, e++, d++) {
46 e->desc = d;
47 - e->skb = NULL;
48 if (i == ring->count - 1) {
49 e->next = ring->start;
50 d->next_offset = base;
51 @@ -783,7 +781,7 @@ static void skge_rx_setup(struct skge_po
52 * Note: DMA address is not changed by chip.
53 * MTU not changed while receiver active.
54 */
55 -static void skge_rx_reuse(struct skge_element *e, unsigned int size)
56 +static inline void skge_rx_reuse(struct skge_element *e, unsigned int size)
57 {
58 struct skge_rx_desc *rd = e->desc;
59
60 @@ -831,7 +829,7 @@ static int skge_rx_fill(struct skge_port
61 do {
62 struct sk_buff *skb;
63
64 - skb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN);
65 + skb = alloc_skb(skge->rx_buf_size + NET_IP_ALIGN, GFP_KERNEL);
66 if (!skb)
67 return -ENOMEM;
68
69 @@ -849,8 +847,7 @@ static void skge_link_up(struct skge_por
70 LED_BLK_OFF|LED_SYNC_OFF|LED_ON);
71
72 netif_carrier_on(skge->netdev);
73 - if (skge->tx_avail > MAX_SKB_FRAGS + 1)
74 - netif_wake_queue(skge->netdev);
75 + netif_wake_queue(skge->netdev);
76
77 if (netif_msg_link(skge))
78 printk(KERN_INFO PFX
79 @@ -2157,7 +2154,7 @@ static int skge_up(struct net_device *de
80 printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
81
82 if (dev->mtu > RX_BUF_SIZE)
83 - skge->rx_buf_size = dev->mtu + ETH_HLEN + NET_IP_ALIGN;
84 + skge->rx_buf_size = dev->mtu + ETH_HLEN;
85 else
86 skge->rx_buf_size = RX_BUF_SIZE;
87
88 @@ -2169,27 +2166,29 @@ static int skge_up(struct net_device *de
89 if (!skge->mem)
90 return -ENOMEM;
91
92 + BUG_ON(skge->dma & 7);
93 +
94 + if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) {
95 + printk(KERN_ERR PFX "pci_alloc_consistent region crosses 4G boundary\n");
96 + err = -EINVAL;
97 + goto free_pci_mem;
98 + }
99 +
100 memset(skge->mem, 0, skge->mem_size);
101
102 - if ((err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma)))
103 + err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma);
104 + if (err)
105 goto free_pci_mem;
106
107 err = skge_rx_fill(skge);
108 if (err)
109 goto free_rx_ring;
110
111 - if ((err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size,
112 - skge->dma + rx_size)))
113 + err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size,
114 + skge->dma + rx_size);
115 + if (err)
116 goto free_rx_ring;
117
118 - skge->tx_avail = skge->tx_ring.count - 1;
119 -
120 - /* Enable IRQ from port */
121 - spin_lock_irq(&hw->hw_lock);
122 - hw->intr_mask |= portirqmask[port];
123 - skge_write32(hw, B0_IMSK, hw->intr_mask);
124 - spin_unlock_irq(&hw->hw_lock);
125 -
126 /* Initialize MAC */
127 spin_lock_bh(&hw->phy_lock);
128 if (hw->chip_id == CHIP_ID_GENESIS)
129 @@ -2246,11 +2245,6 @@ static int skge_down(struct net_device *
130 else
131 yukon_stop(skge);
132
133 - spin_lock_irq(&hw->hw_lock);
134 - hw->intr_mask &= ~portirqmask[skge->port];
135 - skge_write32(hw, B0_IMSK, hw->intr_mask);
136 - spin_unlock_irq(&hw->hw_lock);
137 -
138 /* Stop transmitter */
139 skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP);
140 skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL),
141 @@ -2297,6 +2291,12 @@ static int skge_down(struct net_device *
142 return 0;
143 }
144
145 +static inline int skge_avail(const struct skge_ring *ring)
146 +{
147 + return ((ring->to_clean > ring->to_use) ? 0 : ring->count)
148 + + (ring->to_clean - ring->to_use) - 1;
149 +}
150 +
151 static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev)
152 {
153 struct skge_port *skge = netdev_priv(dev);
154 @@ -2307,27 +2307,24 @@ static int skge_xmit_frame(struct sk_buf
155 int i;
156 u32 control, len;
157 u64 map;
158 - unsigned long flags;
159
160 skb = skb_padto(skb, ETH_ZLEN);
161 if (!skb)
162 return NETDEV_TX_OK;
163
164 - local_irq_save(flags);
165 if (!spin_trylock(&skge->tx_lock)) {
166 - /* Collision - tell upper layer to requeue */
167 - local_irq_restore(flags);
168 - return NETDEV_TX_LOCKED;
169 - }
170 + /* Collision - tell upper layer to requeue */
171 + return NETDEV_TX_LOCKED;
172 + }
173
174 - if (unlikely(skge->tx_avail < skb_shinfo(skb)->nr_frags +1)) {
175 + if (unlikely(skge_avail(&skge->tx_ring) < skb_shinfo(skb)->nr_frags + 1)) {
176 if (!netif_queue_stopped(dev)) {
177 netif_stop_queue(dev);
178
179 printk(KERN_WARNING PFX "%s: ring full when queue awake!\n",
180 dev->name);
181 }
182 - spin_unlock_irqrestore(&skge->tx_lock, flags);
183 + spin_unlock(&skge->tx_lock);
184 return NETDEV_TX_BUSY;
185 }
186
187 @@ -2396,49 +2393,51 @@ static int skge_xmit_frame(struct sk_buf
188 dev->name, e - ring->start, skb->len);
189
190 ring->to_use = e->next;
191 - skge->tx_avail -= skb_shinfo(skb)->nr_frags + 1;
192 - if (skge->tx_avail <= MAX_SKB_FRAGS + 1) {
193 + if (skge_avail(&skge->tx_ring) <= MAX_SKB_FRAGS + 1) {
194 pr_debug("%s: transmit queue full\n", dev->name);
195 netif_stop_queue(dev);
196 }
197
198 + mmiowb();
199 + spin_unlock(&skge->tx_lock);
200 +
201 dev->trans_start = jiffies;
202 - spin_unlock_irqrestore(&skge->tx_lock, flags);
203
204 return NETDEV_TX_OK;
205 }
206
207 -static inline void skge_tx_free(struct skge_hw *hw, struct skge_element *e)
208 +static void skge_tx_complete(struct skge_port *skge, struct skge_element *last)
209 {
210 - /* This ring element can be skb or fragment */
211 - if (e->skb) {
212 - pci_unmap_single(hw->pdev,
213 - pci_unmap_addr(e, mapaddr),
214 - pci_unmap_len(e, maplen),
215 - PCI_DMA_TODEVICE);
216 - dev_kfree_skb_any(e->skb);
217 + struct pci_dev *pdev = skge->hw->pdev;
218 + struct skge_element *e;
219 +
220 + for (e = skge->tx_ring.to_clean; e != last; e = e->next) {
221 + struct sk_buff *skb = e->skb;
222 + int i;
223 +
224 e->skb = NULL;
225 - } else {
226 - pci_unmap_page(hw->pdev,
227 - pci_unmap_addr(e, mapaddr),
228 - pci_unmap_len(e, maplen),
229 - PCI_DMA_TODEVICE);
230 + pci_unmap_single(pdev, pci_unmap_addr(e, mapaddr),
231 + skb_headlen(skb), PCI_DMA_TODEVICE);
232 +
233 + for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
234 + e = e->next;
235 + pci_unmap_page(pdev, pci_unmap_addr(e, mapaddr),
236 + skb_shinfo(skb)->frags[i].size,
237 + PCI_DMA_TODEVICE);
238 + }
239 +
240 + dev_kfree_skb(skb);
241 }
242 + skge->tx_ring.to_clean = e;
243 }
244
245 static void skge_tx_clean(struct skge_port *skge)
246 {
247 - struct skge_ring *ring = &skge->tx_ring;
248 - struct skge_element *e;
249 - unsigned long flags;
250
251 - spin_lock_irqsave(&skge->tx_lock, flags);
252 - for (e = ring->to_clean; e != ring->to_use; e = e->next) {
253 - ++skge->tx_avail;
254 - skge_tx_free(skge->hw, e);
255 - }
256 - ring->to_clean = e;
257 - spin_unlock_irqrestore(&skge->tx_lock, flags);
258 + spin_lock_bh(&skge->tx_lock);
259 + skge_tx_complete(skge, skge->tx_ring.to_use);
260 + netif_wake_queue(skge->netdev);
261 + spin_unlock_bh(&skge->tx_lock);
262 }
263
264 static void skge_tx_timeout(struct net_device *dev)
265 @@ -2597,7 +2596,7 @@ static inline struct sk_buff *skge_rx_ge
266 goto error;
267
268 if (len < RX_COPY_THRESHOLD) {
269 - skb = dev_alloc_skb(len + 2);
270 + skb = alloc_skb(len + 2, GFP_ATOMIC);
271 if (!skb)
272 goto resubmit;
273
274 @@ -2612,10 +2611,11 @@ static inline struct sk_buff *skge_rx_ge
275 skge_rx_reuse(e, skge->rx_buf_size);
276 } else {
277 struct sk_buff *nskb;
278 - nskb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN);
279 + nskb = alloc_skb(skge->rx_buf_size + NET_IP_ALIGN, GFP_ATOMIC);
280 if (!nskb)
281 goto resubmit;
282
283 + skb_reserve(nskb, NET_IP_ALIGN);
284 pci_unmap_single(skge->hw->pdev,
285 pci_unmap_addr(e, mapaddr),
286 pci_unmap_len(e, maplen),
287 @@ -2663,6 +2663,36 @@ resubmit:
288 return NULL;
289 }
290
291 +static void skge_tx_done(struct skge_port *skge)
292 +{
293 + struct skge_ring *ring = &skge->tx_ring;
294 + struct skge_element *e, *last;
295 +
296 + spin_lock(&skge->tx_lock);
297 + last = ring->to_clean;
298 + for (e = ring->to_clean; e != ring->to_use; e = e->next) {
299 + struct skge_tx_desc *td = e->desc;
300 +
301 + if (td->control & BMU_OWN)
302 + break;
303 +
304 + if (td->control & BMU_EOF) {
305 + last = e->next;
306 + if (unlikely(netif_msg_tx_done(skge)))
307 + printk(KERN_DEBUG PFX "%s: tx done slot %td\n",
308 + skge->netdev->name, e - ring->start);
309 + }
310 + }
311 +
312 + skge_tx_complete(skge, last);
313 +
314 + skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F);
315 +
316 + if (skge_avail(&skge->tx_ring) > MAX_SKB_FRAGS + 1)
317 + netif_wake_queue(skge->netdev);
318 +
319 + spin_unlock(&skge->tx_lock);
320 +}
321
322 static int skge_poll(struct net_device *dev, int *budget)
323 {
324 @@ -2670,8 +2700,10 @@ static int skge_poll(struct net_device *
325 struct skge_hw *hw = skge->hw;
326 struct skge_ring *ring = &skge->rx_ring;
327 struct skge_element *e;
328 - unsigned int to_do = min(dev->quota, *budget);
329 - unsigned int work_done = 0;
330 + int to_do = min(dev->quota, *budget);
331 + int work_done = 0;
332 +
333 + skge_tx_done(skge);
334
335 for (e = ring->to_clean; prefetch(e->next), work_done < to_do; e = e->next) {
336 struct skge_rx_desc *rd = e->desc;
337 @@ -2683,15 +2715,14 @@ static int skge_poll(struct net_device *
338 if (control & BMU_OWN)
339 break;
340
341 - skb = skge_rx_get(skge, e, control, rd->status,
342 - le16_to_cpu(rd->csum2));
343 + skb = skge_rx_get(skge, e, control, rd->status,
344 + le16_to_cpu(rd->csum2));
345 if (likely(skb)) {
346 dev->last_rx = jiffies;
347 netif_receive_skb(skb);
348
349 ++work_done;
350 - } else
351 - skge_rx_reuse(e, skge->rx_buf_size);
352 + }
353 }
354 ring->to_clean = e;
355
356 @@ -2705,49 +2736,15 @@ static int skge_poll(struct net_device *
357 if (work_done >= to_do)
358 return 1; /* not done */
359
360 - spin_lock_irq(&hw->hw_lock);
361 - __netif_rx_complete(dev);
362 - hw->intr_mask |= portirqmask[skge->port];
363 + netif_rx_complete(dev);
364 + mmiowb();
365 +
366 + hw->intr_mask |= skge->port == 0 ? (IS_R1_F|IS_XA1_F) : (IS_R2_F|IS_XA2_F);
367 skge_write32(hw, B0_IMSK, hw->intr_mask);
368 - spin_unlock_irq(&hw->hw_lock);
369
370 return 0;
371 }
372
373 -static inline void skge_tx_intr(struct net_device *dev)
374 -{
375 - struct skge_port *skge = netdev_priv(dev);
376 - struct skge_hw *hw = skge->hw;
377 - struct skge_ring *ring = &skge->tx_ring;
378 - struct skge_element *e;
379 -
380 - spin_lock(&skge->tx_lock);
381 - for (e = ring->to_clean; prefetch(e->next), e != ring->to_use; e = e->next) {
382 - struct skge_tx_desc *td = e->desc;
383 - u32 control;
384 -
385 - rmb();
386 - control = td->control;
387 - if (control & BMU_OWN)
388 - break;
389 -
390 - if (unlikely(netif_msg_tx_done(skge)))
391 - printk(KERN_DEBUG PFX "%s: tx done slot %td status 0x%x\n",
392 - dev->name, e - ring->start, td->status);
393 -
394 - skge_tx_free(hw, e);
395 - e->skb = NULL;
396 - ++skge->tx_avail;
397 - }
398 - ring->to_clean = e;
399 - skge_write8(hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F);
400 -
401 - if (skge->tx_avail > MAX_SKB_FRAGS + 1)
402 - netif_wake_queue(dev);
403 -
404 - spin_unlock(&skge->tx_lock);
405 -}
406 -
407 /* Parity errors seem to happen when Genesis is connected to a switch
408 * with no other ports present. Heartbeat error??
409 */
410 @@ -2770,17 +2767,6 @@ static void skge_mac_parity(struct skge_
411 ? GMF_CLI_TX_FC : GMF_CLI_TX_PE);
412 }
413
414 -static void skge_pci_clear(struct skge_hw *hw)
415 -{
416 - u16 status;
417 -
418 - pci_read_config_word(hw->pdev, PCI_STATUS, &status);
419 - skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
420 - pci_write_config_word(hw->pdev, PCI_STATUS,
421 - status | PCI_STATUS_ERROR_BITS);
422 - skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
423 -}
424 -
425 static void skge_mac_intr(struct skge_hw *hw, int port)
426 {
427 if (hw->chip_id == CHIP_ID_GENESIS)
428 @@ -2822,23 +2808,39 @@ static void skge_error_irq(struct skge_h
429 if (hwstatus & IS_M2_PAR_ERR)
430 skge_mac_parity(hw, 1);
431
432 - if (hwstatus & IS_R1_PAR_ERR)
433 + if (hwstatus & IS_R1_PAR_ERR) {
434 + printk(KERN_ERR PFX "%s: receive queue parity error\n",
435 + hw->dev[0]->name);
436 skge_write32(hw, B0_R1_CSR, CSR_IRQ_CL_P);
437 + }
438
439 - if (hwstatus & IS_R2_PAR_ERR)
440 + if (hwstatus & IS_R2_PAR_ERR) {
441 + printk(KERN_ERR PFX "%s: receive queue parity error\n",
442 + hw->dev[1]->name);
443 skge_write32(hw, B0_R2_CSR, CSR_IRQ_CL_P);
444 + }
445
446 if (hwstatus & (IS_IRQ_MST_ERR|IS_IRQ_STAT)) {
447 - printk(KERN_ERR PFX "hardware error detected (status 0x%x)\n",
448 - hwstatus);
449 + u16 pci_status, pci_cmd;
450
451 - skge_pci_clear(hw);
452 + pci_read_config_word(hw->pdev, PCI_COMMAND, &pci_cmd);
453 + pci_read_config_word(hw->pdev, PCI_STATUS, &pci_status);
454 +
455 + printk(KERN_ERR PFX "%s: PCI error cmd=%#x status=%#x\n",
456 + pci_name(hw->pdev), pci_cmd, pci_status);
457 +
458 + /* Write the error bits back to clear them. */
459 + pci_status &= PCI_STATUS_ERROR_BITS;
460 + skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
461 + pci_write_config_word(hw->pdev, PCI_COMMAND,
462 + pci_cmd | PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
463 + pci_write_config_word(hw->pdev, PCI_STATUS, pci_status);
464 + skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
465
466 /* if error still set then just ignore it */
467 hwstatus = skge_read32(hw, B0_HWE_ISRC);
468 if (hwstatus & IS_IRQ_STAT) {
469 - pr_debug("IRQ status %x: still set ignoring hardware errors\n",
470 - hwstatus);
471 + printk(KERN_INFO PFX "unable to clear error (so ignoring them)\n");
472 hw->intr_mask &= ~IS_HW_ERR;
473 }
474 }
475 @@ -2855,12 +2857,11 @@ static void skge_extirq(unsigned long da
476 int port;
477
478 spin_lock(&hw->phy_lock);
479 - for (port = 0; port < 2; port++) {
480 + for (port = 0; port < hw->ports; port++) {
481 struct net_device *dev = hw->dev[port];
482 + struct skge_port *skge = netdev_priv(dev);
483
484 - if (dev && netif_running(dev)) {
485 - struct skge_port *skge = netdev_priv(dev);
486 -
487 + if (netif_running(dev)) {
488 if (hw->chip_id != CHIP_ID_GENESIS)
489 yukon_phy_intr(skge);
490 else
491 @@ -2869,38 +2870,39 @@ static void skge_extirq(unsigned long da
492 }
493 spin_unlock(&hw->phy_lock);
494
495 - spin_lock_irq(&hw->hw_lock);
496 hw->intr_mask |= IS_EXT_REG;
497 skge_write32(hw, B0_IMSK, hw->intr_mask);
498 - spin_unlock_irq(&hw->hw_lock);
499 }
500
501 static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs)
502 {
503 struct skge_hw *hw = dev_id;
504 - u32 status = skge_read32(hw, B0_SP_ISRC);
505 + u32 status;
506
507 - if (status == 0 || status == ~0) /* hotplug or shared irq */
508 + /* Reading this register masks IRQ */
509 + status = skge_read32(hw, B0_SP_ISRC);
510 + if (status == 0)
511 return IRQ_NONE;
512
513 - spin_lock(&hw->hw_lock);
514 - if (status & IS_R1_F) {
515 + if (status & IS_EXT_REG) {
516 + hw->intr_mask &= ~IS_EXT_REG;
517 + tasklet_schedule(&hw->ext_tasklet);
518 + }
519 +
520 + if (status & (IS_R1_F|IS_XA1_F)) {
521 skge_write8(hw, Q_ADDR(Q_R1, Q_CSR), CSR_IRQ_CL_F);
522 - hw->intr_mask &= ~IS_R1_F;
523 + hw->intr_mask &= ~(IS_R1_F|IS_XA1_F);
524 netif_rx_schedule(hw->dev[0]);
525 }
526
527 - if (status & IS_R2_F) {
528 + if (status & (IS_R2_F|IS_XA2_F)) {
529 skge_write8(hw, Q_ADDR(Q_R2, Q_CSR), CSR_IRQ_CL_F);
530 - hw->intr_mask &= ~IS_R2_F;
531 + hw->intr_mask &= ~(IS_R2_F|IS_XA2_F);
532 netif_rx_schedule(hw->dev[1]);
533 }
534
535 - if (status & IS_XA1_F)
536 - skge_tx_intr(hw->dev[0]);
537 -
538 - if (status & IS_XA2_F)
539 - skge_tx_intr(hw->dev[1]);
540 + if (likely((status & hw->intr_mask) == 0))
541 + return IRQ_HANDLED;
542
543 if (status & IS_PA_TO_RX1) {
544 struct skge_port *skge = netdev_priv(hw->dev[0]);
545 @@ -2929,13 +2931,7 @@ static irqreturn_t skge_intr(int irq, vo
546 if (status & IS_HW_ERR)
547 skge_error_irq(hw);
548
549 - if (status & IS_EXT_REG) {
550 - hw->intr_mask &= ~IS_EXT_REG;
551 - tasklet_schedule(&hw->ext_tasklet);
552 - }
553 -
554 skge_write32(hw, B0_IMSK, hw->intr_mask);
555 - spin_unlock(&hw->hw_lock);
556
557 return IRQ_HANDLED;
558 }
559 @@ -3010,7 +3006,7 @@ static const char *skge_board_name(const
560 static int skge_reset(struct skge_hw *hw)
561 {
562 u32 reg;
563 - u16 ctst;
564 + u16 ctst, pci_status;
565 u8 t8, mac_cfg, pmd_type, phy_type;
566 int i;
567
568 @@ -3021,8 +3017,13 @@ static int skge_reset(struct skge_hw *hw
569 skge_write8(hw, B0_CTST, CS_RST_CLR);
570
571 /* clear PCI errors, if any */
572 - skge_pci_clear(hw);
573 + skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
574 + skge_write8(hw, B2_TST_CTRL2, 0);
575
576 + pci_read_config_word(hw->pdev, PCI_STATUS, &pci_status);
577 + pci_write_config_word(hw->pdev, PCI_STATUS,
578 + pci_status | PCI_STATUS_ERROR_BITS);
579 + skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
580 skge_write8(hw, B0_CTST, CS_MRST_CLR);
581
582 /* restore CLK_RUN bits (for Yukon-Lite) */
583 @@ -3081,7 +3082,10 @@ static int skge_reset(struct skge_hw *hw
584 else
585 hw->ram_size = t8 * 4096;
586
587 - hw->intr_mask = IS_HW_ERR | IS_EXT_REG;
588 + hw->intr_mask = IS_HW_ERR | IS_EXT_REG | IS_PORT_1;
589 + if (hw->ports > 1)
590 + hw->intr_mask |= IS_PORT_2;
591 +
592 if (hw->chip_id == CHIP_ID_GENESIS)
593 genesis_init(hw);
594 else {
595 @@ -3251,13 +3255,15 @@ static int __devinit skge_probe(struct p
596 struct skge_hw *hw;
597 int err, using_dac = 0;
598
599 - if ((err = pci_enable_device(pdev))) {
600 + err = pci_enable_device(pdev);
601 + if (err) {
602 printk(KERN_ERR PFX "%s cannot enable PCI device\n",
603 pci_name(pdev));
604 goto err_out;
605 }
606
607 - if ((err = pci_request_regions(pdev, DRV_NAME))) {
608 + err = pci_request_regions(pdev, DRV_NAME);
609 + if (err) {
610 printk(KERN_ERR PFX "%s cannot obtain PCI resources\n",
611 pci_name(pdev));
612 goto err_out_disable_pdev;
613 @@ -3265,22 +3271,18 @@ static int __devinit skge_probe(struct p
614
615 pci_set_master(pdev);
616
617 - if (sizeof(dma_addr_t) > sizeof(u32) &&
618 - !(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
619 + if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
620 using_dac = 1;
621 err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
622 - if (err < 0) {
623 - printk(KERN_ERR PFX "%s unable to obtain 64 bit DMA "
624 - "for consistent allocations\n", pci_name(pdev));
625 - goto err_out_free_regions;
626 - }
627 - } else {
628 - err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
629 - if (err) {
630 - printk(KERN_ERR PFX "%s no usable DMA configuration\n",
631 - pci_name(pdev));
632 - goto err_out_free_regions;
633 - }
634 + } else if (!(err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
635 + using_dac = 0;
636 + err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
637 + }
638 +
639 + if (err) {
640 + printk(KERN_ERR PFX "%s no usable DMA configuration\n",
641 + pci_name(pdev));
642 + goto err_out_free_regions;
643 }
644
645 #ifdef __BIG_ENDIAN
646 @@ -3304,7 +3306,6 @@ static int __devinit skge_probe(struct p
647
648 hw->pdev = pdev;
649 spin_lock_init(&hw->phy_lock);
650 - spin_lock_init(&hw->hw_lock);
651 tasklet_init(&hw->ext_tasklet, skge_extirq, (unsigned long) hw);
652
653 hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);
654 @@ -3314,7 +3315,8 @@ static int __devinit skge_probe(struct p
655 goto err_out_free_hw;
656 }
657
658 - if ((err = request_irq(pdev->irq, skge_intr, SA_SHIRQ, DRV_NAME, hw))) {
659 + err = request_irq(pdev->irq, skge_intr, SA_SHIRQ, DRV_NAME, hw);
660 + if (err) {
661 printk(KERN_ERR PFX "%s: cannot assign irq %d\n",
662 pci_name(pdev), pdev->irq);
663 goto err_out_iounmap;
664 @@ -3332,7 +3334,8 @@ static int __devinit skge_probe(struct p
665 if ((dev = skge_devinit(hw, 0, using_dac)) == NULL)
666 goto err_out_led_off;
667
668 - if ((err = register_netdev(dev))) {
669 + err = register_netdev(dev);
670 + if (err) {
671 printk(KERN_ERR PFX "%s: cannot register net device\n",
672 pci_name(pdev));
673 goto err_out_free_netdev;
674 @@ -3387,7 +3390,6 @@ static void __devexit skge_remove(struct
675
676 skge_write32(hw, B0_IMSK, 0);
677 skge_write16(hw, B0_LED, LED_STAT_OFF);
678 - skge_pci_clear(hw);
679 skge_write8(hw, B0_CTST, CS_RST_SET);
680
681 tasklet_kill(&hw->ext_tasklet);
682 --- linux-2.6.16-gentoo/drivers/net/skge.h 2006-03-20 15:45:48.000000000 +0000
683 +++ linux-dsd/drivers/net/skge.h 2006-03-27 13:28:32.000000000 +0100
684 @@ -2402,7 +2402,6 @@ struct skge_hw {
685
686 struct tasklet_struct ext_tasklet;
687 spinlock_t phy_lock;
688 - spinlock_t hw_lock;
689 };
690
691 enum {
692 @@ -2419,7 +2418,6 @@ struct skge_port {
693 int port;
694
695 spinlock_t tx_lock;
696 - u32 tx_avail;
697 struct skge_ring tx_ring;
698 struct skge_ring rx_ring;
699

  ViewVC Help
Powered by ViewVC 1.1.20