aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/jme.c98
-rw-r--r--drivers/net/jme.h3
2 files changed, 48 insertions, 53 deletions
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 1fcd533b1a61..c04c096bc6a9 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -21,6 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/module.h> 26#include <linux/module.h>
25#include <linux/kernel.h> 27#include <linux/kernel.h>
26#include <linux/pci.h> 28#include <linux/pci.h>
@@ -73,7 +75,7 @@ read_again:
73 } 75 }
74 76
75 if (i == 0) { 77 if (i == 0) {
76 jeprintk(jme->pdev, "phy(%d) read timeout : %d\n", phy, reg); 78 pr_err("phy(%d) read timeout : %d\n", phy, reg);
77 return 0; 79 return 0;
78 } 80 }
79 81
@@ -102,7 +104,7 @@ jme_mdio_write(struct net_device *netdev,
102 } 104 }
103 105
104 if (i == 0) 106 if (i == 0)
105 jeprintk(jme->pdev, "phy(%d) write timeout : %d\n", phy, reg); 107 pr_err("phy(%d) write timeout : %d\n", phy, reg);
106} 108}
107 109
108static inline void 110static inline void
@@ -227,7 +229,7 @@ jme_reload_eeprom(struct jme_adapter *jme)
227 } 229 }
228 230
229 if (i == 0) { 231 if (i == 0) {
230 jeprintk(jme->pdev, "eeprom reload timeout\n"); 232 pr_err("eeprom reload timeout\n");
231 return -EIO; 233 return -EIO;
232 } 234 }
233 } 235 }
@@ -397,8 +399,7 @@ jme_check_link(struct net_device *netdev, int testonly)
397 phylink = jread32(jme, JME_PHY_LINK); 399 phylink = jread32(jme, JME_PHY_LINK);
398 } 400 }
399 if (!cnt) 401 if (!cnt)
400 jeprintk(jme->pdev, 402 pr_err("Waiting speed resolve timeout\n");
401 "Waiting speed resolve timeout.\n");
402 403
403 strcat(linkmsg, "ANed: "); 404 strcat(linkmsg, "ANed: ");
404 } 405 }
@@ -480,13 +481,13 @@ jme_check_link(struct net_device *netdev, int testonly)
480 strcat(linkmsg, (phylink & PHY_LINK_MDI_STAT) ? 481 strcat(linkmsg, (phylink & PHY_LINK_MDI_STAT) ?
481 "MDI-X" : 482 "MDI-X" :
482 "MDI"); 483 "MDI");
483 netif_info(jme, link, jme->dev, "Link is up at %s.\n", linkmsg); 484 netif_info(jme, link, jme->dev, "Link is up at %s\n", linkmsg);
484 netif_carrier_on(netdev); 485 netif_carrier_on(netdev);
485 } else { 486 } else {
486 if (testonly) 487 if (testonly)
487 goto out; 488 goto out;
488 489
489 netif_info(jme, link, jme->dev, "Link is down.\n"); 490 netif_info(jme, link, jme->dev, "Link is down\n");
490 jme->phylink = 0; 491 jme->phylink = 0;
491 netif_carrier_off(netdev); 492 netif_carrier_off(netdev);
492 } 493 }
@@ -648,7 +649,7 @@ jme_disable_tx_engine(struct jme_adapter *jme)
648 } 649 }
649 650
650 if (!i) 651 if (!i)
651 jeprintk(jme->pdev, "Disable TX engine timeout.\n"); 652 pr_err("Disable TX engine timeout\n");
652} 653}
653 654
654static void 655static void
@@ -867,7 +868,7 @@ jme_disable_rx_engine(struct jme_adapter *jme)
867 } 868 }
868 869
869 if (!i) 870 if (!i)
870 jeprintk(jme->pdev, "Disable RX engine timeout.\n"); 871 pr_err("Disable RX engine timeout\n");
871 872
872} 873}
873 874
@@ -887,13 +888,13 @@ jme_rxsum_ok(struct jme_adapter *jme, u16 flags)
887 if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_UDPON | RXWBFLAG_UDPCS)) 888 if (unlikely((flags & (RXWBFLAG_MF | RXWBFLAG_UDPON | RXWBFLAG_UDPCS))
888 == RXWBFLAG_UDPON)) { 889 == RXWBFLAG_UDPON)) {
889 if (flags & RXWBFLAG_IPV4) 890 if (flags & RXWBFLAG_IPV4)
890 netif_err(jme, rx_err, jme->dev, "UDP Checksum error.\n"); 891 netif_err(jme, rx_err, jme->dev, "UDP Checksum error\n");
891 return false; 892 return false;
892 } 893 }
893 894
894 if (unlikely((flags & (RXWBFLAG_IPV4 | RXWBFLAG_IPCS)) 895 if (unlikely((flags & (RXWBFLAG_IPV4 | RXWBFLAG_IPCS))
895 == RXWBFLAG_IPV4)) { 896 == RXWBFLAG_IPV4)) {
896 netif_err(jme, rx_err, jme->dev, "IPv4 Checksum error.\n"); 897 netif_err(jme, rx_err, jme->dev, "IPv4 Checksum error\n");
897 return false; 898 return false;
898 } 899 }
899 900
@@ -1185,9 +1186,9 @@ jme_link_change_tasklet(unsigned long arg)
1185 1186
1186 while (!atomic_dec_and_test(&jme->link_changing)) { 1187 while (!atomic_dec_and_test(&jme->link_changing)) {
1187 atomic_inc(&jme->link_changing); 1188 atomic_inc(&jme->link_changing);
1188 netif_info(jme, intr, jme->dev, "Get link change lock failed.\n"); 1189 netif_info(jme, intr, jme->dev, "Get link change lock failed\n");
1189 while (atomic_read(&jme->link_changing) != 1) 1190 while (atomic_read(&jme->link_changing) != 1)
1190 netif_info(jme, intr, jme->dev, "Waiting link change lock.\n"); 1191 netif_info(jme, intr, jme->dev, "Waiting link change lock\n");
1191 } 1192 }
1192 1193
1193 if (jme_check_link(netdev, 1) && jme->old_mtu == netdev->mtu) 1194 if (jme_check_link(netdev, 1) && jme->old_mtu == netdev->mtu)
@@ -1221,15 +1222,13 @@ jme_link_change_tasklet(unsigned long arg)
1221 if (netif_carrier_ok(netdev)) { 1222 if (netif_carrier_ok(netdev)) {
1222 rc = jme_setup_rx_resources(jme); 1223 rc = jme_setup_rx_resources(jme);
1223 if (rc) { 1224 if (rc) {
1224 jeprintk(jme->pdev, "Allocating resources for RX error" 1225 pr_err("Allocating resources for RX error, Device STOPPED!\n");
1225 ", Device STOPPED!\n");
1226 goto out_enable_tasklet; 1226 goto out_enable_tasklet;
1227 } 1227 }
1228 1228
1229 rc = jme_setup_tx_resources(jme); 1229 rc = jme_setup_tx_resources(jme);
1230 if (rc) { 1230 if (rc) {
1231 jeprintk(jme->pdev, "Allocating resources for TX error" 1231 pr_err("Allocating resources for TX error, Device STOPPED!\n");
1232 ", Device STOPPED!\n");
1233 goto err_out_free_rx_resources; 1232 goto err_out_free_rx_resources;
1234 } 1233 }
1235 1234
@@ -1324,7 +1323,7 @@ jme_wake_queue_if_stopped(struct jme_adapter *jme)
1324 smp_wmb(); 1323 smp_wmb();
1325 if (unlikely(netif_queue_stopped(jme->dev) && 1324 if (unlikely(netif_queue_stopped(jme->dev) &&
1326 atomic_read(&txring->nr_free) >= (jme->tx_wake_threshold))) { 1325 atomic_read(&txring->nr_free) >= (jme->tx_wake_threshold))) {
1327 netif_info(jme, tx_done, jme->dev, "TX Queue Waked.\n"); 1326 netif_info(jme, tx_done, jme->dev, "TX Queue Waked\n");
1328 netif_wake_queue(jme->dev); 1327 netif_wake_queue(jme->dev);
1329 } 1328 }
1330 1329
@@ -1339,7 +1338,7 @@ jme_tx_clean_tasklet(unsigned long arg)
1339 struct jme_buffer_info *txbi = txring->bufinf, *ctxbi, *ttxbi; 1338 struct jme_buffer_info *txbi = txring->bufinf, *ctxbi, *ttxbi;
1340 int i, j, cnt = 0, max, err, mask; 1339 int i, j, cnt = 0, max, err, mask;
1341 1340
1342 tx_dbg(jme, "Into txclean.\n"); 1341 tx_dbg(jme, "Into txclean\n");
1343 1342
1344 if (unlikely(!atomic_dec_and_test(&jme->tx_cleaning))) 1343 if (unlikely(!atomic_dec_and_test(&jme->tx_cleaning)))
1345 goto out; 1344 goto out;
@@ -1361,7 +1360,7 @@ jme_tx_clean_tasklet(unsigned long arg)
1361 !(txdesc[i].descwb.flags & TXWBFLAG_OWN))) { 1360 !(txdesc[i].descwb.flags & TXWBFLAG_OWN))) {
1362 1361
1363 tx_dbg(jme, "txclean: %d+%d@%lu\n", 1362 tx_dbg(jme, "txclean: %d+%d@%lu\n",
1364 i, ctxbi->nr_desc, jiffies); 1363 i, ctxbi->nr_desc, jiffies);
1365 1364
1366 err = txdesc[i].descwb.flags & TXWBFLAG_ALLERR; 1365 err = txdesc[i].descwb.flags & TXWBFLAG_ALLERR;
1367 1366
@@ -1402,7 +1401,7 @@ jme_tx_clean_tasklet(unsigned long arg)
1402 ctxbi->nr_desc = 0; 1401 ctxbi->nr_desc = 0;
1403 } 1402 }
1404 1403
1405 tx_dbg(jme, "txclean: done %d@%lu.\n", i, jiffies); 1404 tx_dbg(jme, "txclean: done %d@%lu\n", i, jiffies);
1406 atomic_set(&txring->next_to_clean, i); 1405 atomic_set(&txring->next_to_clean, i);
1407 atomic_add(cnt, &txring->nr_free); 1406 atomic_add(cnt, &txring->nr_free);
1408 1407
@@ -1548,10 +1547,10 @@ jme_request_irq(struct jme_adapter *jme)
1548 rc = request_irq(jme->pdev->irq, handler, irq_flags, netdev->name, 1547 rc = request_irq(jme->pdev->irq, handler, irq_flags, netdev->name,
1549 netdev); 1548 netdev);
1550 if (rc) { 1549 if (rc) {
1551 jeprintk(jme->pdev, 1550 netdev_err(netdev,
1552 "Unable to request %s interrupt (return: %d)\n", 1551 "Unable to request %s interrupt (return: %d)\n",
1553 test_bit(JME_FLAG_MSI, &jme->flags) ? "MSI" : "INTx", 1552 test_bit(JME_FLAG_MSI, &jme->flags) ? "MSI" : "INTx",
1554 rc); 1553 rc);
1555 1554
1556 if (test_bit(JME_FLAG_MSI, &jme->flags)) { 1555 if (test_bit(JME_FLAG_MSI, &jme->flags)) {
1557 pci_disable_msi(jme->pdev); 1556 pci_disable_msi(jme->pdev);
@@ -1834,7 +1833,7 @@ jme_tx_csum(struct jme_adapter *jme, struct sk_buff *skb, u8 *flags)
1834 *flags |= TXFLAG_UDPCS; 1833 *flags |= TXFLAG_UDPCS;
1835 break; 1834 break;
1836 default: 1835 default:
1837 netif_err(jme, tx_err, jme->dev, "Error upper layer protocol.\n"); 1836 netif_err(jme, tx_err, jme->dev, "Error upper layer protocol\n");
1838 break; 1837 break;
1839 } 1838 }
1840 } 1839 }
@@ -1909,12 +1908,12 @@ jme_stop_queue_if_full(struct jme_adapter *jme)
1909 smp_wmb(); 1908 smp_wmb();
1910 if (unlikely(atomic_read(&txring->nr_free) < (MAX_SKB_FRAGS+2))) { 1909 if (unlikely(atomic_read(&txring->nr_free) < (MAX_SKB_FRAGS+2))) {
1911 netif_stop_queue(jme->dev); 1910 netif_stop_queue(jme->dev);
1912 netif_info(jme, tx_queued, jme->dev, "TX Queue Paused.\n"); 1911 netif_info(jme, tx_queued, jme->dev, "TX Queue Paused\n");
1913 smp_wmb(); 1912 smp_wmb();
1914 if (atomic_read(&txring->nr_free) 1913 if (atomic_read(&txring->nr_free)
1915 >= (jme->tx_wake_threshold)) { 1914 >= (jme->tx_wake_threshold)) {
1916 netif_wake_queue(jme->dev); 1915 netif_wake_queue(jme->dev);
1917 netif_info(jme, tx_queued, jme->dev, "TX Queue Fast Waked.\n"); 1916 netif_info(jme, tx_queued, jme->dev, "TX Queue Fast Waked\n");
1918 } 1917 }
1919 } 1918 }
1920 1919
@@ -1922,7 +1921,8 @@ jme_stop_queue_if_full(struct jme_adapter *jme)
1922 (jiffies - txbi->start_xmit) >= TX_TIMEOUT && 1921 (jiffies - txbi->start_xmit) >= TX_TIMEOUT &&
1923 txbi->skb)) { 1922 txbi->skb)) {
1924 netif_stop_queue(jme->dev); 1923 netif_stop_queue(jme->dev);
1925 netif_info(jme, tx_queued, jme->dev, "TX Queue Stopped %d@%lu.\n", idx, jiffies); 1924 netif_info(jme, tx_queued, jme->dev,
1925 "TX Queue Stopped %d@%lu\n", idx, jiffies);
1926 } 1926 }
1927} 1927}
1928 1928
@@ -1945,7 +1945,8 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
1945 1945
1946 if (unlikely(idx < 0)) { 1946 if (unlikely(idx < 0)) {
1947 netif_stop_queue(netdev); 1947 netif_stop_queue(netdev);
1948 netif_err(jme, tx_err, jme->dev, "BUG! Tx ring full when queue awake!\n"); 1948 netif_err(jme, tx_err, jme->dev,
1949 "BUG! Tx ring full when queue awake!\n");
1949 1950
1950 return NETDEV_TX_BUSY; 1951 return NETDEV_TX_BUSY;
1951 } 1952 }
@@ -1957,9 +1958,8 @@ jme_start_xmit(struct sk_buff *skb, struct net_device *netdev)
1957 TXCS_QUEUE0S | 1958 TXCS_QUEUE0S |
1958 TXCS_ENABLE); 1959 TXCS_ENABLE);
1959 1960
1960 tx_dbg(jme, "xmit: %d+%d@%lu\n", idx, 1961 tx_dbg(jme, "xmit: %d+%d@%lu\n",
1961 skb_shinfo(skb)->nr_frags + 2, 1962 idx, skb_shinfo(skb)->nr_frags + 2, jiffies);
1962 jiffies);
1963 jme_stop_queue_if_full(jme); 1963 jme_stop_queue_if_full(jme);
1964 1964
1965 return NETDEV_TX_OK; 1965 return NETDEV_TX_OK;
@@ -2501,7 +2501,7 @@ jme_smb_read(struct jme_adapter *jme, unsigned int addr)
2501 val = jread32(jme, JME_SMBCSR); 2501 val = jread32(jme, JME_SMBCSR);
2502 } 2502 }
2503 if (!to) { 2503 if (!to) {
2504 netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n"); 2504 netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
2505 return 0xFF; 2505 return 0xFF;
2506 } 2506 }
2507 2507
@@ -2517,7 +2517,7 @@ jme_smb_read(struct jme_adapter *jme, unsigned int addr)
2517 val = jread32(jme, JME_SMBINTF); 2517 val = jread32(jme, JME_SMBINTF);
2518 } 2518 }
2519 if (!to) { 2519 if (!to) {
2520 netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n"); 2520 netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
2521 return 0xFF; 2521 return 0xFF;
2522 } 2522 }
2523 2523
@@ -2537,7 +2537,7 @@ jme_smb_write(struct jme_adapter *jme, unsigned int addr, u8 data)
2537 val = jread32(jme, JME_SMBCSR); 2537 val = jread32(jme, JME_SMBCSR);
2538 } 2538 }
2539 if (!to) { 2539 if (!to) {
2540 netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n"); 2540 netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
2541 return; 2541 return;
2542 } 2542 }
2543 2543
@@ -2554,7 +2554,7 @@ jme_smb_write(struct jme_adapter *jme, unsigned int addr, u8 data)
2554 val = jread32(jme, JME_SMBINTF); 2554 val = jread32(jme, JME_SMBINTF);
2555 } 2555 }
2556 if (!to) { 2556 if (!to) {
2557 netif_err(jme, hw, jme->dev, "SMB Bus Busy.\n"); 2557 netif_err(jme, hw, jme->dev, "SMB Bus Busy\n");
2558 return; 2558 return;
2559 } 2559 }
2560 2560
@@ -2699,26 +2699,26 @@ jme_init_one(struct pci_dev *pdev,
2699 */ 2699 */
2700 rc = pci_enable_device(pdev); 2700 rc = pci_enable_device(pdev);
2701 if (rc) { 2701 if (rc) {
2702 jeprintk(pdev, "Cannot enable PCI device.\n"); 2702 pr_err("Cannot enable PCI device\n");
2703 goto err_out; 2703 goto err_out;
2704 } 2704 }
2705 2705
2706 using_dac = jme_pci_dma64(pdev); 2706 using_dac = jme_pci_dma64(pdev);
2707 if (using_dac < 0) { 2707 if (using_dac < 0) {
2708 jeprintk(pdev, "Cannot set PCI DMA Mask.\n"); 2708 pr_err("Cannot set PCI DMA Mask\n");
2709 rc = -EIO; 2709 rc = -EIO;
2710 goto err_out_disable_pdev; 2710 goto err_out_disable_pdev;
2711 } 2711 }
2712 2712
2713 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 2713 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
2714 jeprintk(pdev, "No PCI resource region found.\n"); 2714 pr_err("No PCI resource region found\n");
2715 rc = -ENOMEM; 2715 rc = -ENOMEM;
2716 goto err_out_disable_pdev; 2716 goto err_out_disable_pdev;
2717 } 2717 }
2718 2718
2719 rc = pci_request_regions(pdev, DRV_NAME); 2719 rc = pci_request_regions(pdev, DRV_NAME);
2720 if (rc) { 2720 if (rc) {
2721 jeprintk(pdev, "Cannot obtain PCI resource region.\n"); 2721 pr_err("Cannot obtain PCI resource region\n");
2722 goto err_out_disable_pdev; 2722 goto err_out_disable_pdev;
2723 } 2723 }
2724 2724
@@ -2729,7 +2729,7 @@ jme_init_one(struct pci_dev *pdev,
2729 */ 2729 */
2730 netdev = alloc_etherdev(sizeof(*jme)); 2730 netdev = alloc_etherdev(sizeof(*jme));
2731 if (!netdev) { 2731 if (!netdev) {
2732 jeprintk(pdev, "Cannot allocate netdev structure.\n"); 2732 pr_err("Cannot allocate netdev structure\n");
2733 rc = -ENOMEM; 2733 rc = -ENOMEM;
2734 goto err_out_release_regions; 2734 goto err_out_release_regions;
2735 } 2735 }
@@ -2767,7 +2767,7 @@ jme_init_one(struct pci_dev *pdev,
2767 jme->regs = ioremap(pci_resource_start(pdev, 0), 2767 jme->regs = ioremap(pci_resource_start(pdev, 0),
2768 pci_resource_len(pdev, 0)); 2768 pci_resource_len(pdev, 0));
2769 if (!(jme->regs)) { 2769 if (!(jme->regs)) {
2770 jeprintk(pdev, "Mapping PCI resource region error.\n"); 2770 pr_err("Mapping PCI resource region error\n");
2771 rc = -ENOMEM; 2771 rc = -ENOMEM;
2772 goto err_out_free_netdev; 2772 goto err_out_free_netdev;
2773 } 2773 }
@@ -2855,8 +2855,8 @@ jme_init_one(struct pci_dev *pdev,
2855 2855
2856 if (!jme->mii_if.phy_id) { 2856 if (!jme->mii_if.phy_id) {
2857 rc = -EIO; 2857 rc = -EIO;
2858 jeprintk(pdev, "Can not find phy_id.\n"); 2858 pr_err("Can not find phy_id\n");
2859 goto err_out_unmap; 2859 goto err_out_unmap;
2860 } 2860 }
2861 2861
2862 jme->reg_ghc |= GHC_LINK_POLL; 2862 jme->reg_ghc |= GHC_LINK_POLL;
@@ -2883,8 +2883,7 @@ jme_init_one(struct pci_dev *pdev,
2883 jme_reset_mac_processor(jme); 2883 jme_reset_mac_processor(jme);
2884 rc = jme_reload_eeprom(jme); 2884 rc = jme_reload_eeprom(jme);
2885 if (rc) { 2885 if (rc) {
2886 jeprintk(pdev, 2886 pr_err("Reload eeprom for reading MAC Address error\n");
2887 "Reload eeprom for reading MAC Address error.\n");
2888 goto err_out_unmap; 2887 goto err_out_unmap;
2889 } 2888 }
2890 jme_load_macaddr(netdev); 2889 jme_load_macaddr(netdev);
@@ -2900,7 +2899,7 @@ jme_init_one(struct pci_dev *pdev,
2900 */ 2899 */
2901 rc = register_netdev(netdev); 2900 rc = register_netdev(netdev);
2902 if (rc) { 2901 if (rc) {
2903 jeprintk(pdev, "Cannot register net device.\n"); 2902 pr_err("Cannot register net device\n");
2904 goto err_out_unmap; 2903 goto err_out_unmap;
2905 } 2904 }
2906 2905
@@ -3042,8 +3041,7 @@ static struct pci_driver jme_driver = {
3042static int __init 3041static int __init
3043jme_init_module(void) 3042jme_init_module(void)
3044{ 3043{
3045 printk(KERN_INFO PFX "JMicron JMC2XX ethernet " 3044 pr_info("JMicron JMC2XX ethernet driver version %s\n", DRV_VERSION);
3046 "driver version %s\n", DRV_VERSION);
3047 return pci_register_driver(&jme_driver); 3045 return pci_register_driver(&jme_driver);
3048} 3046}
3049 3047
diff --git a/drivers/net/jme.h b/drivers/net/jme.h
index 07ad3a457185..1360f68861b8 100644
--- a/drivers/net/jme.h
+++ b/drivers/net/jme.h
@@ -41,9 +41,6 @@
41 NETIF_MSG_TX_ERR | \ 41 NETIF_MSG_TX_ERR | \
42 NETIF_MSG_HW) 42 NETIF_MSG_HW)
43 43
44#define jeprintk(pdev, fmt, args...) \
45 printk(KERN_ERR PFX fmt, ## args)
46
47#ifdef TX_DEBUG 44#ifdef TX_DEBUG
48#define tx_dbg(priv, fmt, args...) \ 45#define tx_dbg(priv, fmt, args...) \
49 printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args) 46 printk(KERN_DEBUG "%s: " fmt, (priv)->dev->name, ##args)