aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/8139cp.c72
1 files changed, 30 insertions, 42 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 60bc0b0ad4f..3d4406b1665 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -46,6 +46,8 @@
46 46
47 */ 47 */
48 48
49#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
50
49#define DRV_NAME "8139cp" 51#define DRV_NAME "8139cp"
50#define DRV_VERSION "1.3" 52#define DRV_VERSION "1.3"
51#define DRV_RELDATE "Mar 22, 2004" 53#define DRV_RELDATE "Mar 22, 2004"
@@ -104,8 +106,6 @@ static int multicast_filter_limit = 32;
104module_param(multicast_filter_limit, int, 0); 106module_param(multicast_filter_limit, int, 0);
105MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered multicast addresses"); 107MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered multicast addresses");
106 108
107#define PFX DRV_NAME ": "
108
109#define CP_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ 109#define CP_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
110 NETIF_MSG_PROBE | \ 110 NETIF_MSG_PROBE | \
111 NETIF_MSG_LINK) 111 NETIF_MSG_LINK)
@@ -470,9 +470,8 @@ static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb,
470static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail, 470static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail,
471 u32 status, u32 len) 471 u32 status, u32 len)
472{ 472{
473 if (netif_msg_rx_err (cp)) 473 netif_dbg(cp, rx_err, cp->dev, "rx err, slot %d status 0x%x len %d\n",
474 pr_debug("%s: rx err, slot %d status 0x%x len %d\n", 474 rx_tail, status, len);
475 cp->dev->name, rx_tail, status, len);
476 cp->dev->stats.rx_errors++; 475 cp->dev->stats.rx_errors++;
477 if (status & RxErrFrame) 476 if (status & RxErrFrame)
478 cp->dev->stats.rx_frame_errors++; 477 cp->dev->stats.rx_frame_errors++;
@@ -545,9 +544,8 @@ rx_status_loop:
545 goto rx_next; 544 goto rx_next;
546 } 545 }
547 546
548 if (netif_msg_rx_status(cp)) 547 netif_dbg(cp, rx_status, dev, "rx slot %d status 0x%x len %d\n",
549 pr_debug("%s: rx slot %d status 0x%x len %d\n", 548 rx_tail, status, len);
550 dev->name, rx_tail, status, len);
551 549
552 new_skb = netdev_alloc_skb_ip_align(dev, buflen); 550 new_skb = netdev_alloc_skb_ip_align(dev, buflen);
553 if (!new_skb) { 551 if (!new_skb) {
@@ -621,9 +619,8 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
621 if (!status || (status == 0xFFFF)) 619 if (!status || (status == 0xFFFF))
622 return IRQ_NONE; 620 return IRQ_NONE;
623 621
624 if (netif_msg_intr(cp)) 622 netif_dbg(cp, intr, dev, "intr, status %04x cmd %02x cpcmd %04x\n",
625 pr_debug("%s: intr, status %04x cmd %02x cpcmd %04x\n", 623 status, cpr8(Cmd), cpr16(CpCmd));
626 dev->name, status, cpr8(Cmd), cpr16(CpCmd));
627 624
628 cpw16(IntrStatus, status & ~cp_rx_intr_mask); 625 cpw16(IntrStatus, status & ~cp_rx_intr_mask);
629 626
@@ -654,8 +651,8 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
654 651
655 pci_read_config_word(cp->pdev, PCI_STATUS, &pci_status); 652 pci_read_config_word(cp->pdev, PCI_STATUS, &pci_status);
656 pci_write_config_word(cp->pdev, PCI_STATUS, pci_status); 653 pci_write_config_word(cp->pdev, PCI_STATUS, pci_status);
657 pr_err("%s: PCI bus error, status=%04x, PCI status=%04x\n", 654 netdev_err(dev, "PCI bus error, status=%04x, PCI status=%04x\n",
658 dev->name, status, pci_status); 655 status, pci_status);
659 656
660 /* TODO: reset hardware */ 657 /* TODO: reset hardware */
661 } 658 }
@@ -700,9 +697,8 @@ static void cp_tx (struct cp_private *cp)
700 697
701 if (status & LastFrag) { 698 if (status & LastFrag) {
702 if (status & (TxError | TxFIFOUnder)) { 699 if (status & (TxError | TxFIFOUnder)) {
703 if (netif_msg_tx_err(cp)) 700 netif_dbg(cp, tx_err, cp->dev,
704 pr_debug("%s: tx err, status 0x%x\n", 701 "tx err, status 0x%x\n", status);
705 cp->dev->name, status);
706 cp->dev->stats.tx_errors++; 702 cp->dev->stats.tx_errors++;
707 if (status & TxOWC) 703 if (status & TxOWC)
708 cp->dev->stats.tx_window_errors++; 704 cp->dev->stats.tx_window_errors++;
@@ -717,8 +713,8 @@ static void cp_tx (struct cp_private *cp)
717 ((status >> TxColCntShift) & TxColCntMask); 713 ((status >> TxColCntShift) & TxColCntMask);
718 cp->dev->stats.tx_packets++; 714 cp->dev->stats.tx_packets++;
719 cp->dev->stats.tx_bytes += skb->len; 715 cp->dev->stats.tx_bytes += skb->len;
720 if (netif_msg_tx_done(cp)) 716 netif_dbg(cp, tx_done, cp->dev,
721 pr_debug("%s: tx done, slot %d\n", cp->dev->name, tx_tail); 717 "tx done, slot %d\n", tx_tail);
722 } 718 }
723 dev_kfree_skb_irq(skb); 719 dev_kfree_skb_irq(skb);
724 } 720 }
@@ -752,8 +748,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
752 if (TX_BUFFS_AVAIL(cp) <= (skb_shinfo(skb)->nr_frags + 1)) { 748 if (TX_BUFFS_AVAIL(cp) <= (skb_shinfo(skb)->nr_frags + 1)) {
753 netif_stop_queue(dev); 749 netif_stop_queue(dev);
754 spin_unlock_irqrestore(&cp->lock, intr_flags); 750 spin_unlock_irqrestore(&cp->lock, intr_flags);
755 pr_err(PFX "%s: BUG! Tx Ring full when queue awake!\n", 751 netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
756 dev->name);
757 return NETDEV_TX_BUSY; 752 return NETDEV_TX_BUSY;
758 } 753 }
759 754
@@ -878,9 +873,8 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
878 wmb(); 873 wmb();
879 } 874 }
880 cp->tx_head = entry; 875 cp->tx_head = entry;
881 if (netif_msg_tx_queued(cp)) 876 netif_dbg(cp, tx_queued, cp->dev, "tx queued, slot %d, skblen %d\n",
882 pr_debug("%s: tx queued, slot %d, skblen %d\n", 877 entry, skb->len);
883 dev->name, entry, skb->len);
884 if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) 878 if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1))
885 netif_stop_queue(dev); 879 netif_stop_queue(dev);
886 880
@@ -992,7 +986,7 @@ static void cp_reset_hw (struct cp_private *cp)
992 schedule_timeout_uninterruptible(10); 986 schedule_timeout_uninterruptible(10);
993 } 987 }
994 988
995 pr_err("%s: hardware reset timeout\n", cp->dev->name); 989 netdev_err(cp->dev, "hardware reset timeout\n");
996} 990}
997 991
998static inline void cp_start_hw (struct cp_private *cp) 992static inline void cp_start_hw (struct cp_private *cp)
@@ -1159,8 +1153,7 @@ static int cp_open (struct net_device *dev)
1159 struct cp_private *cp = netdev_priv(dev); 1153 struct cp_private *cp = netdev_priv(dev);
1160 int rc; 1154 int rc;
1161 1155
1162 if (netif_msg_ifup(cp)) 1156 netif_dbg(cp, ifup, dev, "enabling interface\n");
1163 pr_debug("%s: enabling interface\n", dev->name);
1164 1157
1165 rc = cp_alloc_rings(cp); 1158 rc = cp_alloc_rings(cp);
1166 if (rc) 1159 if (rc)
@@ -1194,8 +1187,7 @@ static int cp_close (struct net_device *dev)
1194 1187
1195 napi_disable(&cp->napi); 1188 napi_disable(&cp->napi);
1196 1189
1197 if (netif_msg_ifdown(cp)) 1190 netif_dbg(cp, ifdown, dev, "disabling interface\n");
1198 pr_debug("%s: disabling interface\n", dev->name);
1199 1191
1200 spin_lock_irqsave(&cp->lock, flags); 1192 spin_lock_irqsave(&cp->lock, flags);
1201 1193
@@ -1218,9 +1210,9 @@ static void cp_tx_timeout(struct net_device *dev)
1218 unsigned long flags; 1210 unsigned long flags;
1219 int rc; 1211 int rc;
1220 1212
1221 pr_warning("%s: Transmit timeout, status %2x %4x %4x %4x\n", 1213 netdev_warn(dev, "Transmit timeout, status %2x %4x %4x %4x\n",
1222 dev->name, cpr8(Cmd), cpr16(CpCmd), 1214 cpr8(Cmd), cpr16(CpCmd),
1223 cpr16(IntrStatus), cpr16(IntrMask)); 1215 cpr16(IntrStatus), cpr16(IntrMask));
1224 1216
1225 spin_lock_irqsave(&cp->lock, flags); 1217 spin_lock_irqsave(&cp->lock, flags);
1226 1218
@@ -1873,8 +1865,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1873 if (pdev->vendor == PCI_VENDOR_ID_REALTEK && 1865 if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
1874 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision < 0x20) { 1866 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision < 0x20) {
1875 dev_info(&pdev->dev, 1867 dev_info(&pdev->dev,
1876 "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip, use 8139too\n", 1868 "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip, use 8139too\n",
1877 pdev->vendor, pdev->device, pdev->revision); 1869 pdev->vendor, pdev->device, pdev->revision);
1878 return -ENODEV; 1870 return -ENODEV;
1879 } 1871 }
1880 1872
@@ -1932,14 +1924,13 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1932 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 1924 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
1933 if (rc) { 1925 if (rc) {
1934 dev_err(&pdev->dev, 1926 dev_err(&pdev->dev,
1935 "No usable DMA configuration, aborting.\n"); 1927 "No usable DMA configuration, aborting\n");
1936 goto err_out_res; 1928 goto err_out_res;
1937 } 1929 }
1938 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 1930 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
1939 if (rc) { 1931 if (rc) {
1940 dev_err(&pdev->dev, 1932 dev_err(&pdev->dev,
1941 "No usable consistent DMA configuration, " 1933 "No usable consistent DMA configuration, aborting\n");
1942 "aborting.\n");
1943 goto err_out_res; 1934 goto err_out_res;
1944 } 1935 }
1945 } 1936 }
@@ -1951,7 +1942,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1951 if (!regs) { 1942 if (!regs) {
1952 rc = -EIO; 1943 rc = -EIO;
1953 dev_err(&pdev->dev, "Cannot map PCI MMIO (%Lx@%Lx)\n", 1944 dev_err(&pdev->dev, "Cannot map PCI MMIO (%Lx@%Lx)\n",
1954 (unsigned long long)pci_resource_len(pdev, 1), 1945 (unsigned long long)pci_resource_len(pdev, 1),
1955 (unsigned long long)pciaddr); 1946 (unsigned long long)pciaddr);
1956 goto err_out_res; 1947 goto err_out_res;
1957 } 1948 }
@@ -1989,11 +1980,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1989 if (rc) 1980 if (rc)
1990 goto err_out_iomap; 1981 goto err_out_iomap;
1991 1982
1992 pr_info("%s: RTL-8139C+ at 0x%lx, %pM, IRQ %d\n", 1983 netdev_info(dev, "RTL-8139C+ at 0x%lx, %pM, IRQ %d\n",
1993 dev->name, 1984 dev->base_addr, dev->dev_addr, dev->irq);
1994 dev->base_addr,
1995 dev->dev_addr,
1996 dev->irq);
1997 1985
1998 pci_set_drvdata(pdev, dev); 1986 pci_set_drvdata(pdev, dev);
1999 1987