diff options
Diffstat (limited to 'drivers/net/3c501.c')
-rw-r--r-- | drivers/net/3c501.c | 232 |
1 files changed, 107 insertions, 125 deletions
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index be71868d1513..7d253686ed0d 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c | |||
@@ -17,7 +17,7 @@ | |||
17 | Annapolis MD 21403 | 17 | Annapolis MD 21403 |
18 | 18 | ||
19 | Fixed (again!) the missing interrupt locking on TX/RX shifting. | 19 | Fixed (again!) the missing interrupt locking on TX/RX shifting. |
20 | Alan Cox <Alan.Cox@linux.org> | 20 | Alan Cox <Alan.Cox@linux.org> |
21 | 21 | ||
22 | Removed calls to init_etherdev since they are no longer needed, and | 22 | Removed calls to init_etherdev since they are no longer needed, and |
23 | cleaned up modularization just a bit. The driver still allows only | 23 | cleaned up modularization just a bit. The driver still allows only |
@@ -29,16 +29,16 @@ | |||
29 | the board. Now getting 150K/second FTP with a 3c501 card. Still playing | 29 | the board. Now getting 150K/second FTP with a 3c501 card. Still playing |
30 | with a TX-TX optimisation to see if we can touch 180-200K/second as seems | 30 | with a TX-TX optimisation to see if we can touch 180-200K/second as seems |
31 | theoretically maximum. | 31 | theoretically maximum. |
32 | 19950402 Alan Cox <Alan.Cox@linux.org> | 32 | 19950402 Alan Cox <Alan.Cox@linux.org> |
33 | 33 | ||
34 | Cleaned up for 2.3.x because we broke SMP now. | 34 | Cleaned up for 2.3.x because we broke SMP now. |
35 | 20000208 Alan Cox <alan@redhat.com> | 35 | 20000208 Alan Cox <alan@redhat.com> |
36 | 36 | ||
37 | Check up pass for 2.5. Nothing significant changed | 37 | Check up pass for 2.5. Nothing significant changed |
38 | 20021009 Alan Cox <alan@redhat.com> | 38 | 20021009 Alan Cox <alan@redhat.com> |
39 | 39 | ||
40 | Fixed zero fill corner case | 40 | Fixed zero fill corner case |
41 | 20030104 Alan Cox <alan@redhat.com> | 41 | 20030104 Alan Cox <alan@redhat.com> |
42 | 42 | ||
43 | 43 | ||
44 | For the avoidance of doubt the "preferred form" of this code is one which | 44 | For the avoidance of doubt the "preferred form" of this code is one which |
@@ -139,8 +139,8 @@ static const char version[] = | |||
139 | * The boilerplate probe code. | 139 | * The boilerplate probe code. |
140 | */ | 140 | */ |
141 | 141 | ||
142 | static int io=0x280; | 142 | static int io = 0x280; |
143 | static int irq=5; | 143 | static int irq = 5; |
144 | static int mem_start; | 144 | static int mem_start; |
145 | 145 | ||
146 | /** | 146 | /** |
@@ -229,8 +229,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) | |||
229 | * Read the station address PROM data from the special port. | 229 | * Read the station address PROM data from the special port. |
230 | */ | 230 | */ |
231 | 231 | ||
232 | for (i = 0; i < 6; i++) | 232 | for (i = 0; i < 6; i++) { |
233 | { | ||
234 | outw(i, ioaddr + EL1_DATAPTR); | 233 | outw(i, ioaddr + EL1_DATAPTR); |
235 | station_addr[i] = inb(ioaddr + EL1_SAPROM); | 234 | station_addr[i] = inb(ioaddr + EL1_SAPROM); |
236 | } | 235 | } |
@@ -240,28 +239,24 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) | |||
240 | */ | 239 | */ |
241 | 240 | ||
242 | if (station_addr[0] == 0x02 && station_addr[1] == 0x60 | 241 | if (station_addr[0] == 0x02 && station_addr[1] == 0x60 |
243 | && station_addr[2] == 0x8c) | 242 | && station_addr[2] == 0x8c) |
244 | { | ||
245 | mname = "3c501"; | 243 | mname = "3c501"; |
246 | } else if (station_addr[0] == 0x00 && station_addr[1] == 0x80 | 244 | else if (station_addr[0] == 0x00 && station_addr[1] == 0x80 |
247 | && station_addr[2] == 0xC8) | 245 | && station_addr[2] == 0xC8) |
248 | { | ||
249 | mname = "NP943"; | 246 | mname = "NP943"; |
250 | } | 247 | else { |
251 | else { | ||
252 | release_region(ioaddr, EL1_IO_EXTENT); | 248 | release_region(ioaddr, EL1_IO_EXTENT); |
253 | return -ENODEV; | 249 | return -ENODEV; |
254 | } | 250 | } |
255 | 251 | ||
256 | /* | 252 | /* |
257 | * We auto-IRQ by shutting off the interrupt line and letting it float | 253 | * We auto-IRQ by shutting off the interrupt line and letting it |
258 | * high. | 254 | * float high. |
259 | */ | 255 | */ |
260 | 256 | ||
261 | dev->irq = irq; | 257 | dev->irq = irq; |
262 | 258 | ||
263 | if (dev->irq < 2) | 259 | if (dev->irq < 2) { |
264 | { | ||
265 | unsigned long irq_mask; | 260 | unsigned long irq_mask; |
266 | 261 | ||
267 | irq_mask = probe_irq_on(); | 262 | irq_mask = probe_irq_on(); |
@@ -274,8 +269,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) | |||
274 | mdelay(20); | 269 | mdelay(20); |
275 | autoirq = probe_irq_off(irq_mask); | 270 | autoirq = probe_irq_off(irq_mask); |
276 | 271 | ||
277 | if (autoirq == 0) | 272 | if (autoirq == 0) { |
278 | { | ||
279 | printk(KERN_WARNING "%s probe at %#x failed to detect IRQ line.\n", | 273 | printk(KERN_WARNING "%s probe at %#x failed to detect IRQ line.\n", |
280 | mname, ioaddr); | 274 | mname, ioaddr); |
281 | release_region(ioaddr, EL1_IO_EXTENT); | 275 | release_region(ioaddr, EL1_IO_EXTENT); |
@@ -292,7 +286,8 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) | |||
292 | if (autoirq) | 286 | if (autoirq) |
293 | dev->irq = autoirq; | 287 | dev->irq = autoirq; |
294 | 288 | ||
295 | printk(KERN_INFO "%s: %s EtherLink at %#lx, using %sIRQ %d.\n", dev->name, mname, dev->base_addr, | 289 | printk(KERN_INFO "%s: %s EtherLink at %#lx, using %sIRQ %d.\n", |
290 | dev->name, mname, dev->base_addr, | ||
296 | autoirq ? "auto":"assigned ", dev->irq); | 291 | autoirq ? "auto":"assigned ", dev->irq); |
297 | 292 | ||
298 | #ifdef CONFIG_IP_MULTICAST | 293 | #ifdef CONFIG_IP_MULTICAST |
@@ -343,7 +338,8 @@ static int el_open(struct net_device *dev) | |||
343 | if (el_debug > 2) | 338 | if (el_debug > 2) |
344 | printk(KERN_DEBUG "%s: Doing el_open()...", dev->name); | 339 | printk(KERN_DEBUG "%s: Doing el_open()...", dev->name); |
345 | 340 | ||
346 | if ((retval = request_irq(dev->irq, &el_interrupt, 0, dev->name, dev))) | 341 | retval = request_irq(dev->irq, &el_interrupt, 0, dev->name, dev); |
342 | if (retval) | ||
347 | return retval; | 343 | return retval; |
348 | 344 | ||
349 | spin_lock_irqsave(&lp->lock, flags); | 345 | spin_lock_irqsave(&lp->lock, flags); |
@@ -371,8 +367,9 @@ static void el_timeout(struct net_device *dev) | |||
371 | int ioaddr = dev->base_addr; | 367 | int ioaddr = dev->base_addr; |
372 | 368 | ||
373 | if (el_debug) | 369 | if (el_debug) |
374 | printk (KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n", | 370 | printk(KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n", |
375 | dev->name, inb(TX_STATUS), inb(AX_STATUS), inb(RX_STATUS)); | 371 | dev->name, inb(TX_STATUS), |
372 | inb(AX_STATUS), inb(RX_STATUS)); | ||
376 | dev->stats.tx_errors++; | 373 | dev->stats.tx_errors++; |
377 | outb(TX_NORM, TX_CMD); | 374 | outb(TX_NORM, TX_CMD); |
378 | outb(RX_NORM, RX_CMD); | 375 | outb(RX_NORM, RX_CMD); |
@@ -425,8 +422,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
425 | 422 | ||
426 | netif_stop_queue(dev); | 423 | netif_stop_queue(dev); |
427 | 424 | ||
428 | do | 425 | do { |
429 | { | ||
430 | int len = skb->len; | 426 | int len = skb->len; |
431 | int pad = 0; | 427 | int pad = 0; |
432 | int gp_start; | 428 | int gp_start; |
@@ -435,10 +431,10 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
435 | if (len < ETH_ZLEN) | 431 | if (len < ETH_ZLEN) |
436 | pad = ETH_ZLEN - len; | 432 | pad = ETH_ZLEN - len; |
437 | 433 | ||
438 | gp_start = 0x800 - ( len + pad ); | 434 | gp_start = 0x800 - (len + pad); |
439 | 435 | ||
440 | lp->tx_pkt_start = gp_start; | 436 | lp->tx_pkt_start = gp_start; |
441 | lp->collisions = 0; | 437 | lp->collisions = 0; |
442 | 438 | ||
443 | dev->stats.tx_bytes += skb->len; | 439 | dev->stats.tx_bytes += skb->len; |
444 | 440 | ||
@@ -455,37 +451,42 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
455 | lp->txing = 1; | 451 | lp->txing = 1; |
456 | 452 | ||
457 | /* | 453 | /* |
458 | * Turn interrupts back on while we spend a pleasant afternoon | 454 | * Turn interrupts back on while we spend a pleasant |
459 | * loading bytes into the board | 455 | * afternoon loading bytes into the board |
460 | */ | 456 | */ |
461 | 457 | ||
462 | spin_unlock_irqrestore(&lp->lock, flags); | 458 | spin_unlock_irqrestore(&lp->lock, flags); |
463 | 459 | ||
464 | outw(0x00, RX_BUF_CLR); /* Set rx packet area to 0. */ | 460 | /* Set rx packet area to 0. */ |
465 | outw(gp_start, GP_LOW); /* aim - packet will be loaded into buffer start */ | 461 | outw(0x00, RX_BUF_CLR); |
466 | outsb(DATAPORT,buf,len); /* load buffer (usual thing each byte increments the pointer) */ | 462 | /* aim - packet will be loaded into buffer start */ |
463 | outw(gp_start, GP_LOW); | ||
464 | /* load buffer (usual thing each byte increments the pointer) */ | ||
465 | outsb(DATAPORT, buf, len); | ||
467 | if (pad) { | 466 | if (pad) { |
468 | while(pad--) /* Zero fill buffer tail */ | 467 | while (pad--) /* Zero fill buffer tail */ |
469 | outb(0, DATAPORT); | 468 | outb(0, DATAPORT); |
470 | } | 469 | } |
471 | outw(gp_start, GP_LOW); /* the board reuses the same register */ | 470 | /* the board reuses the same register */ |
471 | outw(gp_start, GP_LOW); | ||
472 | 472 | ||
473 | if(lp->loading != 2) | 473 | if (lp->loading != 2) { |
474 | { | 474 | /* fire ... Trigger xmit. */ |
475 | outb(AX_XMIT, AX_CMD); /* fire ... Trigger xmit. */ | 475 | outb(AX_XMIT, AX_CMD); |
476 | lp->loading=0; | 476 | lp->loading = 0; |
477 | dev->trans_start = jiffies; | 477 | dev->trans_start = jiffies; |
478 | if (el_debug > 2) | 478 | if (el_debug > 2) |
479 | printk(KERN_DEBUG " queued xmit.\n"); | 479 | printk(KERN_DEBUG " queued xmit.\n"); |
480 | dev_kfree_skb (skb); | 480 | dev_kfree_skb(skb); |
481 | return 0; | 481 | return 0; |
482 | } | 482 | } |
483 | /* A receive upset our load, despite our best efforts */ | 483 | /* A receive upset our load, despite our best efforts */ |
484 | if(el_debug>2) | 484 | if (el_debug > 2) |
485 | printk(KERN_DEBUG "%s: burped during tx load.\n", dev->name); | 485 | printk(KERN_DEBUG "%s: burped during tx load.\n", |
486 | dev->name); | ||
486 | spin_lock_irqsave(&lp->lock, flags); | 487 | spin_lock_irqsave(&lp->lock, flags); |
487 | } | 488 | } |
488 | while(1); | 489 | while (1); |
489 | 490 | ||
490 | } | 491 | } |
491 | 492 | ||
@@ -534,64 +535,59 @@ static irqreturn_t el_interrupt(int irq, void *dev_id) | |||
534 | */ | 535 | */ |
535 | 536 | ||
536 | if (el_debug > 3) | 537 | if (el_debug > 3) |
537 | printk(KERN_DEBUG "%s: el_interrupt() aux=%#02x", dev->name, axsr); | 538 | printk(KERN_DEBUG "%s: el_interrupt() aux=%#02x", |
538 | 539 | dev->name, axsr); | |
539 | if(lp->loading==1 && !lp->txing) | ||
540 | printk(KERN_WARNING "%s: Inconsistent state loading while not in tx\n", | ||
541 | dev->name); | ||
542 | |||
543 | if (lp->txing) | ||
544 | { | ||
545 | 540 | ||
546 | /* | 541 | if (lp->loading == 1 && !lp->txing) |
547 | * Board in transmit mode. May be loading. If we are | 542 | printk(KERN_WARNING "%s: Inconsistent state loading while not in tx\n", |
548 | * loading we shouldn't have got this. | 543 | dev->name); |
549 | */ | ||
550 | 544 | ||
545 | if (lp->txing) { | ||
546 | /* | ||
547 | * Board in transmit mode. May be loading. If we are | ||
548 | * loading we shouldn't have got this. | ||
549 | */ | ||
551 | int txsr = inb(TX_STATUS); | 550 | int txsr = inb(TX_STATUS); |
552 | 551 | ||
553 | if(lp->loading==1) | 552 | if (lp->loading == 1) { |
554 | { | 553 | if (el_debug > 2) { |
555 | if(el_debug > 2) | 554 | printk(KERN_DEBUG "%s: Interrupt while loading [", |
556 | { | 555 | dev->name); |
557 | printk(KERN_DEBUG "%s: Interrupt while loading [", dev->name); | 556 | printk(" txsr=%02x gp=%04x rp=%04x]\n", |
558 | printk(KERN_DEBUG " txsr=%02x gp=%04x rp=%04x]\n", txsr, inw(GP_LOW),inw(RX_LOW)); | 557 | txsr, inw(GP_LOW), inw(RX_LOW)); |
559 | } | 558 | } |
560 | lp->loading=2; /* Force a reload */ | 559 | /* Force a reload */ |
560 | lp->loading = 2; | ||
561 | spin_unlock(&lp->lock); | 561 | spin_unlock(&lp->lock); |
562 | goto out; | 562 | goto out; |
563 | } | 563 | } |
564 | |||
565 | if (el_debug > 6) | 564 | if (el_debug > 6) |
566 | printk(KERN_DEBUG " txsr=%02x gp=%04x rp=%04x", txsr, inw(GP_LOW),inw(RX_LOW)); | 565 | printk(KERN_DEBUG " txsr=%02x gp=%04x rp=%04x", |
566 | txsr, inw(GP_LOW), inw(RX_LOW)); | ||
567 | 567 | ||
568 | if ((axsr & 0x80) && (txsr & TX_READY) == 0) | 568 | if ((axsr & 0x80) && (txsr & TX_READY) == 0) { |
569 | { | ||
570 | /* | 569 | /* |
571 | * FIXME: is there a logic to whether to keep on trying or | 570 | * FIXME: is there a logic to whether to keep |
572 | * reset immediately ? | 571 | * on trying or reset immediately ? |
573 | */ | 572 | */ |
574 | if(el_debug>1) | 573 | if (el_debug > 1) |
575 | printk(KERN_DEBUG "%s: Unusual interrupt during Tx, txsr=%02x axsr=%02x" | 574 | printk(KERN_DEBUG "%s: Unusual interrupt during Tx, txsr=%02x axsr=%02x gp=%03x rp=%03x.\n", |
576 | " gp=%03x rp=%03x.\n", dev->name, txsr, axsr, | 575 | dev->name, txsr, axsr, |
577 | inw(ioaddr + EL1_DATAPTR), inw(ioaddr + EL1_RXPTR)); | 576 | inw(ioaddr + EL1_DATAPTR), |
577 | inw(ioaddr + EL1_RXPTR)); | ||
578 | lp->txing = 0; | 578 | lp->txing = 0; |
579 | netif_wake_queue(dev); | 579 | netif_wake_queue(dev); |
580 | } | 580 | } else if (txsr & TX_16COLLISIONS) { |
581 | else if (txsr & TX_16COLLISIONS) | ||
582 | { | ||
583 | /* | 581 | /* |
584 | * Timed out | 582 | * Timed out |
585 | */ | 583 | */ |
586 | if (el_debug) | 584 | if (el_debug) |
587 | printk (KERN_DEBUG "%s: Transmit failed 16 times, Ethernet jammed?\n",dev->name); | 585 | printk(KERN_DEBUG "%s: Transmit failed 16 times, Ethernet jammed?\n", dev->name); |
588 | outb(AX_SYS, AX_CMD); | 586 | outb(AX_SYS, AX_CMD); |
589 | lp->txing = 0; | 587 | lp->txing = 0; |
590 | dev->stats.tx_aborted_errors++; | 588 | dev->stats.tx_aborted_errors++; |
591 | netif_wake_queue(dev); | 589 | netif_wake_queue(dev); |
592 | } | 590 | } else if (txsr & TX_COLLISION) { |
593 | else if (txsr & TX_COLLISION) | ||
594 | { | ||
595 | /* | 591 | /* |
596 | * Retrigger xmit. | 592 | * Retrigger xmit. |
597 | */ | 593 | */ |
@@ -599,7 +595,8 @@ static irqreturn_t el_interrupt(int irq, void *dev_id) | |||
599 | if (el_debug > 6) | 595 | if (el_debug > 6) |
600 | printk(KERN_DEBUG " retransmitting after a collision.\n"); | 596 | printk(KERN_DEBUG " retransmitting after a collision.\n"); |
601 | /* | 597 | /* |
602 | * Poor little chip can't reset its own start pointer | 598 | * Poor little chip can't reset its own start |
599 | * pointer | ||
603 | */ | 600 | */ |
604 | 601 | ||
605 | outb(AX_SYS, AX_CMD); | 602 | outb(AX_SYS, AX_CMD); |
@@ -608,53 +605,45 @@ static irqreturn_t el_interrupt(int irq, void *dev_id) | |||
608 | dev->stats.collisions++; | 605 | dev->stats.collisions++; |
609 | spin_unlock(&lp->lock); | 606 | spin_unlock(&lp->lock); |
610 | goto out; | 607 | goto out; |
611 | } | 608 | } else { |
612 | else | ||
613 | { | ||
614 | /* | 609 | /* |
615 | * It worked.. we will now fall through and receive | 610 | * It worked.. we will now fall through and receive |
616 | */ | 611 | */ |
617 | dev->stats.tx_packets++; | 612 | dev->stats.tx_packets++; |
618 | if (el_debug > 6) | 613 | if (el_debug > 6) |
619 | printk(KERN_DEBUG " Tx succeeded %s\n", | 614 | printk(KERN_DEBUG " Tx succeeded %s\n", |
620 | (txsr & TX_RDY) ? "." : "but tx is busy!"); | 615 | (txsr & TX_RDY) ? "." : "but tx is busy!"); |
621 | /* | 616 | /* |
622 | * This is safe the interrupt is atomic WRT itself. | 617 | * This is safe the interrupt is atomic WRT itself. |
623 | */ | 618 | */ |
624 | |||
625 | lp->txing = 0; | 619 | lp->txing = 0; |
626 | netif_wake_queue(dev); /* In case more to transmit */ | 620 | /* In case more to transmit */ |
621 | netif_wake_queue(dev); | ||
627 | } | 622 | } |
628 | } | 623 | } else { |
629 | else | 624 | /* |
630 | { | 625 | * In receive mode. |
631 | /* | 626 | */ |
632 | * In receive mode. | ||
633 | */ | ||
634 | 627 | ||
635 | int rxsr = inb(RX_STATUS); | 628 | int rxsr = inb(RX_STATUS); |
636 | if (el_debug > 5) | 629 | if (el_debug > 5) |
637 | printk(KERN_DEBUG " rxsr=%02x txsr=%02x rp=%04x", rxsr, inb(TX_STATUS),inw(RX_LOW)); | 630 | printk(KERN_DEBUG " rxsr=%02x txsr=%02x rp=%04x", rxsr, inb(TX_STATUS), inw(RX_LOW)); |
638 | /* | 631 | /* |
639 | * Just reading rx_status fixes most errors. | 632 | * Just reading rx_status fixes most errors. |
640 | */ | 633 | */ |
641 | if (rxsr & RX_MISSED) | 634 | if (rxsr & RX_MISSED) |
642 | dev->stats.rx_missed_errors++; | 635 | dev->stats.rx_missed_errors++; |
643 | else if (rxsr & RX_RUNT) | 636 | else if (rxsr & RX_RUNT) { |
644 | { /* Handled to avoid board lock-up. */ | 637 | /* Handled to avoid board lock-up. */ |
645 | dev->stats.rx_length_errors++; | 638 | dev->stats.rx_length_errors++; |
646 | if (el_debug > 5) | 639 | if (el_debug > 5) |
647 | printk(KERN_DEBUG " runt.\n"); | 640 | printk(KERN_DEBUG " runt.\n"); |
648 | } | 641 | } else if (rxsr & RX_GOOD) { |
649 | else if (rxsr & RX_GOOD) | ||
650 | { | ||
651 | /* | 642 | /* |
652 | * Receive worked. | 643 | * Receive worked. |
653 | */ | 644 | */ |
654 | el_receive(dev); | 645 | el_receive(dev); |
655 | } | 646 | } else { |
656 | else | ||
657 | { | ||
658 | /* | 647 | /* |
659 | * Nothing? Something is broken! | 648 | * Nothing? Something is broken! |
660 | */ | 649 | */ |
@@ -702,8 +691,7 @@ static void el_receive(struct net_device *dev) | |||
702 | if (el_debug > 4) | 691 | if (el_debug > 4) |
703 | printk(KERN_DEBUG " el_receive %d.\n", pkt_len); | 692 | printk(KERN_DEBUG " el_receive %d.\n", pkt_len); |
704 | 693 | ||
705 | if ((pkt_len < 60) || (pkt_len > 1536)) | 694 | if (pkt_len < 60 || pkt_len > 1536) { |
706 | { | ||
707 | if (el_debug) | 695 | if (el_debug) |
708 | printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); | 696 | printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); |
709 | dev->stats.rx_over_errors++; | 697 | dev->stats.rx_over_errors++; |
@@ -722,26 +710,23 @@ static void el_receive(struct net_device *dev) | |||
722 | */ | 710 | */ |
723 | 711 | ||
724 | outw(0x00, GP_LOW); | 712 | outw(0x00, GP_LOW); |
725 | if (skb == NULL) | 713 | if (skb == NULL) { |
726 | { | ||
727 | printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); | 714 | printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); |
728 | dev->stats.rx_dropped++; | 715 | dev->stats.rx_dropped++; |
729 | return; | 716 | return; |
730 | } | 717 | } else { |
731 | else | 718 | skb_reserve(skb, 2); /* Force 16 byte alignment */ |
732 | { | ||
733 | skb_reserve(skb,2); /* Force 16 byte alignment */ | ||
734 | /* | 719 | /* |
735 | * The read increments through the bytes. The interrupt | 720 | * The read increments through the bytes. The interrupt |
736 | * handler will fix the pointer when it returns to | 721 | * handler will fix the pointer when it returns to |
737 | * receive mode. | 722 | * receive mode. |
738 | */ | 723 | */ |
739 | insb(DATAPORT, skb_put(skb,pkt_len), pkt_len); | 724 | insb(DATAPORT, skb_put(skb, pkt_len), pkt_len); |
740 | skb->protocol=eth_type_trans(skb,dev); | 725 | skb->protocol = eth_type_trans(skb, dev); |
741 | netif_rx(skb); | 726 | netif_rx(skb); |
742 | dev->last_rx = jiffies; | 727 | dev->last_rx = jiffies; |
743 | dev->stats.rx_packets++; | 728 | dev->stats.rx_packets++; |
744 | dev->stats.rx_bytes+=pkt_len; | 729 | dev->stats.rx_bytes += pkt_len; |
745 | } | 730 | } |
746 | return; | 731 | return; |
747 | } | 732 | } |
@@ -760,7 +745,7 @@ static void el_reset(struct net_device *dev) | |||
760 | struct net_local *lp = netdev_priv(dev); | 745 | struct net_local *lp = netdev_priv(dev); |
761 | int ioaddr = dev->base_addr; | 746 | int ioaddr = dev->base_addr; |
762 | 747 | ||
763 | if (el_debug> 2) | 748 | if (el_debug > 2) |
764 | printk(KERN_INFO "3c501 reset..."); | 749 | printk(KERN_INFO "3c501 reset..."); |
765 | outb(AX_RESET, AX_CMD); /* Reset the chip */ | 750 | outb(AX_RESET, AX_CMD); /* Reset the chip */ |
766 | outb(AX_LOOP, AX_CMD); /* Aux control, irq and loopback enabled */ | 751 | outb(AX_LOOP, AX_CMD); /* Aux control, irq and loopback enabled */ |
@@ -794,7 +779,8 @@ static int el1_close(struct net_device *dev) | |||
794 | int ioaddr = dev->base_addr; | 779 | int ioaddr = dev->base_addr; |
795 | 780 | ||
796 | if (el_debug > 2) | 781 | if (el_debug > 2) |
797 | printk(KERN_INFO "%s: Shutting down Ethernet card at %#x.\n", dev->name, ioaddr); | 782 | printk(KERN_INFO "%s: Shutting down Ethernet card at %#x.\n", |
783 | dev->name, ioaddr); | ||
798 | 784 | ||
799 | netif_stop_queue(dev); | 785 | netif_stop_queue(dev); |
800 | 786 | ||
@@ -822,18 +808,14 @@ static void set_multicast_list(struct net_device *dev) | |||
822 | { | 808 | { |
823 | int ioaddr = dev->base_addr; | 809 | int ioaddr = dev->base_addr; |
824 | 810 | ||
825 | if(dev->flags&IFF_PROMISC) | 811 | if (dev->flags & IFF_PROMISC) { |
826 | { | ||
827 | outb(RX_PROM, RX_CMD); | 812 | outb(RX_PROM, RX_CMD); |
828 | inb(RX_STATUS); | 813 | inb(RX_STATUS); |
829 | } | 814 | } else if (dev->mc_list || dev->flags & IFF_ALLMULTI) { |
830 | else if (dev->mc_list || dev->flags&IFF_ALLMULTI) | 815 | /* Multicast or all multicast is the same */ |
831 | { | 816 | outb(RX_MULT, RX_CMD); |
832 | outb(RX_MULT, RX_CMD); /* Multicast or all multicast is the same */ | ||
833 | inb(RX_STATUS); /* Clear status. */ | 817 | inb(RX_STATUS); /* Clear status. */ |
834 | } | 818 | } else { |
835 | else | ||
836 | { | ||
837 | outb(RX_NORM, RX_CMD); | 819 | outb(RX_NORM, RX_CMD); |
838 | inb(RX_STATUS); | 820 | inb(RX_STATUS); |
839 | } | 821 | } |