aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/yellowfin.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/yellowfin.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/yellowfin.c')
-rw-r--r--drivers/net/yellowfin.c184
1 files changed, 89 insertions, 95 deletions
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 40ad0dee0406..ede5b2436f22 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -23,12 +23,12 @@
23 23
24*/ 24*/
25 25
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27
26#define DRV_NAME "yellowfin" 28#define DRV_NAME "yellowfin"
27#define DRV_VERSION "2.1" 29#define DRV_VERSION "2.1"
28#define DRV_RELDATE "Sep 11, 2006" 30#define DRV_RELDATE "Sep 11, 2006"
29 31
30#define PFX DRV_NAME ": "
31
32/* The user-configurable values. 32/* The user-configurable values.
33 These may be modified when a driver module is loaded.*/ 33 These may be modified when a driver module is loaded.*/
34 34
@@ -90,7 +90,6 @@ static int gx_fix;
90#include <linux/timer.h> 90#include <linux/timer.h>
91#include <linux/errno.h> 91#include <linux/errno.h>
92#include <linux/ioport.h> 92#include <linux/ioport.h>
93#include <linux/slab.h>
94#include <linux/interrupt.h> 93#include <linux/interrupt.h>
95#include <linux/pci.h> 94#include <linux/pci.h>
96#include <linux/init.h> 95#include <linux/init.h>
@@ -237,7 +236,7 @@ static const struct pci_id_info pci_id_tbl[] = {
237 { } 236 { }
238}; 237};
239 238
240static const struct pci_device_id yellowfin_pci_tbl[] = { 239static DEFINE_PCI_DEVICE_TABLE(yellowfin_pci_tbl) = {
241 { 0x1000, 0x0702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 240 { 0x1000, 0x0702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
242 { 0x1000, 0x0701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 }, 241 { 0x1000, 0x0701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
243 { } 242 { }
@@ -399,7 +398,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
399 398
400 dev = alloc_etherdev(sizeof(*np)); 399 dev = alloc_etherdev(sizeof(*np));
401 if (!dev) { 400 if (!dev) {
402 printk (KERN_ERR PFX "cannot allocate ethernet device\n"); 401 pr_err("cannot allocate ethernet device\n");
403 return -ENOMEM; 402 return -ENOMEM;
404 } 403 }
405 SET_NETDEV_DEV(dev, &pdev->dev); 404 SET_NETDEV_DEV(dev, &pdev->dev);
@@ -487,10 +486,10 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
487 if (i) 486 if (i)
488 goto err_out_unmap_status; 487 goto err_out_unmap_status;
489 488
490 printk(KERN_INFO "%s: %s type %8x at %p, %pM, IRQ %d.\n", 489 netdev_info(dev, "%s type %8x at %p, %pM, IRQ %d\n",
491 dev->name, pci_id_tbl[chip_idx].name, 490 pci_id_tbl[chip_idx].name,
492 ioread32(ioaddr + ChipRev), ioaddr, 491 ioread32(ioaddr + ChipRev), ioaddr,
493 dev->dev_addr, irq); 492 dev->dev_addr, irq);
494 493
495 if (np->drv_flags & HasMII) { 494 if (np->drv_flags & HasMII) {
496 int phy, phy_idx = 0; 495 int phy, phy_idx = 0;
@@ -499,9 +498,8 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
499 if (mii_status != 0xffff && mii_status != 0x0000) { 498 if (mii_status != 0xffff && mii_status != 0x0000) {
500 np->phys[phy_idx++] = phy; 499 np->phys[phy_idx++] = phy;
501 np->advertising = mdio_read(ioaddr, phy, 4); 500 np->advertising = mdio_read(ioaddr, phy, 4);
502 printk(KERN_INFO "%s: MII PHY found at address %d, status " 501 netdev_info(dev, "MII PHY found at address %d, status 0x%04x advertising %04x\n",
503 "0x%4.4x advertising %4.4x.\n", 502 phy, mii_status, np->advertising);
504 dev->name, phy, mii_status, np->advertising);
505 } 503 }
506 } 504 }
507 np->mii_cnt = phy_idx; 505 np->mii_cnt = phy_idx;
@@ -579,13 +577,13 @@ static int yellowfin_open(struct net_device *dev)
579 /* Reset the chip. */ 577 /* Reset the chip. */
580 iowrite32(0x80000000, ioaddr + DMACtrl); 578 iowrite32(0x80000000, ioaddr + DMACtrl);
581 579
582 ret = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); 580 ret = request_irq(dev->irq, yellowfin_interrupt, IRQF_SHARED, dev->name, dev);
583 if (ret) 581 if (ret)
584 return ret; 582 return ret;
585 583
586 if (yellowfin_debug > 1) 584 if (yellowfin_debug > 1)
587 printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n", 585 netdev_printk(KERN_DEBUG, dev, "%s() irq %d\n",
588 dev->name, dev->irq); 586 __func__, dev->irq);
589 587
590 ret = yellowfin_init_ring(dev); 588 ret = yellowfin_init_ring(dev);
591 if (ret) { 589 if (ret) {
@@ -642,8 +640,7 @@ static int yellowfin_open(struct net_device *dev)
642 iowrite32(0x80008000, ioaddr + TxCtrl); 640 iowrite32(0x80008000, ioaddr + TxCtrl);
643 641
644 if (yellowfin_debug > 2) { 642 if (yellowfin_debug > 2) {
645 printk(KERN_DEBUG "%s: Done yellowfin_open().\n", 643 netdev_printk(KERN_DEBUG, dev, "Done %s()\n", __func__);
646 dev->name);
647 } 644 }
648 645
649 /* Set the timer to check for link beat. */ 646 /* Set the timer to check for link beat. */
@@ -664,8 +661,8 @@ static void yellowfin_timer(unsigned long data)
664 int next_tick = 60*HZ; 661 int next_tick = 60*HZ;
665 662
666 if (yellowfin_debug > 3) { 663 if (yellowfin_debug > 3) {
667 printk(KERN_DEBUG "%s: Yellowfin timer tick, status %8.8x.\n", 664 netdev_printk(KERN_DEBUG, dev, "Yellowfin timer tick, status %08x\n",
668 dev->name, ioread16(ioaddr + IntrStatus)); 665 ioread16(ioaddr + IntrStatus));
669 } 666 }
670 667
671 if (yp->mii_cnt) { 668 if (yp->mii_cnt) {
@@ -673,9 +670,8 @@ static void yellowfin_timer(unsigned long data)
673 int lpa = mdio_read(ioaddr, yp->phys[0], MII_LPA); 670 int lpa = mdio_read(ioaddr, yp->phys[0], MII_LPA);
674 int negotiated = lpa & yp->advertising; 671 int negotiated = lpa & yp->advertising;
675 if (yellowfin_debug > 1) 672 if (yellowfin_debug > 1)
676 printk(KERN_DEBUG "%s: MII #%d status register is %4.4x, " 673 netdev_printk(KERN_DEBUG, dev, "MII #%d status register is %04x, link partner capability %04x\n",
677 "link partner capability %4.4x.\n", 674 yp->phys[0], bmsr, lpa);
678 dev->name, yp->phys[0], bmsr, lpa);
679 675
680 yp->full_duplex = mii_duplex(yp->duplex_lock, negotiated); 676 yp->full_duplex = mii_duplex(yp->duplex_lock, negotiated);
681 677
@@ -696,25 +692,24 @@ static void yellowfin_tx_timeout(struct net_device *dev)
696 struct yellowfin_private *yp = netdev_priv(dev); 692 struct yellowfin_private *yp = netdev_priv(dev);
697 void __iomem *ioaddr = yp->base; 693 void __iomem *ioaddr = yp->base;
698 694
699 printk(KERN_WARNING "%s: Yellowfin transmit timed out at %d/%d Tx " 695 netdev_warn(dev, "Yellowfin transmit timed out at %d/%d Tx status %04x, Rx status %04x, resetting...\n",
700 "status %4.4x, Rx status %4.4x, resetting...\n", 696 yp->cur_tx, yp->dirty_tx,
701 dev->name, yp->cur_tx, yp->dirty_tx, 697 ioread32(ioaddr + TxStatus),
702 ioread32(ioaddr + TxStatus), ioread32(ioaddr + RxStatus)); 698 ioread32(ioaddr + RxStatus));
703 699
704 /* Note: these should be KERN_DEBUG. */ 700 /* Note: these should be KERN_DEBUG. */
705 if (yellowfin_debug) { 701 if (yellowfin_debug) {
706 int i; 702 int i;
707 printk(KERN_WARNING " Rx ring %p: ", yp->rx_ring); 703 pr_warning(" Rx ring %p: ", yp->rx_ring);
708 for (i = 0; i < RX_RING_SIZE; i++) 704 for (i = 0; i < RX_RING_SIZE; i++)
709 printk(KERN_CONT " %8.8x", 705 pr_cont(" %08x", yp->rx_ring[i].result_status);
710 yp->rx_ring[i].result_status); 706 pr_cont("\n");
711 printk(KERN_CONT "\n"); 707 pr_warning(" Tx ring %p: ", yp->tx_ring);
712 printk(KERN_WARNING" Tx ring %p: ", yp->tx_ring);
713 for (i = 0; i < TX_RING_SIZE; i++) 708 for (i = 0; i < TX_RING_SIZE; i++)
714 printk(KERN_CONT " %4.4x /%8.8x", 709 pr_cont(" %04x /%08x",
715 yp->tx_status[i].tx_errs, 710 yp->tx_status[i].tx_errs,
716 yp->tx_ring[i].result_status); 711 yp->tx_ring[i].result_status);
717 printk(KERN_CONT "\n"); 712 pr_cont("\n");
718 } 713 }
719 714
720 /* If the hardware is found to hang regularly, we will update the code 715 /* If the hardware is found to hang regularly, we will update the code
@@ -891,8 +886,8 @@ static netdev_tx_t yellowfin_start_xmit(struct sk_buff *skb,
891 yp->tx_full = 1; 886 yp->tx_full = 1;
892 887
893 if (yellowfin_debug > 4) { 888 if (yellowfin_debug > 4) {
894 printk(KERN_DEBUG "%s: Yellowfin transmit frame #%d queued in slot %d.\n", 889 netdev_printk(KERN_DEBUG, dev, "Yellowfin transmit frame #%d queued in slot %d\n",
895 dev->name, yp->cur_tx, entry); 890 yp->cur_tx, entry);
896 } 891 }
897 return NETDEV_TX_OK; 892 return NETDEV_TX_OK;
898} 893}
@@ -916,8 +911,8 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
916 u16 intr_status = ioread16(ioaddr + IntrClear); 911 u16 intr_status = ioread16(ioaddr + IntrClear);
917 912
918 if (yellowfin_debug > 4) 913 if (yellowfin_debug > 4)
919 printk(KERN_DEBUG "%s: Yellowfin interrupt, status %4.4x.\n", 914 netdev_printk(KERN_DEBUG, dev, "Yellowfin interrupt, status %04x\n",
920 dev->name, intr_status); 915 intr_status);
921 916
922 if (intr_status == 0) 917 if (intr_status == 0)
923 break; 918 break;
@@ -944,8 +939,8 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
944 dev_kfree_skb_irq(skb); 939 dev_kfree_skb_irq(skb);
945 yp->tx_skbuff[entry] = NULL; 940 yp->tx_skbuff[entry] = NULL;
946 } 941 }
947 if (yp->tx_full 942 if (yp->tx_full &&
948 && yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE - 4) { 943 yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE - 4) {
949 /* The ring is no longer full, clear tbusy. */ 944 /* The ring is no longer full, clear tbusy. */
950 yp->tx_full = 0; 945 yp->tx_full = 0;
951 netif_wake_queue(dev); 946 netif_wake_queue(dev);
@@ -963,13 +958,12 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
963 958
964#ifndef final_version 959#ifndef final_version
965 if (yellowfin_debug > 5) 960 if (yellowfin_debug > 5)
966 printk(KERN_DEBUG "%s: Tx queue %d check, Tx status " 961 netdev_printk(KERN_DEBUG, dev, "Tx queue %d check, Tx status %04x %04x %04x %04x\n",
967 "%4.4x %4.4x %4.4x %4.4x.\n", 962 entry,
968 dev->name, entry, 963 yp->tx_status[entry].tx_cnt,
969 yp->tx_status[entry].tx_cnt, 964 yp->tx_status[entry].tx_errs,
970 yp->tx_status[entry].tx_errs, 965 yp->tx_status[entry].total_tx_cnt,
971 yp->tx_status[entry].total_tx_cnt, 966 yp->tx_status[entry].paused);
972 yp->tx_status[entry].paused);
973#endif 967#endif
974 if (tx_errs == 0) 968 if (tx_errs == 0)
975 break; /* It still hasn't been Txed */ 969 break; /* It still hasn't been Txed */
@@ -978,8 +972,8 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
978 /* There was an major error, log it. */ 972 /* There was an major error, log it. */
979#ifndef final_version 973#ifndef final_version
980 if (yellowfin_debug > 1) 974 if (yellowfin_debug > 1)
981 printk(KERN_DEBUG "%s: Transmit error, Tx status %4.4x.\n", 975 netdev_printk(KERN_DEBUG, dev, "Transmit error, Tx status %04x\n",
982 dev->name, tx_errs); 976 tx_errs);
983#endif 977#endif
984 dev->stats.tx_errors++; 978 dev->stats.tx_errors++;
985 if (tx_errs & 0xF800) dev->stats.tx_aborted_errors++; 979 if (tx_errs & 0xF800) dev->stats.tx_aborted_errors++;
@@ -989,8 +983,8 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
989 } else { 983 } else {
990#ifndef final_version 984#ifndef final_version
991 if (yellowfin_debug > 4) 985 if (yellowfin_debug > 4)
992 printk(KERN_DEBUG "%s: Normal transmit, Tx status %4.4x.\n", 986 netdev_printk(KERN_DEBUG, dev, "Normal transmit, Tx status %04x\n",
993 dev->name, tx_errs); 987 tx_errs);
994#endif 988#endif
995 dev->stats.tx_bytes += skb->len; 989 dev->stats.tx_bytes += skb->len;
996 dev->stats.collisions += tx_errs & 15; 990 dev->stats.collisions += tx_errs & 15;
@@ -1008,14 +1002,14 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
1008 1002
1009#ifndef final_version 1003#ifndef final_version
1010 if (yp->cur_tx - dirty_tx > TX_RING_SIZE) { 1004 if (yp->cur_tx - dirty_tx > TX_RING_SIZE) {
1011 printk(KERN_ERR "%s: Out-of-sync dirty pointer, %d vs. %d, full=%d.\n", 1005 netdev_err(dev, "Out-of-sync dirty pointer, %d vs. %d, full=%d\n",
1012 dev->name, dirty_tx, yp->cur_tx, yp->tx_full); 1006 dirty_tx, yp->cur_tx, yp->tx_full);
1013 dirty_tx += TX_RING_SIZE; 1007 dirty_tx += TX_RING_SIZE;
1014 } 1008 }
1015#endif 1009#endif
1016 1010
1017 if (yp->tx_full 1011 if (yp->tx_full &&
1018 && yp->cur_tx - dirty_tx < TX_QUEUE_SIZE - 2) { 1012 yp->cur_tx - dirty_tx < TX_QUEUE_SIZE - 2) {
1019 /* The ring is no longer full, clear tbusy. */ 1013 /* The ring is no longer full, clear tbusy. */
1020 yp->tx_full = 0; 1014 yp->tx_full = 0;
1021 netif_wake_queue(dev); 1015 netif_wake_queue(dev);
@@ -1031,16 +1025,15 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
1031 yellowfin_error(dev, intr_status); 1025 yellowfin_error(dev, intr_status);
1032 1026
1033 if (--boguscnt < 0) { 1027 if (--boguscnt < 0) {
1034 printk(KERN_WARNING "%s: Too much work at interrupt, " 1028 netdev_warn(dev, "Too much work at interrupt, status=%#04x\n",
1035 "status=0x%4.4x.\n", 1029 intr_status);
1036 dev->name, intr_status);
1037 break; 1030 break;
1038 } 1031 }
1039 } while (1); 1032 } while (1);
1040 1033
1041 if (yellowfin_debug > 3) 1034 if (yellowfin_debug > 3)
1042 printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", 1035 netdev_printk(KERN_DEBUG, dev, "exiting interrupt, status=%#04x\n",
1043 dev->name, ioread16(ioaddr + IntrStatus)); 1036 ioread16(ioaddr + IntrStatus));
1044 1037
1045 spin_unlock (&yp->lock); 1038 spin_unlock (&yp->lock);
1046 return IRQ_RETVAL(handled); 1039 return IRQ_RETVAL(handled);
@@ -1055,9 +1048,9 @@ static int yellowfin_rx(struct net_device *dev)
1055 int boguscnt = yp->dirty_rx + RX_RING_SIZE - yp->cur_rx; 1048 int boguscnt = yp->dirty_rx + RX_RING_SIZE - yp->cur_rx;
1056 1049
1057 if (yellowfin_debug > 4) { 1050 if (yellowfin_debug > 4) {
1058 printk(KERN_DEBUG " In yellowfin_rx(), entry %d status %8.8x.\n", 1051 printk(KERN_DEBUG " In yellowfin_rx(), entry %d status %08x\n",
1059 entry, yp->rx_ring[entry].result_status); 1052 entry, yp->rx_ring[entry].result_status);
1060 printk(KERN_DEBUG " #%d desc. %8.8x %8.8x %8.8x.\n", 1053 printk(KERN_DEBUG " #%d desc. %08x %08x %08x\n",
1061 entry, yp->rx_ring[entry].dbdma_cmd, yp->rx_ring[entry].addr, 1054 entry, yp->rx_ring[entry].dbdma_cmd, yp->rx_ring[entry].addr,
1062 yp->rx_ring[entry].result_status); 1055 yp->rx_ring[entry].result_status);
1063 } 1056 }
@@ -1081,20 +1074,20 @@ static int yellowfin_rx(struct net_device *dev)
1081 le32_to_cpu(desc->result_status)) & 0xffff; 1074 le32_to_cpu(desc->result_status)) & 0xffff;
1082 frame_status = get_unaligned_le16(&(buf_addr[data_size - 2])); 1075 frame_status = get_unaligned_le16(&(buf_addr[data_size - 2]));
1083 if (yellowfin_debug > 4) 1076 if (yellowfin_debug > 4)
1084 printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", 1077 printk(KERN_DEBUG " %s() status was %04x\n",
1085 frame_status); 1078 __func__, frame_status);
1086 if (--boguscnt < 0) 1079 if (--boguscnt < 0)
1087 break; 1080 break;
1088 if ( ! (desc_status & RX_EOP)) { 1081 if ( ! (desc_status & RX_EOP)) {
1089 if (data_size != 0) 1082 if (data_size != 0)
1090 printk(KERN_WARNING "%s: Oversized Ethernet frame spanned multiple buffers," 1083 netdev_warn(dev, "Oversized Ethernet frame spanned multiple buffers, status %04x, data_size %d!\n",
1091 " status %4.4x, data_size %d!\n", dev->name, desc_status, data_size); 1084 desc_status, data_size);
1092 dev->stats.rx_length_errors++; 1085 dev->stats.rx_length_errors++;
1093 } else if ((yp->drv_flags & IsGigabit) && (frame_status & 0x0038)) { 1086 } else if ((yp->drv_flags & IsGigabit) && (frame_status & 0x0038)) {
1094 /* There was a error. */ 1087 /* There was a error. */
1095 if (yellowfin_debug > 3) 1088 if (yellowfin_debug > 3)
1096 printk(KERN_DEBUG " yellowfin_rx() Rx error was %4.4x.\n", 1089 printk(KERN_DEBUG " %s() Rx error was %04x\n",
1097 frame_status); 1090 __func__, frame_status);
1098 dev->stats.rx_errors++; 1091 dev->stats.rx_errors++;
1099 if (frame_status & 0x0060) dev->stats.rx_length_errors++; 1092 if (frame_status & 0x0060) dev->stats.rx_length_errors++;
1100 if (frame_status & 0x0008) dev->stats.rx_frame_errors++; 1093 if (frame_status & 0x0008) dev->stats.rx_frame_errors++;
@@ -1118,8 +1111,8 @@ static int yellowfin_rx(struct net_device *dev)
1118 entry*sizeof(struct yellowfin_desc)), 1111 entry*sizeof(struct yellowfin_desc)),
1119 "\377\377\377\377\377\377", 6) != 0) { 1112 "\377\377\377\377\377\377", 6) != 0) {
1120 if (bogus_rx++ == 0) 1113 if (bogus_rx++ == 0)
1121 printk(KERN_WARNING "%s: Bad frame to %pM\n", 1114 netdev_warn(dev, "Bad frame to %pM\n",
1122 dev->name, buf_addr); 1115 buf_addr);
1123#endif 1116#endif
1124 } else { 1117 } else {
1125 struct sk_buff *skb; 1118 struct sk_buff *skb;
@@ -1129,9 +1122,8 @@ static int yellowfin_rx(struct net_device *dev)
1129 1122
1130#ifndef final_version 1123#ifndef final_version
1131 if (yellowfin_debug > 4) 1124 if (yellowfin_debug > 4)
1132 printk(KERN_DEBUG " yellowfin_rx() normal Rx pkt length %d" 1125 printk(KERN_DEBUG " %s() normal Rx pkt length %d of %d, bogus_cnt %d\n",
1133 " of %d, bogus_cnt %d.\n", 1126 __func__, pkt_len, data_size, boguscnt);
1134 pkt_len, data_size, boguscnt);
1135#endif 1127#endif
1136 /* Check if the packet is long enough to just pass up the skbuff 1128 /* Check if the packet is long enough to just pass up the skbuff
1137 without copying to a properly sized skbuff. */ 1129 without copying to a properly sized skbuff. */
@@ -1191,8 +1183,7 @@ static int yellowfin_rx(struct net_device *dev)
1191 1183
1192static void yellowfin_error(struct net_device *dev, int intr_status) 1184static void yellowfin_error(struct net_device *dev, int intr_status)
1193{ 1185{
1194 printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n", 1186 netdev_err(dev, "Something Wicked happened! %04x\n", intr_status);
1195 dev->name, intr_status);
1196 /* Hmmmmm, it's not clear what to do here. */ 1187 /* Hmmmmm, it's not clear what to do here. */
1197 if (intr_status & (IntrTxPCIErr | IntrTxPCIFault)) 1188 if (intr_status & (IntrTxPCIErr | IntrTxPCIFault))
1198 dev->stats.tx_errors++; 1189 dev->stats.tx_errors++;
@@ -1209,13 +1200,13 @@ static int yellowfin_close(struct net_device *dev)
1209 netif_stop_queue (dev); 1200 netif_stop_queue (dev);
1210 1201
1211 if (yellowfin_debug > 1) { 1202 if (yellowfin_debug > 1) {
1212 printk(KERN_DEBUG "%s: Shutting down ethercard, status was Tx %4.4x " 1203 netdev_printk(KERN_DEBUG, dev, "Shutting down ethercard, status was Tx %04x Rx %04x Int %02x\n",
1213 "Rx %4.4x Int %2.2x.\n", 1204 ioread16(ioaddr + TxStatus),
1214 dev->name, ioread16(ioaddr + TxStatus), 1205 ioread16(ioaddr + RxStatus),
1215 ioread16(ioaddr + RxStatus), 1206 ioread16(ioaddr + IntrStatus));
1216 ioread16(ioaddr + IntrStatus)); 1207 netdev_printk(KERN_DEBUG, dev, "Queue pointers were Tx %d / %d, Rx %d / %d\n",
1217 printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n", 1208 yp->cur_tx, yp->dirty_tx,
1218 dev->name, yp->cur_tx, yp->dirty_tx, yp->cur_rx, yp->dirty_rx); 1209 yp->cur_rx, yp->dirty_rx);
1219 } 1210 }
1220 1211
1221 /* Disable interrupts by clearing the interrupt mask. */ 1212 /* Disable interrupts by clearing the interrupt mask. */
@@ -1229,33 +1220,35 @@ static int yellowfin_close(struct net_device *dev)
1229 1220
1230#if defined(__i386__) 1221#if defined(__i386__)
1231 if (yellowfin_debug > 2) { 1222 if (yellowfin_debug > 2) {
1232 printk(KERN_DEBUG" Tx ring at %8.8llx:\n", 1223 printk(KERN_DEBUG " Tx ring at %08llx:\n",
1233 (unsigned long long)yp->tx_ring_dma); 1224 (unsigned long long)yp->tx_ring_dma);
1234 for (i = 0; i < TX_RING_SIZE*2; i++) 1225 for (i = 0; i < TX_RING_SIZE*2; i++)
1235 printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", 1226 printk(KERN_DEBUG " %c #%d desc. %08x %08x %08x %08x\n",
1236 ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', 1227 ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ',
1237 i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, 1228 i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr,
1238 yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); 1229 yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status);
1239 printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); 1230 printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status);
1240 for (i = 0; i < TX_RING_SIZE; i++) 1231 for (i = 0; i < TX_RING_SIZE; i++)
1241 printk(KERN_DEBUG " #%d status %4.4x %4.4x %4.4x %4.4x.\n", 1232 printk(KERN_DEBUG " #%d status %04x %04x %04x %04x\n",
1242 i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs, 1233 i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs,
1243 yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused); 1234 yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused);
1244 1235
1245 printk(KERN_DEBUG " Rx ring %8.8llx:\n", 1236 printk(KERN_DEBUG " Rx ring %08llx:\n",
1246 (unsigned long long)yp->rx_ring_dma); 1237 (unsigned long long)yp->rx_ring_dma);
1247 for (i = 0; i < RX_RING_SIZE; i++) { 1238 for (i = 0; i < RX_RING_SIZE; i++) {
1248 printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", 1239 printk(KERN_DEBUG " %c #%d desc. %08x %08x %08x\n",
1249 ioread32(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ', 1240 ioread32(ioaddr + RxPtr) == (long)&yp->rx_ring[i] ? '>' : ' ',
1250 i, yp->rx_ring[i].dbdma_cmd, yp->rx_ring[i].addr, 1241 i, yp->rx_ring[i].dbdma_cmd, yp->rx_ring[i].addr,
1251 yp->rx_ring[i].result_status); 1242 yp->rx_ring[i].result_status);
1252 if (yellowfin_debug > 6) { 1243 if (yellowfin_debug > 6) {
1253 if (get_unaligned((u8*)yp->rx_ring[i].addr) != 0x69) { 1244 if (get_unaligned((u8*)yp->rx_ring[i].addr) != 0x69) {
1254 int j; 1245 int j;
1246
1247 printk(KERN_DEBUG);
1255 for (j = 0; j < 0x50; j++) 1248 for (j = 0; j < 0x50; j++)
1256 printk(" %4.4x", 1249 pr_cont(" %04x",
1257 get_unaligned(((u16*)yp->rx_ring[i].addr) + j)); 1250 get_unaligned(((u16*)yp->rx_ring[i].addr) + j));
1258 printk("\n"); 1251 pr_cont("\n");
1259 } 1252 }
1260 } 1253 }
1261 } 1254 }
@@ -1281,8 +1274,8 @@ static int yellowfin_close(struct net_device *dev)
1281 1274
1282#ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ 1275#ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */
1283 if (yellowfin_debug > 0) { 1276 if (yellowfin_debug > 0) {
1284 printk(KERN_DEBUG "%s: Received %d frames that we should not have.\n", 1277 netdev_printk(KERN_DEBUG, dev, "Received %d frames that we should not have\n",
1285 dev->name, bogus_rx); 1278 bogus_rx);
1286 } 1279 }
1287#endif 1280#endif
1288 1281
@@ -1301,16 +1294,17 @@ static void set_rx_mode(struct net_device *dev)
1301 iowrite16(cfg_value & ~0x1000, ioaddr + Cnfg); 1294 iowrite16(cfg_value & ~0x1000, ioaddr + Cnfg);
1302 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ 1295 if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
1303 iowrite16(0x000F, ioaddr + AddrMode); 1296 iowrite16(0x000F, ioaddr + AddrMode);
1304 } else if ((dev->mc_count > 64) || (dev->flags & IFF_ALLMULTI)) { 1297 } else if ((netdev_mc_count(dev) > 64) ||
1298 (dev->flags & IFF_ALLMULTI)) {
1305 /* Too many to filter well, or accept all multicasts. */ 1299 /* Too many to filter well, or accept all multicasts. */
1306 iowrite16(0x000B, ioaddr + AddrMode); 1300 iowrite16(0x000B, ioaddr + AddrMode);
1307 } else if (dev->mc_count > 0) { /* Must use the multicast hash table. */ 1301 } else if (!netdev_mc_empty(dev)) { /* Must use the multicast hash table. */
1308 struct dev_mc_list *mclist; 1302 struct dev_mc_list *mclist;
1309 u16 hash_table[4]; 1303 u16 hash_table[4];
1310 int i; 1304 int i;
1305
1311 memset(hash_table, 0, sizeof(hash_table)); 1306 memset(hash_table, 0, sizeof(hash_table));
1312 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; 1307 netdev_for_each_mc_addr(mclist, dev) {
1313 i++, mclist = mclist->next) {
1314 unsigned int bit; 1308 unsigned int bit;
1315 1309
1316 /* Due to a bug in the early chip versions, multiple filter 1310 /* Due to a bug in the early chip versions, multiple filter