aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/niu.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/niu.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r--drivers/net/niu.c717
1 files changed, 306 insertions, 411 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index d6c7ac68f6ea..d5cd16bfc907 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -3,6 +3,8 @@
3 * Copyright (C) 2007, 2008 David S. Miller (davem@davemloft.net) 3 * Copyright (C) 2007, 2008 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7
6#include <linux/module.h> 8#include <linux/module.h>
7#include <linux/init.h> 9#include <linux/init.h>
8#include <linux/pci.h> 10#include <linux/pci.h>
@@ -23,6 +25,7 @@
23#include <linux/jiffies.h> 25#include <linux/jiffies.h>
24#include <linux/crc32.h> 26#include <linux/crc32.h>
25#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/slab.h>
26 29
27#include <linux/io.h> 30#include <linux/io.h>
28 31
@@ -33,7 +36,6 @@
33#include "niu.h" 36#include "niu.h"
34 37
35#define DRV_MODULE_NAME "niu" 38#define DRV_MODULE_NAME "niu"
36#define PFX DRV_MODULE_NAME ": "
37#define DRV_MODULE_VERSION "1.0" 39#define DRV_MODULE_VERSION "1.0"
38#define DRV_MODULE_RELDATE "Nov 14, 2008" 40#define DRV_MODULE_RELDATE "Nov 14, 2008"
39 41
@@ -45,10 +47,6 @@ MODULE_DESCRIPTION("NIU ethernet driver");
45MODULE_LICENSE("GPL"); 47MODULE_LICENSE("GPL");
46MODULE_VERSION(DRV_MODULE_VERSION); 48MODULE_VERSION(DRV_MODULE_VERSION);
47 49
48#ifndef DMA_44BIT_MASK
49#define DMA_44BIT_MASK 0x00000fffffffffffULL
50#endif
51
52#ifndef readq 50#ifndef readq
53static u64 readq(void __iomem *reg) 51static u64 readq(void __iomem *reg)
54{ 52{
@@ -62,7 +60,7 @@ static void writeq(u64 val, void __iomem *reg)
62} 60}
63#endif 61#endif
64 62
65static struct pci_device_id niu_pci_tbl[] = { 63static DEFINE_PCI_DEVICE_TABLE(niu_pci_tbl) = {
66 {PCI_DEVICE(PCI_VENDOR_ID_SUN, 0xabcd)}, 64 {PCI_DEVICE(PCI_VENDOR_ID_SUN, 0xabcd)},
67 {} 65 {}
68}; 66};
@@ -93,21 +91,6 @@ static int debug = -1;
93module_param(debug, int, 0); 91module_param(debug, int, 0);
94MODULE_PARM_DESC(debug, "NIU debug level"); 92MODULE_PARM_DESC(debug, "NIU debug level");
95 93
96#define niudbg(TYPE, f, a...) \
97do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \
98 printk(KERN_DEBUG PFX f, ## a); \
99} while (0)
100
101#define niuinfo(TYPE, f, a...) \
102do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \
103 printk(KERN_INFO PFX f, ## a); \
104} while (0)
105
106#define niuwarn(TYPE, f, a...) \
107do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \
108 printk(KERN_WARNING PFX f, ## a); \
109} while (0)
110
111#define niu_lock_parent(np, flags) \ 94#define niu_lock_parent(np, flags) \
112 spin_lock_irqsave(&np->parent->lock, flags) 95 spin_lock_irqsave(&np->parent->lock, flags)
113#define niu_unlock_parent(np, flags) \ 96#define niu_unlock_parent(np, flags) \
@@ -139,10 +122,9 @@ static int __niu_set_and_wait_clear_mac(struct niu *np, unsigned long reg,
139 nw64_mac(reg, bits); 122 nw64_mac(reg, bits);
140 err = __niu_wait_bits_clear_mac(np, reg, bits, limit, delay); 123 err = __niu_wait_bits_clear_mac(np, reg, bits, limit, delay);
141 if (err) 124 if (err)
142 dev_err(np->device, PFX "%s: bits (%llx) of register %s " 125 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n",
143 "would not clear, val[%llx]\n", 126 (unsigned long long)bits, reg_name,
144 np->dev->name, (unsigned long long) bits, reg_name, 127 (unsigned long long)nr64_mac(reg));
145 (unsigned long long) nr64_mac(reg));
146 return err; 128 return err;
147} 129}
148 130
@@ -179,10 +161,9 @@ static int __niu_set_and_wait_clear_ipp(struct niu *np, unsigned long reg,
179 161
180 err = __niu_wait_bits_clear_ipp(np, reg, bits, limit, delay); 162 err = __niu_wait_bits_clear_ipp(np, reg, bits, limit, delay);
181 if (err) 163 if (err)
182 dev_err(np->device, PFX "%s: bits (%llx) of register %s " 164 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n",
183 "would not clear, val[%llx]\n", 165 (unsigned long long)bits, reg_name,
184 np->dev->name, (unsigned long long) bits, reg_name, 166 (unsigned long long)nr64_ipp(reg));
185 (unsigned long long) nr64_ipp(reg));
186 return err; 167 return err;
187} 168}
188 169
@@ -220,10 +201,9 @@ static int __niu_set_and_wait_clear(struct niu *np, unsigned long reg,
220 nw64(reg, bits); 201 nw64(reg, bits);
221 err = __niu_wait_bits_clear(np, reg, bits, limit, delay); 202 err = __niu_wait_bits_clear(np, reg, bits, limit, delay);
222 if (err) 203 if (err)
223 dev_err(np->device, PFX "%s: bits (%llx) of register %s " 204 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n",
224 "would not clear, val[%llx]\n", 205 (unsigned long long)bits, reg_name,
225 np->dev->name, (unsigned long long) bits, reg_name, 206 (unsigned long long)nr64(reg));
226 (unsigned long long) nr64(reg));
227 return err; 207 return err;
228} 208}
229 209
@@ -479,9 +459,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np)
479 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 459 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
480 ESR2_TI_PLL_CFG_L, pll_cfg); 460 ESR2_TI_PLL_CFG_L, pll_cfg);
481 if (err) { 461 if (err) {
482 dev_err(np->device, PFX "NIU Port %d " 462 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_CFG_L failed\n",
483 "serdes_init_niu_1g_serdes: " 463 np->port, __func__);
484 "mdio write to ESR2_TI_PLL_CFG_L failed", np->port);
485 return err; 464 return err;
486 } 465 }
487 466
@@ -490,9 +469,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np)
490 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 469 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
491 ESR2_TI_PLL_STS_L, pll_sts); 470 ESR2_TI_PLL_STS_L, pll_sts);
492 if (err) { 471 if (err) {
493 dev_err(np->device, PFX "NIU Port %d " 472 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_STS_L failed\n",
494 "serdes_init_niu_1g_serdes: " 473 np->port, __func__);
495 "mdio write to ESR2_TI_PLL_STS_L failed", np->port);
496 return err; 474 return err;
497 } 475 }
498 476
@@ -535,8 +513,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np)
535 } 513 }
536 514
537 if ((sig & mask) != val) { 515 if ((sig & mask) != val) {
538 dev_err(np->device, PFX "Port %u signal bits [%08x] are not " 516 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n",
539 "[%08x]\n", np->port, (int) (sig & mask), (int) val); 517 np->port, (int)(sig & mask), (int)val);
540 return -ENODEV; 518 return -ENODEV;
541 } 519 }
542 520
@@ -573,9 +551,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
573 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 551 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
574 ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff); 552 ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff);
575 if (err) { 553 if (err) {
576 dev_err(np->device, PFX "NIU Port %d " 554 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_CFG_L failed\n",
577 "serdes_init_niu_10g_serdes: " 555 np->port, __func__);
578 "mdio write to ESR2_TI_PLL_CFG_L failed", np->port);
579 return err; 556 return err;
580 } 557 }
581 558
@@ -584,9 +561,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
584 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 561 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
585 ESR2_TI_PLL_STS_L, pll_sts & 0xffff); 562 ESR2_TI_PLL_STS_L, pll_sts & 0xffff);
586 if (err) { 563 if (err) {
587 dev_err(np->device, PFX "NIU Port %d " 564 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_STS_L failed\n",
588 "serdes_init_niu_10g_serdes: " 565 np->port, __func__);
589 "mdio write to ESR2_TI_PLL_STS_L failed", np->port);
590 return err; 566 return err;
591 } 567 }
592 568
@@ -643,9 +619,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
643 } 619 }
644 620
645 if ((sig & mask) != val) { 621 if ((sig & mask) != val) {
646 pr_info(PFX "NIU Port %u signal bits [%08x] are not " 622 pr_info("NIU Port %u signal bits [%08x] are not [%08x] for 10G...trying 1G\n",
647 "[%08x] for 10G...trying 1G\n", 623 np->port, (int)(sig & mask), (int)val);
648 np->port, (int) (sig & mask), (int) val);
649 624
650 /* 10G failed, try initializing at 1G */ 625 /* 10G failed, try initializing at 1G */
651 err = serdes_init_niu_1g_serdes(np); 626 err = serdes_init_niu_1g_serdes(np);
@@ -653,8 +628,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
653 np->flags &= ~NIU_FLAGS_10G; 628 np->flags &= ~NIU_FLAGS_10G;
654 np->mac_xcvr = MAC_XCVR_PCS; 629 np->mac_xcvr = MAC_XCVR_PCS;
655 } else { 630 } else {
656 dev_err(np->device, PFX "Port %u 10G/1G SERDES " 631 netdev_err(np->dev, "Port %u 10G/1G SERDES Link Failed\n",
657 "Link Failed \n", np->port); 632 np->port);
658 return -ENODEV; 633 return -ENODEV;
659 } 634 }
660 } 635 }
@@ -768,9 +743,8 @@ static int esr_reset(struct niu *np)
768 if (err) 743 if (err)
769 return err; 744 return err;
770 if (reset != 0) { 745 if (reset != 0) {
771 dev_err(np->device, PFX "Port %u ESR_RESET " 746 netdev_err(np->dev, "Port %u ESR_RESET did not clear [%08x]\n",
772 "did not clear [%08x]\n", 747 np->port, reset);
773 np->port, reset);
774 return -ENODEV; 748 return -ENODEV;
775 } 749 }
776 750
@@ -894,8 +868,8 @@ static int serdes_init_10g(struct niu *np)
894 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; 868 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT;
895 return 0; 869 return 0;
896 } 870 }
897 dev_err(np->device, PFX "Port %u signal bits [%08x] are not " 871 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n",
898 "[%08x]\n", np->port, (int) (sig & mask), (int) val); 872 np->port, (int)(sig & mask), (int)val);
899 return -ENODEV; 873 return -ENODEV;
900 } 874 }
901 if (np->flags & NIU_FLAGS_HOTPLUG_PHY) 875 if (np->flags & NIU_FLAGS_HOTPLUG_PHY)
@@ -1043,8 +1017,8 @@ static int serdes_init_1g_serdes(struct niu *np)
1043 } 1017 }
1044 1018
1045 if ((sig & mask) != val) { 1019 if ((sig & mask) != val) {
1046 dev_err(np->device, PFX "Port %u signal bits [%08x] are not " 1020 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n",
1047 "[%08x]\n", np->port, (int) (sig & mask), (int) val); 1021 np->port, (int)(sig & mask), (int)val);
1048 return -ENODEV; 1022 return -ENODEV;
1049 } 1023 }
1050 1024
@@ -1336,8 +1310,8 @@ static int bcm8704_reset(struct niu *np)
1336 break; 1310 break;
1337 } 1311 }
1338 if (limit < 0) { 1312 if (limit < 0) {
1339 dev_err(np->device, PFX "Port %u PHY will not reset " 1313 netdev_err(np->dev, "Port %u PHY will not reset (bmcr=%04x)\n",
1340 "(bmcr=%04x)\n", np->port, (err & 0xffff)); 1314 np->port, (err & 0xffff));
1341 return -ENODEV; 1315 return -ENODEV;
1342 } 1316 }
1343 return 0; 1317 return 0;
@@ -1519,21 +1493,18 @@ static int xcvr_diag_bcm870x(struct niu *np)
1519 MII_STAT1000); 1493 MII_STAT1000);
1520 if (err < 0) 1494 if (err < 0)
1521 return err; 1495 return err;
1522 pr_info(PFX "Port %u PMA_PMD(MII_STAT1000) [%04x]\n", 1496 pr_info("Port %u PMA_PMD(MII_STAT1000) [%04x]\n", np->port, err);
1523 np->port, err);
1524 1497
1525 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, 0x20); 1498 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, 0x20);
1526 if (err < 0) 1499 if (err < 0)
1527 return err; 1500 return err;
1528 pr_info(PFX "Port %u USER_DEV3(0x20) [%04x]\n", 1501 pr_info("Port %u USER_DEV3(0x20) [%04x]\n", np->port, err);
1529 np->port, err);
1530 1502
1531 err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, 1503 err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR,
1532 MII_NWAYTEST); 1504 MII_NWAYTEST);
1533 if (err < 0) 1505 if (err < 0)
1534 return err; 1506 return err;
1535 pr_info(PFX "Port %u PHYXS(MII_NWAYTEST) [%04x]\n", 1507 pr_info("Port %u PHYXS(MII_NWAYTEST) [%04x]\n", np->port, err);
1536 np->port, err);
1537#endif 1508#endif
1538 1509
1539 /* XXX dig this out it might not be so useful XXX */ 1510 /* XXX dig this out it might not be so useful XXX */
@@ -1559,11 +1530,11 @@ static int xcvr_diag_bcm870x(struct niu *np)
1559 1530
1560 if (analog_stat0 != 0x03fc) { 1531 if (analog_stat0 != 0x03fc) {
1561 if ((analog_stat0 == 0x43bc) && (tx_alarm_status != 0)) { 1532 if ((analog_stat0 == 0x43bc) && (tx_alarm_status != 0)) {
1562 pr_info(PFX "Port %u cable not connected " 1533 pr_info("Port %u cable not connected or bad cable\n",
1563 "or bad cable.\n", np->port); 1534 np->port);
1564 } else if (analog_stat0 == 0x639c) { 1535 } else if (analog_stat0 == 0x639c) {
1565 pr_info(PFX "Port %u optical module is bad " 1536 pr_info("Port %u optical module is bad or missing\n",
1566 "or missing.\n", np->port); 1537 np->port);
1567 } 1538 }
1568 } 1539 }
1569 1540
@@ -1703,8 +1674,8 @@ static int mii_reset(struct niu *np)
1703 break; 1674 break;
1704 } 1675 }
1705 if (limit < 0) { 1676 if (limit < 0) {
1706 dev_err(np->device, PFX "Port %u MII would not reset, " 1677 netdev_err(np->dev, "Port %u MII would not reset, bmcr[%04x]\n",
1707 "bmcr[%04x]\n", np->port, err); 1678 np->port, err);
1708 return -ENODEV; 1679 return -ENODEV;
1709 } 1680 }
1710 1681
@@ -1899,7 +1870,7 @@ static int mii_init_common(struct niu *np)
1899 return err; 1870 return err;
1900 bmsr = err; 1871 bmsr = err;
1901 1872
1902 pr_info(PFX "Port %u after MII init bmcr[%04x] bmsr[%04x]\n", 1873 pr_info("Port %u after MII init bmcr[%04x] bmsr[%04x]\n",
1903 np->port, bmcr, bmsr); 1874 np->port, bmcr, bmsr);
1904#endif 1875#endif
1905 1876
@@ -1952,16 +1923,12 @@ static int niu_link_status_common(struct niu *np, int link_up)
1952 unsigned long flags; 1923 unsigned long flags;
1953 1924
1954 if (!netif_carrier_ok(dev) && link_up) { 1925 if (!netif_carrier_ok(dev) && link_up) {
1955 niuinfo(LINK, "%s: Link is up at %s, %s duplex\n", 1926 netif_info(np, link, dev, "Link is up at %s, %s duplex\n",
1956 dev->name, 1927 lp->active_speed == SPEED_10000 ? "10Gb/sec" :
1957 (lp->active_speed == SPEED_10000 ? 1928 lp->active_speed == SPEED_1000 ? "1Gb/sec" :
1958 "10Gb/sec" : 1929 lp->active_speed == SPEED_100 ? "100Mbit/sec" :
1959 (lp->active_speed == SPEED_1000 ? 1930 "10Mbit/sec",
1960 "1Gb/sec" : 1931 lp->active_duplex == DUPLEX_FULL ? "full" : "half");
1961 (lp->active_speed == SPEED_100 ?
1962 "100Mbit/sec" : "10Mbit/sec"))),
1963 (lp->active_duplex == DUPLEX_FULL ?
1964 "full" : "half"));
1965 1932
1966 spin_lock_irqsave(&np->lock, flags); 1933 spin_lock_irqsave(&np->lock, flags);
1967 niu_init_xif(np); 1934 niu_init_xif(np);
@@ -1970,7 +1937,7 @@ static int niu_link_status_common(struct niu *np, int link_up)
1970 1937
1971 netif_carrier_on(dev); 1938 netif_carrier_on(dev);
1972 } else if (netif_carrier_ok(dev) && !link_up) { 1939 } else if (netif_carrier_ok(dev) && !link_up) {
1973 niuwarn(LINK, "%s: Link is down\n", dev->name); 1940 netif_warn(np, link, dev, "Link is down\n");
1974 spin_lock_irqsave(&np->lock, flags); 1941 spin_lock_irqsave(&np->lock, flags);
1975 niu_handle_led(np, 0); 1942 niu_handle_led(np, 0);
1976 spin_unlock_irqrestore(&np->lock, flags); 1943 spin_unlock_irqrestore(&np->lock, flags);
@@ -2236,8 +2203,8 @@ static int link_status_10g_hotplug(struct niu *np, int *link_up_p)
2236 } else { 2203 } else {
2237 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; 2204 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT;
2238 *link_up_p = 0; 2205 *link_up_p = 0;
2239 niuwarn(LINK, "%s: Hotplug PHY Removed\n", 2206 netif_warn(np, link, np->dev,
2240 np->dev->name); 2207 "Hotplug PHY Removed\n");
2241 } 2208 }
2242 } 2209 }
2243out: 2210out:
@@ -2535,8 +2502,8 @@ static int serdes_init_10g_serdes(struct niu *np)
2535 np->flags &= ~NIU_FLAGS_10G; 2502 np->flags &= ~NIU_FLAGS_10G;
2536 np->mac_xcvr = MAC_XCVR_PCS; 2503 np->mac_xcvr = MAC_XCVR_PCS;
2537 } else { 2504 } else {
2538 dev_err(np->device, PFX "Port %u 10G/1G SERDES Link Failed \n", 2505 netdev_err(np->dev, "Port %u 10G/1G SERDES Link Failed\n",
2539 np->port); 2506 np->port);
2540 return -ENODEV; 2507 return -ENODEV;
2541 } 2508 }
2542 } 2509 }
@@ -2848,7 +2815,7 @@ static int tcam_wait_bit(struct niu *np, u64 bit)
2848 break; 2815 break;
2849 udelay(1); 2816 udelay(1);
2850 } 2817 }
2851 if (limit < 0) 2818 if (limit <= 0)
2852 return -ENODEV; 2819 return -ENODEV;
2853 2820
2854 return 0; 2821 return 0;
@@ -3238,23 +3205,22 @@ static int fflp_early_init(struct niu *np)
3238 parent = np->parent; 3205 parent = np->parent;
3239 err = 0; 3206 err = 0;
3240 if (!(parent->flags & PARENT_FLGS_CLS_HWINIT)) { 3207 if (!(parent->flags & PARENT_FLGS_CLS_HWINIT)) {
3241 niudbg(PROBE, "fflp_early_init: Initting hw on port %u\n",
3242 np->port);
3243 if (np->parent->plat_type != PLAT_TYPE_NIU) { 3208 if (np->parent->plat_type != PLAT_TYPE_NIU) {
3244 fflp_reset(np); 3209 fflp_reset(np);
3245 fflp_set_timings(np); 3210 fflp_set_timings(np);
3246 err = fflp_disable_all_partitions(np); 3211 err = fflp_disable_all_partitions(np);
3247 if (err) { 3212 if (err) {
3248 niudbg(PROBE, "fflp_disable_all_partitions " 3213 netif_printk(np, probe, KERN_DEBUG, np->dev,
3249 "failed, err=%d\n", err); 3214 "fflp_disable_all_partitions failed, err=%d\n",
3215 err);
3250 goto out; 3216 goto out;
3251 } 3217 }
3252 } 3218 }
3253 3219
3254 err = tcam_early_init(np); 3220 err = tcam_early_init(np);
3255 if (err) { 3221 if (err) {
3256 niudbg(PROBE, "tcam_early_init failed, err=%d\n", 3222 netif_printk(np, probe, KERN_DEBUG, np->dev,
3257 err); 3223 "tcam_early_init failed, err=%d\n", err);
3258 goto out; 3224 goto out;
3259 } 3225 }
3260 fflp_llcsnap_enable(np, 1); 3226 fflp_llcsnap_enable(np, 1);
@@ -3264,22 +3230,22 @@ static int fflp_early_init(struct niu *np)
3264 3230
3265 err = tcam_flush_all(np); 3231 err = tcam_flush_all(np);
3266 if (err) { 3232 if (err) {
3267 niudbg(PROBE, "tcam_flush_all failed, err=%d\n", 3233 netif_printk(np, probe, KERN_DEBUG, np->dev,
3268 err); 3234 "tcam_flush_all failed, err=%d\n", err);
3269 goto out; 3235 goto out;
3270 } 3236 }
3271 if (np->parent->plat_type != PLAT_TYPE_NIU) { 3237 if (np->parent->plat_type != PLAT_TYPE_NIU) {
3272 err = fflp_hash_clear(np); 3238 err = fflp_hash_clear(np);
3273 if (err) { 3239 if (err) {
3274 niudbg(PROBE, "fflp_hash_clear failed, " 3240 netif_printk(np, probe, KERN_DEBUG, np->dev,
3275 "err=%d\n", err); 3241 "fflp_hash_clear failed, err=%d\n",
3242 err);
3276 goto out; 3243 goto out;
3277 } 3244 }
3278 } 3245 }
3279 3246
3280 vlan_tbl_clear(np); 3247 vlan_tbl_clear(np);
3281 3248
3282 niudbg(PROBE, "fflp_early_init: Success\n");
3283 parent->flags |= PARENT_FLGS_CLS_HWINIT; 3249 parent->flags |= PARENT_FLGS_CLS_HWINIT;
3284 } 3250 }
3285out: 3251out:
@@ -3669,8 +3635,8 @@ static void niu_tx_work(struct niu *np, struct tx_ring_info *rp)
3669 3635
3670 cons = rp->cons; 3636 cons = rp->cons;
3671 3637
3672 niudbg(TX_DONE, "%s: niu_tx_work() pkt_cnt[%u] cons[%d]\n", 3638 netif_printk(np, tx_done, KERN_DEBUG, np->dev,
3673 np->dev->name, pkt_cnt, cons); 3639 "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons);
3674 3640
3675 while (pkt_cnt--) 3641 while (pkt_cnt--)
3676 cons = release_tx_packet(np, rp, cons); 3642 cons = release_tx_packet(np, rp, cons);
@@ -3718,11 +3684,12 @@ static inline void niu_sync_rx_discard_stats(struct niu *np,
3718 rp->rx_errors += misc & RXMISC_COUNT; 3684 rp->rx_errors += misc & RXMISC_COUNT;
3719 3685
3720 if (unlikely(misc & RXMISC_OFLOW)) 3686 if (unlikely(misc & RXMISC_OFLOW))
3721 dev_err(np->device, "rx-%d: Counter overflow " 3687 dev_err(np->device, "rx-%d: Counter overflow RXMISC discard\n",
3722 "RXMISC discard\n", rx_channel); 3688 rx_channel);
3723 3689
3724 niudbg(RX_ERR, "%s-rx-%d: MISC drop=%u over=%u\n", 3690 netif_printk(np, rx_err, KERN_DEBUG, np->dev,
3725 np->dev->name, rx_channel, misc, misc-limit); 3691 "rx-%d: MISC drop=%u over=%u\n",
3692 rx_channel, misc, misc-limit);
3726 } 3693 }
3727 3694
3728 /* WRED (Weighted Random Early Discard) by hardware */ 3695 /* WRED (Weighted Random Early Discard) by hardware */
@@ -3732,11 +3699,11 @@ static inline void niu_sync_rx_discard_stats(struct niu *np,
3732 rp->rx_dropped += wred & RED_DIS_CNT_COUNT; 3699 rp->rx_dropped += wred & RED_DIS_CNT_COUNT;
3733 3700
3734 if (unlikely(wred & RED_DIS_CNT_OFLOW)) 3701 if (unlikely(wred & RED_DIS_CNT_OFLOW))
3735 dev_err(np->device, "rx-%d: Counter overflow " 3702 dev_err(np->device, "rx-%d: Counter overflow WRED discard\n", rx_channel);
3736 "WRED discard\n", rx_channel);
3737 3703
3738 niudbg(RX_ERR, "%s-rx-%d: WRED drop=%u over=%u\n", 3704 netif_printk(np, rx_err, KERN_DEBUG, np->dev,
3739 np->dev->name, rx_channel, wred, wred-limit); 3705 "rx-%d: WRED drop=%u over=%u\n",
3706 rx_channel, wred, wred-limit);
3740 } 3707 }
3741} 3708}
3742 3709
@@ -3757,8 +3724,9 @@ static int niu_rx_work(struct napi_struct *napi, struct niu *np,
3757 mbox->rx_dma_ctl_stat = 0; 3724 mbox->rx_dma_ctl_stat = 0;
3758 mbox->rcrstat_a = 0; 3725 mbox->rcrstat_a = 0;
3759 3726
3760 niudbg(RX_STATUS, "%s: niu_rx_work(chan[%d]), stat[%llx] qlen=%d\n", 3727 netif_printk(np, rx_status, KERN_DEBUG, np->dev,
3761 np->dev->name, rp->rx_channel, (unsigned long long) stat, qlen); 3728 "%s(chan[%d]), stat[%llx] qlen=%d\n",
3729 __func__, rp->rx_channel, (unsigned long long)stat, qlen);
3762 3730
3763 rcr_done = work_done = 0; 3731 rcr_done = work_done = 0;
3764 qlen = min(qlen, budget); 3732 qlen = min(qlen, budget);
@@ -3795,8 +3763,8 @@ static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget)
3795 u32 rx_vec = (v0 & 0xffffffff); 3763 u32 rx_vec = (v0 & 0xffffffff);
3796 int i, work_done = 0; 3764 int i, work_done = 0;
3797 3765
3798 niudbg(INTR, "%s: niu_poll_core() v0[%016llx]\n", 3766 netif_printk(np, intr, KERN_DEBUG, np->dev,
3799 np->dev->name, (unsigned long long) v0); 3767 "%s() v0[%016llx]\n", __func__, (unsigned long long)v0);
3800 3768
3801 for (i = 0; i < np->num_tx_rings; i++) { 3769 for (i = 0; i < np->num_tx_rings; i++) {
3802 struct tx_ring_info *rp = &np->tx_rings[i]; 3770 struct tx_ring_info *rp = &np->tx_rings[i];
@@ -3841,39 +3809,38 @@ static int niu_poll(struct napi_struct *napi, int budget)
3841static void niu_log_rxchan_errors(struct niu *np, struct rx_ring_info *rp, 3809static void niu_log_rxchan_errors(struct niu *np, struct rx_ring_info *rp,
3842 u64 stat) 3810 u64 stat)
3843{ 3811{
3844 dev_err(np->device, PFX "%s: RX channel %u errors ( ", 3812 netdev_err(np->dev, "RX channel %u errors ( ", rp->rx_channel);
3845 np->dev->name, rp->rx_channel);
3846 3813
3847 if (stat & RX_DMA_CTL_STAT_RBR_TMOUT) 3814 if (stat & RX_DMA_CTL_STAT_RBR_TMOUT)
3848 printk("RBR_TMOUT "); 3815 pr_cont("RBR_TMOUT ");
3849 if (stat & RX_DMA_CTL_STAT_RSP_CNT_ERR) 3816 if (stat & RX_DMA_CTL_STAT_RSP_CNT_ERR)
3850 printk("RSP_CNT "); 3817 pr_cont("RSP_CNT ");
3851 if (stat & RX_DMA_CTL_STAT_BYTE_EN_BUS) 3818 if (stat & RX_DMA_CTL_STAT_BYTE_EN_BUS)
3852 printk("BYTE_EN_BUS "); 3819 pr_cont("BYTE_EN_BUS ");
3853 if (stat & RX_DMA_CTL_STAT_RSP_DAT_ERR) 3820 if (stat & RX_DMA_CTL_STAT_RSP_DAT_ERR)
3854 printk("RSP_DAT "); 3821 pr_cont("RSP_DAT ");
3855 if (stat & RX_DMA_CTL_STAT_RCR_ACK_ERR) 3822 if (stat & RX_DMA_CTL_STAT_RCR_ACK_ERR)
3856 printk("RCR_ACK "); 3823 pr_cont("RCR_ACK ");
3857 if (stat & RX_DMA_CTL_STAT_RCR_SHA_PAR) 3824 if (stat & RX_DMA_CTL_STAT_RCR_SHA_PAR)
3858 printk("RCR_SHA_PAR "); 3825 pr_cont("RCR_SHA_PAR ");
3859 if (stat & RX_DMA_CTL_STAT_RBR_PRE_PAR) 3826 if (stat & RX_DMA_CTL_STAT_RBR_PRE_PAR)
3860 printk("RBR_PRE_PAR "); 3827 pr_cont("RBR_PRE_PAR ");
3861 if (stat & RX_DMA_CTL_STAT_CONFIG_ERR) 3828 if (stat & RX_DMA_CTL_STAT_CONFIG_ERR)
3862 printk("CONFIG "); 3829 pr_cont("CONFIG ");
3863 if (stat & RX_DMA_CTL_STAT_RCRINCON) 3830 if (stat & RX_DMA_CTL_STAT_RCRINCON)
3864 printk("RCRINCON "); 3831 pr_cont("RCRINCON ");
3865 if (stat & RX_DMA_CTL_STAT_RCRFULL) 3832 if (stat & RX_DMA_CTL_STAT_RCRFULL)
3866 printk("RCRFULL "); 3833 pr_cont("RCRFULL ");
3867 if (stat & RX_DMA_CTL_STAT_RBRFULL) 3834 if (stat & RX_DMA_CTL_STAT_RBRFULL)
3868 printk("RBRFULL "); 3835 pr_cont("RBRFULL ");
3869 if (stat & RX_DMA_CTL_STAT_RBRLOGPAGE) 3836 if (stat & RX_DMA_CTL_STAT_RBRLOGPAGE)
3870 printk("RBRLOGPAGE "); 3837 pr_cont("RBRLOGPAGE ");
3871 if (stat & RX_DMA_CTL_STAT_CFIGLOGPAGE) 3838 if (stat & RX_DMA_CTL_STAT_CFIGLOGPAGE)
3872 printk("CFIGLOGPAGE "); 3839 pr_cont("CFIGLOGPAGE ");
3873 if (stat & RX_DMA_CTL_STAT_DC_FIFO_ERR) 3840 if (stat & RX_DMA_CTL_STAT_DC_FIFO_ERR)
3874 printk("DC_FIDO "); 3841 pr_cont("DC_FIDO ");
3875 3842
3876 printk(")\n"); 3843 pr_cont(")\n");
3877} 3844}
3878 3845
3879static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) 3846static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
@@ -3887,9 +3854,9 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
3887 err = -EINVAL; 3854 err = -EINVAL;
3888 3855
3889 if (err) { 3856 if (err) {
3890 dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n", 3857 netdev_err(np->dev, "RX channel %u error, stat[%llx]\n",
3891 np->dev->name, rp->rx_channel, 3858 rp->rx_channel,
3892 (unsigned long long) stat); 3859 (unsigned long long) stat);
3893 3860
3894 niu_log_rxchan_errors(np, rp, stat); 3861 niu_log_rxchan_errors(np, rp, stat);
3895 } 3862 }
@@ -3903,27 +3870,26 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
3903static void niu_log_txchan_errors(struct niu *np, struct tx_ring_info *rp, 3870static void niu_log_txchan_errors(struct niu *np, struct tx_ring_info *rp,
3904 u64 cs) 3871 u64 cs)
3905{ 3872{
3906 dev_err(np->device, PFX "%s: TX channel %u errors ( ", 3873 netdev_err(np->dev, "TX channel %u errors ( ", rp->tx_channel);
3907 np->dev->name, rp->tx_channel);
3908 3874
3909 if (cs & TX_CS_MBOX_ERR) 3875 if (cs & TX_CS_MBOX_ERR)
3910 printk("MBOX "); 3876 pr_cont("MBOX ");
3911 if (cs & TX_CS_PKT_SIZE_ERR) 3877 if (cs & TX_CS_PKT_SIZE_ERR)
3912 printk("PKT_SIZE "); 3878 pr_cont("PKT_SIZE ");
3913 if (cs & TX_CS_TX_RING_OFLOW) 3879 if (cs & TX_CS_TX_RING_OFLOW)
3914 printk("TX_RING_OFLOW "); 3880 pr_cont("TX_RING_OFLOW ");
3915 if (cs & TX_CS_PREF_BUF_PAR_ERR) 3881 if (cs & TX_CS_PREF_BUF_PAR_ERR)
3916 printk("PREF_BUF_PAR "); 3882 pr_cont("PREF_BUF_PAR ");
3917 if (cs & TX_CS_NACK_PREF) 3883 if (cs & TX_CS_NACK_PREF)
3918 printk("NACK_PREF "); 3884 pr_cont("NACK_PREF ");
3919 if (cs & TX_CS_NACK_PKT_RD) 3885 if (cs & TX_CS_NACK_PKT_RD)
3920 printk("NACK_PKT_RD "); 3886 pr_cont("NACK_PKT_RD ");
3921 if (cs & TX_CS_CONF_PART_ERR) 3887 if (cs & TX_CS_CONF_PART_ERR)
3922 printk("CONF_PART "); 3888 pr_cont("CONF_PART ");
3923 if (cs & TX_CS_PKT_PRT_ERR) 3889 if (cs & TX_CS_PKT_PRT_ERR)
3924 printk("PKT_PTR "); 3890 pr_cont("PKT_PTR ");
3925 3891
3926 printk(")\n"); 3892 pr_cont(")\n");
3927} 3893}
3928 3894
3929static int niu_tx_error(struct niu *np, struct tx_ring_info *rp) 3895static int niu_tx_error(struct niu *np, struct tx_ring_info *rp)
@@ -3934,12 +3900,11 @@ static int niu_tx_error(struct niu *np, struct tx_ring_info *rp)
3934 logh = nr64(TX_RNG_ERR_LOGH(rp->tx_channel)); 3900 logh = nr64(TX_RNG_ERR_LOGH(rp->tx_channel));
3935 logl = nr64(TX_RNG_ERR_LOGL(rp->tx_channel)); 3901 logl = nr64(TX_RNG_ERR_LOGL(rp->tx_channel));
3936 3902
3937 dev_err(np->device, PFX "%s: TX channel %u error, " 3903 netdev_err(np->dev, "TX channel %u error, cs[%llx] logh[%llx] logl[%llx]\n",
3938 "cs[%llx] logh[%llx] logl[%llx]\n", 3904 rp->tx_channel,
3939 np->dev->name, rp->tx_channel, 3905 (unsigned long long)cs,
3940 (unsigned long long) cs, 3906 (unsigned long long)logh,
3941 (unsigned long long) logh, 3907 (unsigned long long)logl);
3942 (unsigned long long) logl);
3943 3908
3944 niu_log_txchan_errors(np, rp, cs); 3909 niu_log_txchan_errors(np, rp, cs);
3945 3910
@@ -3958,9 +3923,8 @@ static int niu_mif_interrupt(struct niu *np)
3958 phy_mdint = 1; 3923 phy_mdint = 1;
3959 } 3924 }
3960 3925
3961 dev_err(np->device, PFX "%s: MIF interrupt, " 3926 netdev_err(np->dev, "MIF interrupt, stat[%llx] phy_mdint(%d)\n",
3962 "stat[%llx] phy_mdint(%d)\n", 3927 (unsigned long long)mif_status, phy_mdint);
3963 np->dev->name, (unsigned long long) mif_status, phy_mdint);
3964 3928
3965 return -ENODEV; 3929 return -ENODEV;
3966} 3930}
@@ -4085,41 +4049,40 @@ static int niu_mac_interrupt(struct niu *np)
4085 4049
4086static void niu_log_device_error(struct niu *np, u64 stat) 4050static void niu_log_device_error(struct niu *np, u64 stat)
4087{ 4051{
4088 dev_err(np->device, PFX "%s: Core device errors ( ", 4052 netdev_err(np->dev, "Core device errors ( ");
4089 np->dev->name);
4090 4053
4091 if (stat & SYS_ERR_MASK_META2) 4054 if (stat & SYS_ERR_MASK_META2)
4092 printk("META2 "); 4055 pr_cont("META2 ");
4093 if (stat & SYS_ERR_MASK_META1) 4056 if (stat & SYS_ERR_MASK_META1)
4094 printk("META1 "); 4057 pr_cont("META1 ");
4095 if (stat & SYS_ERR_MASK_PEU) 4058 if (stat & SYS_ERR_MASK_PEU)
4096 printk("PEU "); 4059 pr_cont("PEU ");
4097 if (stat & SYS_ERR_MASK_TXC) 4060 if (stat & SYS_ERR_MASK_TXC)
4098 printk("TXC "); 4061 pr_cont("TXC ");
4099 if (stat & SYS_ERR_MASK_RDMC) 4062 if (stat & SYS_ERR_MASK_RDMC)
4100 printk("RDMC "); 4063 pr_cont("RDMC ");
4101 if (stat & SYS_ERR_MASK_TDMC) 4064 if (stat & SYS_ERR_MASK_TDMC)
4102 printk("TDMC "); 4065 pr_cont("TDMC ");
4103 if (stat & SYS_ERR_MASK_ZCP) 4066 if (stat & SYS_ERR_MASK_ZCP)
4104 printk("ZCP "); 4067 pr_cont("ZCP ");
4105 if (stat & SYS_ERR_MASK_FFLP) 4068 if (stat & SYS_ERR_MASK_FFLP)
4106 printk("FFLP "); 4069 pr_cont("FFLP ");
4107 if (stat & SYS_ERR_MASK_IPP) 4070 if (stat & SYS_ERR_MASK_IPP)
4108 printk("IPP "); 4071 pr_cont("IPP ");
4109 if (stat & SYS_ERR_MASK_MAC) 4072 if (stat & SYS_ERR_MASK_MAC)
4110 printk("MAC "); 4073 pr_cont("MAC ");
4111 if (stat & SYS_ERR_MASK_SMX) 4074 if (stat & SYS_ERR_MASK_SMX)
4112 printk("SMX "); 4075 pr_cont("SMX ");
4113 4076
4114 printk(")\n"); 4077 pr_cont(")\n");
4115} 4078}
4116 4079
4117static int niu_device_error(struct niu *np) 4080static int niu_device_error(struct niu *np)
4118{ 4081{
4119 u64 stat = nr64(SYS_ERR_STAT); 4082 u64 stat = nr64(SYS_ERR_STAT);
4120 4083
4121 dev_err(np->device, PFX "%s: Core device error, stat[%llx]\n", 4084 netdev_err(np->dev, "Core device error, stat[%llx]\n",
4122 np->dev->name, (unsigned long long) stat); 4085 (unsigned long long)stat);
4123 4086
4124 niu_log_device_error(np, stat); 4087 niu_log_device_error(np, stat);
4125 4088
@@ -4201,8 +4164,8 @@ static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp,
4201 RX_DMA_CTL_STAT_RCRTO); 4164 RX_DMA_CTL_STAT_RCRTO);
4202 nw64(RX_DMA_CTL_STAT(rp->rx_channel), stat_write); 4165 nw64(RX_DMA_CTL_STAT(rp->rx_channel), stat_write);
4203 4166
4204 niudbg(INTR, "%s: rxchan_intr stat[%llx]\n", 4167 netif_printk(np, intr, KERN_DEBUG, np->dev,
4205 np->dev->name, (unsigned long long) stat); 4168 "%s() stat[%llx]\n", __func__, (unsigned long long)stat);
4206} 4169}
4207 4170
4208static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp, 4171static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp,
@@ -4210,8 +4173,8 @@ static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp,
4210{ 4173{
4211 rp->tx_cs = nr64(TX_CS(rp->tx_channel)); 4174 rp->tx_cs = nr64(TX_CS(rp->tx_channel));
4212 4175
4213 niudbg(INTR, "%s: txchan_intr cs[%llx]\n", 4176 netif_printk(np, intr, KERN_DEBUG, np->dev,
4214 np->dev->name, (unsigned long long) rp->tx_cs); 4177 "%s() cs[%llx]\n", __func__, (unsigned long long)rp->tx_cs);
4215} 4178}
4216 4179
4217static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0) 4180static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0)
@@ -4269,8 +4232,8 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id)
4269 u64 v0, v1, v2; 4232 u64 v0, v1, v2;
4270 4233
4271 if (netif_msg_intr(np)) 4234 if (netif_msg_intr(np))
4272 printk(KERN_DEBUG PFX "niu_interrupt() ldg[%p](%d) ", 4235 printk(KERN_DEBUG KBUILD_MODNAME ": " "%s() ldg[%p](%d)",
4273 lp, ldg); 4236 __func__, lp, ldg);
4274 4237
4275 spin_lock_irqsave(&np->lock, flags); 4238 spin_lock_irqsave(&np->lock, flags);
4276 4239
@@ -4279,7 +4242,7 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id)
4279 v2 = nr64(LDSV2(ldg)); 4242 v2 = nr64(LDSV2(ldg));
4280 4243
4281 if (netif_msg_intr(np)) 4244 if (netif_msg_intr(np))
4282 printk("v0[%llx] v1[%llx] v2[%llx]\n", 4245 pr_cont(" v0[%llx] v1[%llx] v2[%llx]\n",
4283 (unsigned long long) v0, 4246 (unsigned long long) v0,
4284 (unsigned long long) v1, 4247 (unsigned long long) v1,
4285 (unsigned long long) v2); 4248 (unsigned long long) v2);
@@ -4404,8 +4367,8 @@ static int niu_alloc_rx_ring_info(struct niu *np,
4404 if (!rp->mbox) 4367 if (!rp->mbox)
4405 return -ENOMEM; 4368 return -ENOMEM;
4406 if ((unsigned long)rp->mbox & (64UL - 1)) { 4369 if ((unsigned long)rp->mbox & (64UL - 1)) {
4407 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4370 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA mailbox %p\n",
4408 "RXDMA mailbox %p\n", np->dev->name, rp->mbox); 4371 rp->mbox);
4409 return -EINVAL; 4372 return -EINVAL;
4410 } 4373 }
4411 4374
@@ -4415,8 +4378,8 @@ static int niu_alloc_rx_ring_info(struct niu *np,
4415 if (!rp->rcr) 4378 if (!rp->rcr)
4416 return -ENOMEM; 4379 return -ENOMEM;
4417 if ((unsigned long)rp->rcr & (64UL - 1)) { 4380 if ((unsigned long)rp->rcr & (64UL - 1)) {
4418 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4381 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA RCR table %p\n",
4419 "RXDMA RCR table %p\n", np->dev->name, rp->rcr); 4382 rp->rcr);
4420 return -EINVAL; 4383 return -EINVAL;
4421 } 4384 }
4422 rp->rcr_table_size = MAX_RCR_RING_SIZE; 4385 rp->rcr_table_size = MAX_RCR_RING_SIZE;
@@ -4428,8 +4391,8 @@ static int niu_alloc_rx_ring_info(struct niu *np,
4428 if (!rp->rbr) 4391 if (!rp->rbr)
4429 return -ENOMEM; 4392 return -ENOMEM;
4430 if ((unsigned long)rp->rbr & (64UL - 1)) { 4393 if ((unsigned long)rp->rbr & (64UL - 1)) {
4431 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4394 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA RBR table %p\n",
4432 "RXDMA RBR table %p\n", np->dev->name, rp->rbr); 4395 rp->rbr);
4433 return -EINVAL; 4396 return -EINVAL;
4434 } 4397 }
4435 rp->rbr_table_size = MAX_RBR_RING_SIZE; 4398 rp->rbr_table_size = MAX_RBR_RING_SIZE;
@@ -4462,8 +4425,8 @@ static int niu_alloc_tx_ring_info(struct niu *np,
4462 if (!rp->mbox) 4425 if (!rp->mbox)
4463 return -ENOMEM; 4426 return -ENOMEM;
4464 if ((unsigned long)rp->mbox & (64UL - 1)) { 4427 if ((unsigned long)rp->mbox & (64UL - 1)) {
4465 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4428 netdev_err(np->dev, "Coherent alloc gives misaligned TXDMA mailbox %p\n",
4466 "TXDMA mailbox %p\n", np->dev->name, rp->mbox); 4429 rp->mbox);
4467 return -EINVAL; 4430 return -EINVAL;
4468 } 4431 }
4469 4432
@@ -4473,8 +4436,8 @@ static int niu_alloc_tx_ring_info(struct niu *np,
4473 if (!rp->descr) 4436 if (!rp->descr)
4474 return -ENOMEM; 4437 return -ENOMEM;
4475 if ((unsigned long)rp->descr & (64UL - 1)) { 4438 if ((unsigned long)rp->descr & (64UL - 1)) {
4476 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4439 netdev_err(np->dev, "Coherent alloc gives misaligned TXDMA descr table %p\n",
4477 "TXDMA descr table %p\n", np->dev->name, rp->descr); 4440 rp->descr);
4478 return -EINVAL; 4441 return -EINVAL;
4479 } 4442 }
4480 4443
@@ -4730,10 +4693,8 @@ static int niu_init_one_tx_channel(struct niu *np, struct tx_ring_info *rp)
4730 4693
4731 if (rp->descr_dma & ~(TX_RNG_CFIG_STADDR_BASE | 4694 if (rp->descr_dma & ~(TX_RNG_CFIG_STADDR_BASE |
4732 TX_RNG_CFIG_STADDR)) { 4695 TX_RNG_CFIG_STADDR)) {
4733 dev_err(np->device, PFX "%s: TX ring channel %d " 4696 netdev_err(np->dev, "TX ring channel %d DMA addr (%llx) is not aligned\n",
4734 "DMA addr (%llx) is not aligned.\n", 4697 channel, (unsigned long long)rp->descr_dma);
4735 np->dev->name, channel,
4736 (unsigned long long) rp->descr_dma);
4737 return -EINVAL; 4698 return -EINVAL;
4738 } 4699 }
4739 4700
@@ -4750,10 +4711,8 @@ static int niu_init_one_tx_channel(struct niu *np, struct tx_ring_info *rp)
4750 4711
4751 if (((rp->mbox_dma >> 32) & ~TXDMA_MBH_MBADDR) || 4712 if (((rp->mbox_dma >> 32) & ~TXDMA_MBH_MBADDR) ||
4752 ((u32)rp->mbox_dma & ~TXDMA_MBL_MBADDR)) { 4713 ((u32)rp->mbox_dma & ~TXDMA_MBL_MBADDR)) {
4753 dev_err(np->device, PFX "%s: TX ring channel %d " 4714 netdev_err(np->dev, "TX ring channel %d MBOX addr (%llx) has invalid bits\n",
4754 "MBOX addr (%llx) is has illegal bits.\n", 4715 channel, (unsigned long long)rp->mbox_dma);
4755 np->dev->name, channel,
4756 (unsigned long long) rp->mbox_dma);
4757 return -EINVAL; 4716 return -EINVAL;
4758 } 4717 }
4759 nw64(TXDMA_MBH(channel), rp->mbox_dma >> 32); 4718 nw64(TXDMA_MBH(channel), rp->mbox_dma >> 32);
@@ -5150,9 +5109,8 @@ static int niu_zcp_read(struct niu *np, int index, u64 *data)
5150 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, 5109 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY,
5151 1000, 100); 5110 1000, 100);
5152 if (err) { 5111 if (err) {
5153 dev_err(np->device, PFX "%s: ZCP read busy won't clear, " 5112 netdev_err(np->dev, "ZCP read busy won't clear, ZCP_RAM_ACC[%llx]\n",
5154 "ZCP_RAM_ACC[%llx]\n", np->dev->name, 5113 (unsigned long long)nr64(ZCP_RAM_ACC));
5155 (unsigned long long) nr64(ZCP_RAM_ACC));
5156 return err; 5114 return err;
5157 } 5115 }
5158 5116
@@ -5164,9 +5122,8 @@ static int niu_zcp_read(struct niu *np, int index, u64 *data)
5164 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, 5122 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY,
5165 1000, 100); 5123 1000, 100);
5166 if (err) { 5124 if (err) {
5167 dev_err(np->device, PFX "%s: ZCP read busy2 won't clear, " 5125 netdev_err(np->dev, "ZCP read busy2 won't clear, ZCP_RAM_ACC[%llx]\n",
5168 "ZCP_RAM_ACC[%llx]\n", np->dev->name, 5126 (unsigned long long)nr64(ZCP_RAM_ACC));
5169 (unsigned long long) nr64(ZCP_RAM_ACC));
5170 return err; 5127 return err;
5171 } 5128 }
5172 5129
@@ -5531,8 +5488,7 @@ static int niu_reset_tx_bmac(struct niu *np)
5531 udelay(100); 5488 udelay(100);
5532 } 5489 }
5533 if (limit < 0) { 5490 if (limit < 0) {
5534 dev_err(np->device, PFX "Port %u TX BMAC would not reset, " 5491 dev_err(np->device, "Port %u TX BMAC would not reset, BTXMAC_SW_RST[%llx]\n",
5535 "BTXMAC_SW_RST[%llx]\n",
5536 np->port, 5492 np->port,
5537 (unsigned long long) nr64_mac(BTXMAC_SW_RST)); 5493 (unsigned long long) nr64_mac(BTXMAC_SW_RST));
5538 return -ENODEV; 5494 return -ENODEV;
@@ -5633,12 +5589,11 @@ static int niu_reset_rx_xmac(struct niu *np)
5633 while (--limit >= 0) { 5589 while (--limit >= 0) {
5634 if (!(nr64_mac(XRXMAC_SW_RST) & (XRXMAC_SW_RST_REG_RS | 5590 if (!(nr64_mac(XRXMAC_SW_RST) & (XRXMAC_SW_RST_REG_RS |
5635 XRXMAC_SW_RST_SOFT_RST))) 5591 XRXMAC_SW_RST_SOFT_RST)))
5636 break; 5592 break;
5637 udelay(100); 5593 udelay(100);
5638 } 5594 }
5639 if (limit < 0) { 5595 if (limit < 0) {
5640 dev_err(np->device, PFX "Port %u RX XMAC would not reset, " 5596 dev_err(np->device, "Port %u RX XMAC would not reset, XRXMAC_SW_RST[%llx]\n",
5641 "XRXMAC_SW_RST[%llx]\n",
5642 np->port, 5597 np->port,
5643 (unsigned long long) nr64_mac(XRXMAC_SW_RST)); 5598 (unsigned long long) nr64_mac(XRXMAC_SW_RST));
5644 return -ENODEV; 5599 return -ENODEV;
@@ -5659,8 +5614,7 @@ static int niu_reset_rx_bmac(struct niu *np)
5659 udelay(100); 5614 udelay(100);
5660 } 5615 }
5661 if (limit < 0) { 5616 if (limit < 0) {
5662 dev_err(np->device, PFX "Port %u RX BMAC would not reset, " 5617 dev_err(np->device, "Port %u RX BMAC would not reset, BRXMAC_SW_RST[%llx]\n",
5663 "BRXMAC_SW_RST[%llx]\n",
5664 np->port, 5618 np->port,
5665 (unsigned long long) nr64_mac(BRXMAC_SW_RST)); 5619 (unsigned long long) nr64_mac(BRXMAC_SW_RST));
5666 return -ENODEV; 5620 return -ENODEV;
@@ -5964,11 +5918,9 @@ static void niu_disable_ipp(struct niu *np)
5964 } 5918 }
5965 if (limit < 0 && 5919 if (limit < 0 &&
5966 (rd != 0 && wr != 1)) { 5920 (rd != 0 && wr != 1)) {
5967 dev_err(np->device, PFX "%s: IPP would not quiesce, " 5921 netdev_err(np->dev, "IPP would not quiesce, rd_ptr[%llx] wr_ptr[%llx]\n",
5968 "rd_ptr[%llx] wr_ptr[%llx]\n", 5922 (unsigned long long)nr64_ipp(IPP_DFIFO_RD_PTR),
5969 np->dev->name, 5923 (unsigned long long)nr64_ipp(IPP_DFIFO_WR_PTR));
5970 (unsigned long long) nr64_ipp(IPP_DFIFO_RD_PTR),
5971 (unsigned long long) nr64_ipp(IPP_DFIFO_WR_PTR));
5972 } 5924 }
5973 5925
5974 val = nr64_ipp(IPP_CFIG); 5926 val = nr64_ipp(IPP_CFIG);
@@ -5985,12 +5937,12 @@ static int niu_init_hw(struct niu *np)
5985{ 5937{
5986 int i, err; 5938 int i, err;
5987 5939
5988 niudbg(IFUP, "%s: Initialize TXC\n", np->dev->name); 5940 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TXC\n");
5989 niu_txc_enable_port(np, 1); 5941 niu_txc_enable_port(np, 1);
5990 niu_txc_port_dma_enable(np, 1); 5942 niu_txc_port_dma_enable(np, 1);
5991 niu_txc_set_imask(np, 0); 5943 niu_txc_set_imask(np, 0);
5992 5944
5993 niudbg(IFUP, "%s: Initialize TX channels\n", np->dev->name); 5945 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TX channels\n");
5994 for (i = 0; i < np->num_tx_rings; i++) { 5946 for (i = 0; i < np->num_tx_rings; i++) {
5995 struct tx_ring_info *rp = &np->tx_rings[i]; 5947 struct tx_ring_info *rp = &np->tx_rings[i];
5996 5948
@@ -5999,27 +5951,27 @@ static int niu_init_hw(struct niu *np)
5999 return err; 5951 return err;
6000 } 5952 }
6001 5953
6002 niudbg(IFUP, "%s: Initialize RX channels\n", np->dev->name); 5954 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize RX channels\n");
6003 err = niu_init_rx_channels(np); 5955 err = niu_init_rx_channels(np);
6004 if (err) 5956 if (err)
6005 goto out_uninit_tx_channels; 5957 goto out_uninit_tx_channels;
6006 5958
6007 niudbg(IFUP, "%s: Initialize classifier\n", np->dev->name); 5959 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize classifier\n");
6008 err = niu_init_classifier_hw(np); 5960 err = niu_init_classifier_hw(np);
6009 if (err) 5961 if (err)
6010 goto out_uninit_rx_channels; 5962 goto out_uninit_rx_channels;
6011 5963
6012 niudbg(IFUP, "%s: Initialize ZCP\n", np->dev->name); 5964 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize ZCP\n");
6013 err = niu_init_zcp(np); 5965 err = niu_init_zcp(np);
6014 if (err) 5966 if (err)
6015 goto out_uninit_rx_channels; 5967 goto out_uninit_rx_channels;
6016 5968
6017 niudbg(IFUP, "%s: Initialize IPP\n", np->dev->name); 5969 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize IPP\n");
6018 err = niu_init_ipp(np); 5970 err = niu_init_ipp(np);
6019 if (err) 5971 if (err)
6020 goto out_uninit_rx_channels; 5972 goto out_uninit_rx_channels;
6021 5973
6022 niudbg(IFUP, "%s: Initialize MAC\n", np->dev->name); 5974 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize MAC\n");
6023 err = niu_init_mac(np); 5975 err = niu_init_mac(np);
6024 if (err) 5976 if (err)
6025 goto out_uninit_ipp; 5977 goto out_uninit_ipp;
@@ -6027,16 +5979,16 @@ static int niu_init_hw(struct niu *np)
6027 return 0; 5979 return 0;
6028 5980
6029out_uninit_ipp: 5981out_uninit_ipp:
6030 niudbg(IFUP, "%s: Uninit IPP\n", np->dev->name); 5982 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit IPP\n");
6031 niu_disable_ipp(np); 5983 niu_disable_ipp(np);
6032 5984
6033out_uninit_rx_channels: 5985out_uninit_rx_channels:
6034 niudbg(IFUP, "%s: Uninit RX channels\n", np->dev->name); 5986 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit RX channels\n");
6035 niu_stop_rx_channels(np); 5987 niu_stop_rx_channels(np);
6036 niu_reset_rx_channels(np); 5988 niu_reset_rx_channels(np);
6037 5989
6038out_uninit_tx_channels: 5990out_uninit_tx_channels:
6039 niudbg(IFUP, "%s: Uninit TX channels\n", np->dev->name); 5991 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit TX channels\n");
6040 niu_stop_tx_channels(np); 5992 niu_stop_tx_channels(np);
6041 niu_reset_tx_channels(np); 5993 niu_reset_tx_channels(np);
6042 5994
@@ -6045,25 +5997,25 @@ out_uninit_tx_channels:
6045 5997
6046static void niu_stop_hw(struct niu *np) 5998static void niu_stop_hw(struct niu *np)
6047{ 5999{
6048 niudbg(IFDOWN, "%s: Disable interrupts\n", np->dev->name); 6000 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable interrupts\n");
6049 niu_enable_interrupts(np, 0); 6001 niu_enable_interrupts(np, 0);
6050 6002
6051 niudbg(IFDOWN, "%s: Disable RX MAC\n", np->dev->name); 6003 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable RX MAC\n");
6052 niu_enable_rx_mac(np, 0); 6004 niu_enable_rx_mac(np, 0);
6053 6005
6054 niudbg(IFDOWN, "%s: Disable IPP\n", np->dev->name); 6006 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable IPP\n");
6055 niu_disable_ipp(np); 6007 niu_disable_ipp(np);
6056 6008
6057 niudbg(IFDOWN, "%s: Stop TX channels\n", np->dev->name); 6009 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop TX channels\n");
6058 niu_stop_tx_channels(np); 6010 niu_stop_tx_channels(np);
6059 6011
6060 niudbg(IFDOWN, "%s: Stop RX channels\n", np->dev->name); 6012 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop RX channels\n");
6061 niu_stop_rx_channels(np); 6013 niu_stop_rx_channels(np);
6062 6014
6063 niudbg(IFDOWN, "%s: Reset TX channels\n", np->dev->name); 6015 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset TX channels\n");
6064 niu_reset_tx_channels(np); 6016 niu_reset_tx_channels(np);
6065 6017
6066 niudbg(IFDOWN, "%s: Reset RX channels\n", np->dev->name); 6018 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset RX channels\n");
6067 niu_reset_rx_channels(np); 6019 niu_reset_rx_channels(np);
6068} 6020}
6069 6021
@@ -6373,10 +6325,10 @@ static void niu_set_rx_mode(struct net_device *dev)
6373 np->flags &= ~(NIU_FLAGS_MCAST | NIU_FLAGS_PROMISC); 6325 np->flags &= ~(NIU_FLAGS_MCAST | NIU_FLAGS_PROMISC);
6374 if (dev->flags & IFF_PROMISC) 6326 if (dev->flags & IFF_PROMISC)
6375 np->flags |= NIU_FLAGS_PROMISC; 6327 np->flags |= NIU_FLAGS_PROMISC;
6376 if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0)) 6328 if ((dev->flags & IFF_ALLMULTI) || (!netdev_mc_empty(dev)))
6377 np->flags |= NIU_FLAGS_MCAST; 6329 np->flags |= NIU_FLAGS_MCAST;
6378 6330
6379 alt_cnt = dev->uc.count; 6331 alt_cnt = netdev_uc_count(dev);
6380 if (alt_cnt > niu_num_alt_addr(np)) { 6332 if (alt_cnt > niu_num_alt_addr(np)) {
6381 alt_cnt = 0; 6333 alt_cnt = 0;
6382 np->flags |= NIU_FLAGS_PROMISC; 6334 np->flags |= NIU_FLAGS_PROMISC;
@@ -6385,17 +6337,15 @@ static void niu_set_rx_mode(struct net_device *dev)
6385 if (alt_cnt) { 6337 if (alt_cnt) {
6386 int index = 0; 6338 int index = 0;
6387 6339
6388 list_for_each_entry(ha, &dev->uc.list, list) { 6340 netdev_for_each_uc_addr(ha, dev) {
6389 err = niu_set_alt_mac(np, index, ha->addr); 6341 err = niu_set_alt_mac(np, index, ha->addr);
6390 if (err) 6342 if (err)
6391 printk(KERN_WARNING PFX "%s: Error %d " 6343 netdev_warn(dev, "Error %d adding alt mac %d\n",
6392 "adding alt mac %d\n", 6344 err, index);
6393 dev->name, err, index);
6394 err = niu_enable_alt_mac(np, index, 1); 6345 err = niu_enable_alt_mac(np, index, 1);
6395 if (err) 6346 if (err)
6396 printk(KERN_WARNING PFX "%s: Error %d " 6347 netdev_warn(dev, "Error %d enabling alt mac %d\n",
6397 "enabling alt mac %d\n", 6348 err, index);
6398 dev->name, err, index);
6399 6349
6400 index++; 6350 index++;
6401 } 6351 }
@@ -6408,16 +6358,15 @@ static void niu_set_rx_mode(struct net_device *dev)
6408 for (i = alt_start; i < niu_num_alt_addr(np); i++) { 6358 for (i = alt_start; i < niu_num_alt_addr(np); i++) {
6409 err = niu_enable_alt_mac(np, i, 0); 6359 err = niu_enable_alt_mac(np, i, 0);
6410 if (err) 6360 if (err)
6411 printk(KERN_WARNING PFX "%s: Error %d " 6361 netdev_warn(dev, "Error %d disabling alt mac %d\n",
6412 "disabling alt mac %d\n", 6362 err, i);
6413 dev->name, err, i);
6414 } 6363 }
6415 } 6364 }
6416 if (dev->flags & IFF_ALLMULTI) { 6365 if (dev->flags & IFF_ALLMULTI) {
6417 for (i = 0; i < 16; i++) 6366 for (i = 0; i < 16; i++)
6418 hash[i] = 0xffff; 6367 hash[i] = 0xffff;
6419 } else if (dev->mc_count > 0) { 6368 } else if (!netdev_mc_empty(dev)) {
6420 for (addr = dev->mc_list; addr; addr = addr->next) { 6369 netdev_for_each_mc_addr(addr, dev) {
6421 u32 crc = ether_crc_le(ETH_ALEN, addr->da_addr); 6370 u32 crc = ether_crc_le(ETH_ALEN, addr->da_addr);
6422 6371
6423 crc >>= 24; 6372 crc >>= 24;
@@ -6574,7 +6523,7 @@ static void niu_tx_timeout(struct net_device *dev)
6574{ 6523{
6575 struct niu *np = netdev_priv(dev); 6524 struct niu *np = netdev_priv(dev);
6576 6525
6577 dev_err(np->device, PFX "%s: Transmit timed out, resetting\n", 6526 dev_err(np->device, "%s: Transmit timed out, resetting\n",
6578 dev->name); 6527 dev->name);
6579 6528
6580 schedule_work(&np->reset_task); 6529 schedule_work(&np->reset_task);
@@ -6676,8 +6625,7 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb,
6676 6625
6677 if (niu_tx_avail(rp) <= (skb_shinfo(skb)->nr_frags + 1)) { 6626 if (niu_tx_avail(rp) <= (skb_shinfo(skb)->nr_frags + 1)) {
6678 netif_tx_stop_queue(txq); 6627 netif_tx_stop_queue(txq);
6679 dev_err(np->device, PFX "%s: BUG! Tx ring full when " 6628 dev_err(np->device, "%s: BUG! Tx ring full when queue awake!\n", dev->name);
6680 "queue awake!\n", dev->name);
6681 rp->tx_errors++; 6629 rp->tx_errors++;
6682 return NETDEV_TX_BUSY; 6630 return NETDEV_TX_BUSY;
6683 } 6631 }
@@ -7241,8 +7189,8 @@ static int niu_get_ethtool_tcam_entry(struct niu *np,
7241 7189
7242 tp = &parent->tcam[idx]; 7190 tp = &parent->tcam[idx];
7243 if (!tp->valid) { 7191 if (!tp->valid) {
7244 pr_info(PFX "niu%d: %s entry [%d] invalid for idx[%d]\n", 7192 netdev_info(np->dev, "niu%d: entry [%d] invalid for idx[%d]\n",
7245 parent->index, np->dev->name, (u16)nfc->fs.location, idx); 7193 parent->index, (u16)nfc->fs.location, idx);
7246 return -EINVAL; 7194 return -EINVAL;
7247 } 7195 }
7248 7196
@@ -7252,8 +7200,8 @@ static int niu_get_ethtool_tcam_entry(struct niu *np,
7252 ret = niu_class_to_ethflow(class, &fsp->flow_type); 7200 ret = niu_class_to_ethflow(class, &fsp->flow_type);
7253 7201
7254 if (ret < 0) { 7202 if (ret < 0) {
7255 pr_info(PFX "niu%d: %s niu_class_to_ethflow failed\n", 7203 netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n",
7256 parent->index, np->dev->name); 7204 parent->index);
7257 ret = -EINVAL; 7205 ret = -EINVAL;
7258 goto out; 7206 goto out;
7259 } 7207 }
@@ -7336,9 +7284,8 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
7336 7284
7337 if (n_entries != cnt) { 7285 if (n_entries != cnt) {
7338 /* print warning, this should not happen */ 7286 /* print warning, this should not happen */
7339 pr_info(PFX "niu%d: %s In niu_get_ethtool_tcam_all, " 7287 netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n",
7340 "n_entries[%d] != cnt[%d]!!!\n\n", 7288 np->parent->index, __func__, n_entries, cnt);
7341 np->parent->index, np->dev->name, n_entries, cnt);
7342 } 7289 }
7343 7290
7344 return 0; 7291 return 0;
@@ -7565,9 +7512,8 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7565 } 7512 }
7566 } 7513 }
7567 if (!add_usr_cls) { 7514 if (!add_usr_cls) {
7568 pr_info(PFX "niu%d: %s niu_add_ethtool_tcam_entry: " 7515 netdev_info(np->dev, "niu%d: %s(): Could not find/insert class for pid %d\n",
7569 "Could not find/insert class for pid %d\n", 7516 parent->index, __func__, uspec->proto);
7570 parent->index, np->dev->name, uspec->proto);
7571 ret = -EINVAL; 7517 ret = -EINVAL;
7572 goto out; 7518 goto out;
7573 } 7519 }
@@ -7600,9 +7546,8 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7600 case AH_V6_FLOW: 7546 case AH_V6_FLOW:
7601 case ESP_V6_FLOW: 7547 case ESP_V6_FLOW:
7602 /* Not yet implemented */ 7548 /* Not yet implemented */
7603 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7549 netdev_info(np->dev, "niu%d: In %s(): flow %d for IPv6 not implemented\n",
7604 "flow %d for IPv6 not implemented\n\n", 7550 parent->index, __func__, fsp->flow_type);
7605 parent->index, np->dev->name, fsp->flow_type);
7606 ret = -EINVAL; 7551 ret = -EINVAL;
7607 goto out; 7552 goto out;
7608 case IP_USER_FLOW: 7553 case IP_USER_FLOW:
@@ -7611,17 +7556,15 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7611 class); 7556 class);
7612 } else { 7557 } else {
7613 /* Not yet implemented */ 7558 /* Not yet implemented */
7614 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7559 netdev_info(np->dev, "niu%d: In %s(): usr flow for IPv6 not implemented\n",
7615 "usr flow for IPv6 not implemented\n\n", 7560 parent->index, __func__);
7616 parent->index, np->dev->name);
7617 ret = -EINVAL; 7561 ret = -EINVAL;
7618 goto out; 7562 goto out;
7619 } 7563 }
7620 break; 7564 break;
7621 default: 7565 default:
7622 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7566 netdev_info(np->dev, "niu%d: In %s(): Unknown flow type %d\n",
7623 "Unknown flow type %d\n\n", 7567 parent->index, __func__, fsp->flow_type);
7624 parent->index, np->dev->name, fsp->flow_type);
7625 ret = -EINVAL; 7568 ret = -EINVAL;
7626 goto out; 7569 goto out;
7627 } 7570 }
@@ -7631,10 +7574,9 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7631 tp->assoc_data = TCAM_ASSOCDATA_DISC; 7574 tp->assoc_data = TCAM_ASSOCDATA_DISC;
7632 } else { 7575 } else {
7633 if (fsp->ring_cookie >= np->num_rx_rings) { 7576 if (fsp->ring_cookie >= np->num_rx_rings) {
7634 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7577 netdev_info(np->dev, "niu%d: In %s(): Invalid RX ring %lld\n",
7635 "Invalid RX ring %lld\n\n", 7578 parent->index, __func__,
7636 parent->index, np->dev->name, 7579 (long long)fsp->ring_cookie);
7637 (long long) fsp->ring_cookie);
7638 ret = -EINVAL; 7580 ret = -EINVAL;
7639 goto out; 7581 goto out;
7640 } 7582 }
@@ -7703,10 +7645,9 @@ static int niu_del_ethtool_tcam_entry(struct niu *np, u32 loc)
7703 } 7645 }
7704 } 7646 }
7705 if (i == NIU_L3_PROG_CLS) { 7647 if (i == NIU_L3_PROG_CLS) {
7706 pr_info(PFX "niu%d: %s In niu_del_ethtool_tcam_entry," 7648 netdev_info(np->dev, "niu%d: In %s(): Usr class 0x%llx not found\n",
7707 "Usr class 0x%llx not found \n", 7649 parent->index, __func__,
7708 parent->index, np->dev->name, 7650 (unsigned long long)class);
7709 (unsigned long long) class);
7710 ret = -EINVAL; 7651 ret = -EINVAL;
7711 goto out; 7652 goto out;
7712 } 7653 }
@@ -7855,10 +7796,13 @@ static void niu_get_strings(struct net_device *dev, u32 stringset, u8 *data)
7855 } 7796 }
7856} 7797}
7857 7798
7858static int niu_get_stats_count(struct net_device *dev) 7799static int niu_get_sset_count(struct net_device *dev, int stringset)
7859{ 7800{
7860 struct niu *np = netdev_priv(dev); 7801 struct niu *np = netdev_priv(dev);
7861 7802
7803 if (stringset != ETH_SS_STATS)
7804 return -EINVAL;
7805
7862 return ((np->flags & NIU_FLAGS_XMAC ? 7806 return ((np->flags & NIU_FLAGS_XMAC ?
7863 NUM_XMAC_STAT_KEYS : 7807 NUM_XMAC_STAT_KEYS :
7864 NUM_BMAC_STAT_KEYS) + 7808 NUM_BMAC_STAT_KEYS) +
@@ -7978,7 +7922,7 @@ static const struct ethtool_ops niu_ethtool_ops = {
7978 .get_settings = niu_get_settings, 7922 .get_settings = niu_get_settings,
7979 .set_settings = niu_set_settings, 7923 .set_settings = niu_set_settings,
7980 .get_strings = niu_get_strings, 7924 .get_strings = niu_get_strings,
7981 .get_stats_count = niu_get_stats_count, 7925 .get_sset_count = niu_get_sset_count,
7982 .get_ethtool_stats = niu_get_ethtool_stats, 7926 .get_ethtool_stats = niu_get_ethtool_stats,
7983 .phys_id = niu_phys_id, 7927 .phys_id = niu_phys_id,
7984 .get_rxnfc = niu_get_nfc, 7928 .get_rxnfc = niu_get_nfc,
@@ -8002,9 +7946,7 @@ static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
8002 * won't get any interrupts and that's painful to debug. 7946 * won't get any interrupts and that's painful to debug.
8003 */ 7947 */
8004 if (nr64(LDG_NUM(ldn)) != ldg) { 7948 if (nr64(LDG_NUM(ldn)) != ldg) {
8005 dev_err(np->device, PFX "Port %u, mis-matched " 7949 dev_err(np->device, "Port %u, mis-matched LDG assignment for ldn %d, should be %d is %llu\n",
8006 "LDG assignment "
8007 "for ldn %d, should be %d is %llu\n",
8008 np->port, ldn, ldg, 7950 np->port, ldn, ldg,
8009 (unsigned long long) nr64(LDG_NUM(ldn))); 7951 (unsigned long long) nr64(LDG_NUM(ldn)));
8010 return -EINVAL; 7952 return -EINVAL;
@@ -8057,7 +7999,7 @@ static int __devinit niu_pci_eeprom_read(struct niu *np, u32 addr)
8057 break; 7999 break;
8058 } while (limit--); 8000 } while (limit--);
8059 if (!(frame & ESPC_PIO_STAT_READ_END)) { 8001 if (!(frame & ESPC_PIO_STAT_READ_END)) {
8060 dev_err(np->device, PFX "EEPROM read timeout frame[%llx]\n", 8002 dev_err(np->device, "EEPROM read timeout frame[%llx]\n",
8061 (unsigned long long) frame); 8003 (unsigned long long) frame);
8062 return -ENODEV; 8004 return -ENODEV;
8063 } 8005 }
@@ -8072,7 +8014,7 @@ static int __devinit niu_pci_eeprom_read(struct niu *np, u32 addr)
8072 break; 8014 break;
8073 } while (limit--); 8015 } while (limit--);
8074 if (!(frame & ESPC_PIO_STAT_READ_END)) { 8016 if (!(frame & ESPC_PIO_STAT_READ_END)) {
8075 dev_err(np->device, PFX "EEPROM read timeout frame[%llx]\n", 8017 dev_err(np->device, "EEPROM read timeout frame[%llx]\n",
8076 (unsigned long long) frame); 8018 (unsigned long long) frame);
8077 return -ENODEV; 8019 return -ENODEV;
8078 } 8020 }
@@ -8144,7 +8086,7 @@ static void __devinit niu_vpd_parse_version(struct niu *np)
8144 int i; 8086 int i;
8145 8087
8146 for (i = 0; i < len - 5; i++) { 8088 for (i = 0; i < len - 5; i++) {
8147 if (!strncmp(s + i, "FCode ", 5)) 8089 if (!strncmp(s + i, "FCode ", 6))
8148 break; 8090 break;
8149 } 8091 }
8150 if (i >= len - 5) 8092 if (i >= len - 5)
@@ -8153,8 +8095,9 @@ static void __devinit niu_vpd_parse_version(struct niu *np)
8153 s += i + 5; 8095 s += i + 5;
8154 sscanf(s, "%d.%d", &vpd->fcode_major, &vpd->fcode_minor); 8096 sscanf(s, "%d.%d", &vpd->fcode_major, &vpd->fcode_minor);
8155 8097
8156 niudbg(PROBE, "VPD_SCAN: FCODE major(%d) minor(%d)\n", 8098 netif_printk(np, probe, KERN_DEBUG, np->dev,
8157 vpd->fcode_major, vpd->fcode_minor); 8099 "VPD_SCAN: FCODE major(%d) minor(%d)\n",
8100 vpd->fcode_major, vpd->fcode_minor);
8158 if (vpd->fcode_major > NIU_VPD_MIN_MAJOR || 8101 if (vpd->fcode_major > NIU_VPD_MIN_MAJOR ||
8159 (vpd->fcode_major == NIU_VPD_MIN_MAJOR && 8102 (vpd->fcode_major == NIU_VPD_MIN_MAJOR &&
8160 vpd->fcode_minor >= NIU_VPD_MIN_MINOR)) 8103 vpd->fcode_minor >= NIU_VPD_MIN_MINOR))
@@ -8174,8 +8117,8 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np,
8174#define FOUND_MASK_PHY 0x00000020 8117#define FOUND_MASK_PHY 0x00000020
8175#define FOUND_MASK_ALL 0x0000003f 8118#define FOUND_MASK_ALL 0x0000003f
8176 8119
8177 niudbg(PROBE, "VPD_SCAN: start[%x] end[%x]\n", 8120 netif_printk(np, probe, KERN_DEBUG, np->dev,
8178 start, end); 8121 "VPD_SCAN: start[%x] end[%x]\n", start, end);
8179 while (start < end) { 8122 while (start < end) {
8180 int len, err, instance, type, prop_len; 8123 int len, err, instance, type, prop_len;
8181 char namebuf[64]; 8124 char namebuf[64];
@@ -8229,8 +8172,7 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np,
8229 } 8172 }
8230 8173
8231 if (max_len && prop_len > max_len) { 8174 if (max_len && prop_len > max_len) {
8232 dev_err(np->device, PFX "Property '%s' length (%d) is " 8175 dev_err(np->device, "Property '%s' length (%d) is too long\n", namebuf, prop_len);
8233 "too long.\n", namebuf, prop_len);
8234 return -EINVAL; 8176 return -EINVAL;
8235 } 8177 }
8236 8178
@@ -8238,8 +8180,9 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np,
8238 u32 off = start + 5 + err; 8180 u32 off = start + 5 + err;
8239 int i; 8181 int i;
8240 8182
8241 niudbg(PROBE, "VPD_SCAN: Reading in property [%s] " 8183 netif_printk(np, probe, KERN_DEBUG, np->dev,
8242 "len[%d]\n", namebuf, prop_len); 8184 "VPD_SCAN: Reading in property [%s] len[%d]\n",
8185 namebuf, prop_len);
8243 for (i = 0; i < prop_len; i++) 8186 for (i = 0; i < prop_len; i++)
8244 *prop_buf++ = niu_pci_eeprom_read(np, off + i); 8187 *prop_buf++ = niu_pci_eeprom_read(np, off + i);
8245 } 8188 }
@@ -8403,8 +8346,7 @@ static void __devinit niu_pci_vpd_validate(struct niu *np)
8403 u8 val8; 8346 u8 val8;
8404 8347
8405 if (!is_valid_ether_addr(&vpd->local_mac[0])) { 8348 if (!is_valid_ether_addr(&vpd->local_mac[0])) {
8406 dev_err(np->device, PFX "VPD MAC invalid, " 8349 dev_err(np->device, "VPD MAC invalid, falling back to SPROM\n");
8407 "falling back to SPROM.\n");
8408 8350
8409 np->flags &= ~NIU_FLAGS_VPD_VALID; 8351 np->flags &= ~NIU_FLAGS_VPD_VALID;
8410 return; 8352 return;
@@ -8421,14 +8363,14 @@ static void __devinit niu_pci_vpd_validate(struct niu *np)
8421 np->flags &= ~NIU_FLAGS_10G; 8363 np->flags &= ~NIU_FLAGS_10G;
8422 } 8364 }
8423 if (np->flags & NIU_FLAGS_10G) 8365 if (np->flags & NIU_FLAGS_10G)
8424 np->mac_xcvr = MAC_XCVR_XPCS; 8366 np->mac_xcvr = MAC_XCVR_XPCS;
8425 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { 8367 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) {
8426 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | 8368 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER |
8427 NIU_FLAGS_HOTPLUG_PHY); 8369 NIU_FLAGS_HOTPLUG_PHY);
8428 } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { 8370 } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) {
8429 dev_err(np->device, PFX "Illegal phy string [%s].\n", 8371 dev_err(np->device, "Illegal phy string [%s]\n",
8430 np->vpd.phy_type); 8372 np->vpd.phy_type);
8431 dev_err(np->device, PFX "Falling back to SPROM.\n"); 8373 dev_err(np->device, "Falling back to SPROM\n");
8432 np->flags &= ~NIU_FLAGS_VPD_VALID; 8374 np->flags &= ~NIU_FLAGS_VPD_VALID;
8433 return; 8375 return;
8434 } 8376 }
@@ -8456,7 +8398,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8456 8398
8457 np->eeprom_len = len; 8399 np->eeprom_len = len;
8458 8400
8459 niudbg(PROBE, "SPROM: Image size %llu\n", (unsigned long long) val); 8401 netif_printk(np, probe, KERN_DEBUG, np->dev,
8402 "SPROM: Image size %llu\n", (unsigned long long)val);
8460 8403
8461 sum = 0; 8404 sum = 0;
8462 for (i = 0; i < len; i++) { 8405 for (i = 0; i < len; i++) {
@@ -8466,10 +8409,10 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8466 sum += (val >> 16) & 0xff; 8409 sum += (val >> 16) & 0xff;
8467 sum += (val >> 24) & 0xff; 8410 sum += (val >> 24) & 0xff;
8468 } 8411 }
8469 niudbg(PROBE, "SPROM: Checksum %x\n", (int)(sum & 0xff)); 8412 netif_printk(np, probe, KERN_DEBUG, np->dev,
8413 "SPROM: Checksum %x\n", (int)(sum & 0xff));
8470 if ((sum & 0xff) != 0xab) { 8414 if ((sum & 0xff) != 0xab) {
8471 dev_err(np->device, PFX "Bad SPROM checksum " 8415 dev_err(np->device, "Bad SPROM checksum (%x, should be 0xab)\n", (int)(sum & 0xff));
8472 "(%x, should be 0xab)\n", (int) (sum & 0xff));
8473 return -EINVAL; 8416 return -EINVAL;
8474 } 8417 }
8475 8418
@@ -8492,11 +8435,12 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8492 ESPC_PHY_TYPE_PORT3_SHIFT; 8435 ESPC_PHY_TYPE_PORT3_SHIFT;
8493 break; 8436 break;
8494 default: 8437 default:
8495 dev_err(np->device, PFX "Bogus port number %u\n", 8438 dev_err(np->device, "Bogus port number %u\n",
8496 np->port); 8439 np->port);
8497 return -EINVAL; 8440 return -EINVAL;
8498 } 8441 }
8499 niudbg(PROBE, "SPROM: PHY type %x\n", val8); 8442 netif_printk(np, probe, KERN_DEBUG, np->dev,
8443 "SPROM: PHY type %x\n", val8);
8500 8444
8501 switch (val8) { 8445 switch (val8) {
8502 case ESPC_PHY_TYPE_1G_COPPER: 8446 case ESPC_PHY_TYPE_1G_COPPER:
@@ -8528,30 +8472,27 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8528 break; 8472 break;
8529 8473
8530 default: 8474 default:
8531 dev_err(np->device, PFX "Bogus SPROM phy type %u\n", val8); 8475 dev_err(np->device, "Bogus SPROM phy type %u\n", val8);
8532 return -EINVAL; 8476 return -EINVAL;
8533 } 8477 }
8534 8478
8535 val = nr64(ESPC_MAC_ADDR0); 8479 val = nr64(ESPC_MAC_ADDR0);
8536 niudbg(PROBE, "SPROM: MAC_ADDR0[%08llx]\n", 8480 netif_printk(np, probe, KERN_DEBUG, np->dev,
8537 (unsigned long long) val); 8481 "SPROM: MAC_ADDR0[%08llx]\n", (unsigned long long)val);
8538 dev->perm_addr[0] = (val >> 0) & 0xff; 8482 dev->perm_addr[0] = (val >> 0) & 0xff;
8539 dev->perm_addr[1] = (val >> 8) & 0xff; 8483 dev->perm_addr[1] = (val >> 8) & 0xff;
8540 dev->perm_addr[2] = (val >> 16) & 0xff; 8484 dev->perm_addr[2] = (val >> 16) & 0xff;
8541 dev->perm_addr[3] = (val >> 24) & 0xff; 8485 dev->perm_addr[3] = (val >> 24) & 0xff;
8542 8486
8543 val = nr64(ESPC_MAC_ADDR1); 8487 val = nr64(ESPC_MAC_ADDR1);
8544 niudbg(PROBE, "SPROM: MAC_ADDR1[%08llx]\n", 8488 netif_printk(np, probe, KERN_DEBUG, np->dev,
8545 (unsigned long long) val); 8489 "SPROM: MAC_ADDR1[%08llx]\n", (unsigned long long)val);
8546 dev->perm_addr[4] = (val >> 0) & 0xff; 8490 dev->perm_addr[4] = (val >> 0) & 0xff;
8547 dev->perm_addr[5] = (val >> 8) & 0xff; 8491 dev->perm_addr[5] = (val >> 8) & 0xff;
8548 8492
8549 if (!is_valid_ether_addr(&dev->perm_addr[0])) { 8493 if (!is_valid_ether_addr(&dev->perm_addr[0])) {
8550 dev_err(np->device, PFX "SPROM MAC address invalid\n"); 8494 dev_err(np->device, "SPROM MAC address invalid [ %pM ]\n",
8551 dev_err(np->device, PFX "[ \n"); 8495 dev->perm_addr);
8552 for (i = 0; i < 6; i++)
8553 printk("%02x ", dev->perm_addr[i]);
8554 printk("]\n");
8555 return -EINVAL; 8496 return -EINVAL;
8556 } 8497 }
8557 8498
@@ -8563,8 +8504,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8563 memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len); 8504 memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len);
8564 8505
8565 val = nr64(ESPC_MOD_STR_LEN); 8506 val = nr64(ESPC_MOD_STR_LEN);
8566 niudbg(PROBE, "SPROM: MOD_STR_LEN[%llu]\n", 8507 netif_printk(np, probe, KERN_DEBUG, np->dev,
8567 (unsigned long long) val); 8508 "SPROM: MOD_STR_LEN[%llu]\n", (unsigned long long)val);
8568 if (val >= 8 * 4) 8509 if (val >= 8 * 4)
8569 return -EINVAL; 8510 return -EINVAL;
8570 8511
@@ -8579,8 +8520,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8579 np->vpd.model[val] = '\0'; 8520 np->vpd.model[val] = '\0';
8580 8521
8581 val = nr64(ESPC_BD_MOD_STR_LEN); 8522 val = nr64(ESPC_BD_MOD_STR_LEN);
8582 niudbg(PROBE, "SPROM: BD_MOD_STR_LEN[%llu]\n", 8523 netif_printk(np, probe, KERN_DEBUG, np->dev,
8583 (unsigned long long) val); 8524 "SPROM: BD_MOD_STR_LEN[%llu]\n", (unsigned long long)val);
8584 if (val >= 4 * 4) 8525 if (val >= 4 * 4)
8585 return -EINVAL; 8526 return -EINVAL;
8586 8527
@@ -8596,8 +8537,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8596 8537
8597 np->vpd.mac_num = 8538 np->vpd.mac_num =
8598 nr64(ESPC_NUM_PORTS_MACS) & ESPC_NUM_PORTS_MACS_VAL; 8539 nr64(ESPC_NUM_PORTS_MACS) & ESPC_NUM_PORTS_MACS_VAL;
8599 niudbg(PROBE, "SPROM: NUM_PORTS_MACS[%d]\n", 8540 netif_printk(np, probe, KERN_DEBUG, np->dev,
8600 np->vpd.mac_num); 8541 "SPROM: NUM_PORTS_MACS[%d]\n", np->vpd.mac_num);
8601 8542
8602 return 0; 8543 return 0;
8603} 8544}
@@ -8630,8 +8571,6 @@ static int __devinit niu_get_and_validate_port(struct niu *np)
8630 } 8571 }
8631 } 8572 }
8632 8573
8633 niudbg(PROBE, "niu_get_and_validate_port: port[%d] num_ports[%d]\n",
8634 np->port, parent->num_ports);
8635 if (np->port >= parent->num_ports) 8574 if (np->port >= parent->num_ports)
8636 return -ENODEV; 8575 return -ENODEV;
8637 8576
@@ -8660,14 +8599,12 @@ static int __devinit phy_record(struct niu_parent *parent,
8660 8599
8661 pr_info("niu%d: Found PHY %08x type %s at phy_port %u\n", 8600 pr_info("niu%d: Found PHY %08x type %s at phy_port %u\n",
8662 parent->index, id, 8601 parent->index, id,
8663 (type == PHY_TYPE_PMA_PMD ? 8602 type == PHY_TYPE_PMA_PMD ? "PMA/PMD" :
8664 "PMA/PMD" : 8603 type == PHY_TYPE_PCS ? "PCS" : "MII",
8665 (type == PHY_TYPE_PCS ?
8666 "PCS" : "MII")),
8667 phy_port); 8604 phy_port);
8668 8605
8669 if (p->cur[type] >= NIU_MAX_PORTS) { 8606 if (p->cur[type] >= NIU_MAX_PORTS) {
8670 printk(KERN_ERR PFX "Too many PHY ports.\n"); 8607 pr_err("Too many PHY ports\n");
8671 return -EINVAL; 8608 return -EINVAL;
8672 } 8609 }
8673 idx = p->cur[type]; 8610 idx = p->cur[type];
@@ -8728,8 +8665,7 @@ static void __devinit niu_n2_divide_channels(struct niu_parent *parent)
8728 parent->rxchan_per_port[i] = (16 / num_ports); 8665 parent->rxchan_per_port[i] = (16 / num_ports);
8729 parent->txchan_per_port[i] = (16 / num_ports); 8666 parent->txchan_per_port[i] = (16 / num_ports);
8730 8667
8731 pr_info(PFX "niu%d: Port %u [%u RX chans] " 8668 pr_info("niu%d: Port %u [%u RX chans] [%u TX chans]\n",
8732 "[%u TX chans]\n",
8733 parent->index, i, 8669 parent->index, i,
8734 parent->rxchan_per_port[i], 8670 parent->rxchan_per_port[i],
8735 parent->txchan_per_port[i]); 8671 parent->txchan_per_port[i]);
@@ -8772,8 +8708,7 @@ static void __devinit niu_divide_channels(struct niu_parent *parent,
8772 parent->rxchan_per_port[i] = rx_chans_per_1g; 8708 parent->rxchan_per_port[i] = rx_chans_per_1g;
8773 parent->txchan_per_port[i] = tx_chans_per_1g; 8709 parent->txchan_per_port[i] = tx_chans_per_1g;
8774 } 8710 }
8775 pr_info(PFX "niu%d: Port %u [%u RX chans] " 8711 pr_info("niu%d: Port %u [%u RX chans] [%u TX chans]\n",
8776 "[%u TX chans]\n",
8777 parent->index, i, 8712 parent->index, i,
8778 parent->rxchan_per_port[i], 8713 parent->rxchan_per_port[i],
8779 parent->txchan_per_port[i]); 8714 parent->txchan_per_port[i]);
@@ -8782,23 +8717,20 @@ static void __devinit niu_divide_channels(struct niu_parent *parent,
8782 } 8717 }
8783 8718
8784 if (tot_rx > NIU_NUM_RXCHAN) { 8719 if (tot_rx > NIU_NUM_RXCHAN) {
8785 printk(KERN_ERR PFX "niu%d: Too many RX channels (%d), " 8720 pr_err("niu%d: Too many RX channels (%d), resetting to one per port\n",
8786 "resetting to one per port.\n",
8787 parent->index, tot_rx); 8721 parent->index, tot_rx);
8788 for (i = 0; i < num_ports; i++) 8722 for (i = 0; i < num_ports; i++)
8789 parent->rxchan_per_port[i] = 1; 8723 parent->rxchan_per_port[i] = 1;
8790 } 8724 }
8791 if (tot_tx > NIU_NUM_TXCHAN) { 8725 if (tot_tx > NIU_NUM_TXCHAN) {
8792 printk(KERN_ERR PFX "niu%d: Too many TX channels (%d), " 8726 pr_err("niu%d: Too many TX channels (%d), resetting to one per port\n",
8793 "resetting to one per port.\n",
8794 parent->index, tot_tx); 8727 parent->index, tot_tx);
8795 for (i = 0; i < num_ports; i++) 8728 for (i = 0; i < num_ports; i++)
8796 parent->txchan_per_port[i] = 1; 8729 parent->txchan_per_port[i] = 1;
8797 } 8730 }
8798 if (tot_rx < NIU_NUM_RXCHAN || tot_tx < NIU_NUM_TXCHAN) { 8731 if (tot_rx < NIU_NUM_RXCHAN || tot_tx < NIU_NUM_TXCHAN) {
8799 printk(KERN_WARNING PFX "niu%d: Driver bug, wasted channels, " 8732 pr_warning("niu%d: Driver bug, wasted channels, RX[%d] TX[%d]\n",
8800 "RX[%d] TX[%d]\n", 8733 parent->index, tot_rx, tot_tx);
8801 parent->index, tot_rx, tot_tx);
8802 } 8734 }
8803} 8735}
8804 8736
@@ -8826,18 +8758,18 @@ static void __devinit niu_divide_rdc_groups(struct niu_parent *parent,
8826 struct rdc_table *rt = &tp->tables[grp]; 8758 struct rdc_table *rt = &tp->tables[grp];
8827 int slot; 8759 int slot;
8828 8760
8829 pr_info(PFX "niu%d: Port %d RDC tbl(%d) [ ", 8761 pr_info("niu%d: Port %d RDC tbl(%d) [ ",
8830 parent->index, i, tp->first_table_num + grp); 8762 parent->index, i, tp->first_table_num + grp);
8831 for (slot = 0; slot < NIU_RDC_TABLE_SLOTS; slot++) { 8763 for (slot = 0; slot < NIU_RDC_TABLE_SLOTS; slot++) {
8832 rt->rxdma_channel[slot] = 8764 rt->rxdma_channel[slot] =
8833 rdc_channel_base + this_channel_offset; 8765 rdc_channel_base + this_channel_offset;
8834 8766
8835 printk("%d ", rt->rxdma_channel[slot]); 8767 pr_cont("%d ", rt->rxdma_channel[slot]);
8836 8768
8837 if (++this_channel_offset == num_channels) 8769 if (++this_channel_offset == num_channels)
8838 this_channel_offset = 0; 8770 this_channel_offset = 0;
8839 } 8771 }
8840 printk("]\n"); 8772 pr_cont("]\n");
8841 } 8773 }
8842 8774
8843 parent->rdc_default[i] = rdc_channel_base; 8775 parent->rdc_default[i] = rdc_channel_base;
@@ -8997,8 +8929,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
8997 break; 8929 break;
8998 8930
8999 default: 8931 default:
9000 printk(KERN_ERR PFX "Unsupported port config " 8932 pr_err("Unsupported port config 10G[%d] 1G[%d]\n",
9001 "10G[%d] 1G[%d]\n",
9002 num_10g, num_1g); 8933 num_10g, num_1g);
9003 return -EINVAL; 8934 return -EINVAL;
9004 } 8935 }
@@ -9016,8 +8947,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
9016 return 0; 8947 return 0;
9017 8948
9018unknown_vg_1g_port: 8949unknown_vg_1g_port:
9019 printk(KERN_ERR PFX "Cannot identify platform type, 1gport=%d\n", 8950 pr_err("Cannot identify platform type, 1gport=%d\n", lowest_1g);
9020 lowest_1g);
9021 return -EINVAL; 8951 return -EINVAL;
9022} 8952}
9023 8953
@@ -9026,9 +8956,6 @@ static int __devinit niu_probe_ports(struct niu *np)
9026 struct niu_parent *parent = np->parent; 8956 struct niu_parent *parent = np->parent;
9027 int err, i; 8957 int err, i;
9028 8958
9029 niudbg(PROBE, "niu_probe_ports(): port_phy[%08x]\n",
9030 parent->port_phy);
9031
9032 if (parent->port_phy == PORT_PHY_UNKNOWN) { 8959 if (parent->port_phy == PORT_PHY_UNKNOWN) {
9033 err = walk_phys(np, parent); 8960 err = walk_phys(np, parent);
9034 if (err) 8961 if (err)
@@ -9049,9 +8976,6 @@ static int __devinit niu_classifier_swstate_init(struct niu *np)
9049{ 8976{
9050 struct niu_classifier *cp = &np->clas; 8977 struct niu_classifier *cp = &np->clas;
9051 8978
9052 niudbg(PROBE, "niu_classifier_swstate_init: num_tcam(%d)\n",
9053 np->parent->tcam_num_entries);
9054
9055 cp->tcam_top = (u16) np->port; 8979 cp->tcam_top = (u16) np->port;
9056 cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports; 8980 cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports;
9057 cp->h1_init = 0xffffffff; 8981 cp->h1_init = 0xffffffff;
@@ -9117,8 +9041,7 @@ static int __devinit niu_init_mac_ipp_pcs_base(struct niu *np)
9117 break; 9041 break;
9118 9042
9119 default: 9043 default:
9120 dev_err(np->device, PFX "Port %u is invalid, cannot " 9044 dev_err(np->device, "Port %u is invalid, cannot compute MAC block offset\n", np->port);
9121 "compute MAC block offset.\n", np->port);
9122 return -EINVAL; 9045 return -EINVAL;
9123 } 9046 }
9124 9047
@@ -9328,9 +9251,8 @@ static int __devinit niu_get_of_props(struct niu *np)
9328 9251
9329 phy_type = of_get_property(dp, "phy-type", &prop_len); 9252 phy_type = of_get_property(dp, "phy-type", &prop_len);
9330 if (!phy_type) { 9253 if (!phy_type) {
9331 dev_err(np->device, PFX "%s: OF node lacks " 9254 netdev_err(dev, "%s: OF node lacks phy-type property\n",
9332 "phy-type property\n", 9255 dp->full_name);
9333 dp->full_name);
9334 return -EINVAL; 9256 return -EINVAL;
9335 } 9257 }
9336 9258
@@ -9340,34 +9262,26 @@ static int __devinit niu_get_of_props(struct niu *np)
9340 strcpy(np->vpd.phy_type, phy_type); 9262 strcpy(np->vpd.phy_type, phy_type);
9341 9263
9342 if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { 9264 if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) {
9343 dev_err(np->device, PFX "%s: Illegal phy string [%s].\n", 9265 netdev_err(dev, "%s: Illegal phy string [%s]\n",
9344 dp->full_name, np->vpd.phy_type); 9266 dp->full_name, np->vpd.phy_type);
9345 return -EINVAL; 9267 return -EINVAL;
9346 } 9268 }
9347 9269
9348 mac_addr = of_get_property(dp, "local-mac-address", &prop_len); 9270 mac_addr = of_get_property(dp, "local-mac-address", &prop_len);
9349 if (!mac_addr) { 9271 if (!mac_addr) {
9350 dev_err(np->device, PFX "%s: OF node lacks " 9272 netdev_err(dev, "%s: OF node lacks local-mac-address property\n",
9351 "local-mac-address property\n", 9273 dp->full_name);
9352 dp->full_name);
9353 return -EINVAL; 9274 return -EINVAL;
9354 } 9275 }
9355 if (prop_len != dev->addr_len) { 9276 if (prop_len != dev->addr_len) {
9356 dev_err(np->device, PFX "%s: OF MAC address prop len (%d) " 9277 netdev_err(dev, "%s: OF MAC address prop len (%d) is wrong\n",
9357 "is wrong.\n", 9278 dp->full_name, prop_len);
9358 dp->full_name, prop_len);
9359 } 9279 }
9360 memcpy(dev->perm_addr, mac_addr, dev->addr_len); 9280 memcpy(dev->perm_addr, mac_addr, dev->addr_len);
9361 if (!is_valid_ether_addr(&dev->perm_addr[0])) { 9281 if (!is_valid_ether_addr(&dev->perm_addr[0])) {
9362 int i; 9282 netdev_err(dev, "%s: OF MAC address is invalid\n",
9363 9283 dp->full_name);
9364 dev_err(np->device, PFX "%s: OF MAC address is invalid\n", 9284 netdev_err(dev, "%s: [ %pM ]\n", dp->full_name, dev->perm_addr);
9365 dp->full_name);
9366 dev_err(np->device, PFX "%s: [ \n",
9367 dp->full_name);
9368 for (i = 0; i < 6; i++)
9369 printk("%02x ", dev->perm_addr[i]);
9370 printk("]\n");
9371 return -EINVAL; 9285 return -EINVAL;
9372 } 9286 }
9373 9287
@@ -9415,8 +9329,8 @@ static int __devinit niu_get_invariants(struct niu *np)
9415 9329
9416 nw64(ESPC_PIO_EN, ESPC_PIO_EN_ENABLE); 9330 nw64(ESPC_PIO_EN, ESPC_PIO_EN_ENABLE);
9417 offset = niu_pci_vpd_offset(np); 9331 offset = niu_pci_vpd_offset(np);
9418 niudbg(PROBE, "niu_get_invariants: VPD offset [%08x]\n", 9332 netif_printk(np, probe, KERN_DEBUG, np->dev,
9419 offset); 9333 "%s() VPD offset [%08x]\n", __func__, offset);
9420 if (offset) 9334 if (offset)
9421 niu_pci_vpd_fetch(np, offset); 9335 niu_pci_vpd_fetch(np, offset);
9422 nw64(ESPC_PIO_EN, 0); 9336 nw64(ESPC_PIO_EN, 0);
@@ -9576,8 +9490,6 @@ static struct niu_parent * __devinit niu_new_parent(struct niu *np,
9576 struct niu_parent *p; 9490 struct niu_parent *p;
9577 int i; 9491 int i;
9578 9492
9579 niudbg(PROBE, "niu_new_parent: Creating new parent.\n");
9580
9581 plat_dev = platform_device_register_simple("niu", niu_parent_index, 9493 plat_dev = platform_device_register_simple("niu", niu_parent_index,
9582 NULL, 0); 9494 NULL, 0);
9583 if (IS_ERR(plat_dev)) 9495 if (IS_ERR(plat_dev))
@@ -9642,9 +9554,6 @@ static struct niu_parent * __devinit niu_get_parent(struct niu *np,
9642 struct niu_parent *p, *tmp; 9554 struct niu_parent *p, *tmp;
9643 int port = np->port; 9555 int port = np->port;
9644 9556
9645 niudbg(PROBE, "niu_get_parent: platform_type[%u] port[%u]\n",
9646 ptype, port);
9647
9648 mutex_lock(&niu_parent_lock); 9557 mutex_lock(&niu_parent_lock);
9649 p = NULL; 9558 p = NULL;
9650 list_for_each_entry(tmp, &niu_parent_list, list) { 9559 list_for_each_entry(tmp, &niu_parent_list, list) {
@@ -9682,7 +9591,8 @@ static void niu_put_parent(struct niu *np)
9682 9591
9683 BUG_ON(!p || p->ports[port] != np); 9592 BUG_ON(!p || p->ports[port] != np);
9684 9593
9685 niudbg(PROBE, "niu_put_parent: port[%u]\n", port); 9594 netif_printk(np, probe, KERN_DEBUG, np->dev,
9595 "%s() port[%u]\n", __func__, port);
9686 9596
9687 sprintf(port_name, "port%d", port); 9597 sprintf(port_name, "port%d", port);
9688 9598
@@ -9773,7 +9683,7 @@ static struct net_device * __devinit niu_alloc_and_init(
9773 9683
9774 dev = alloc_etherdev_mq(sizeof(struct niu), NIU_NUM_TXCHAN); 9684 dev = alloc_etherdev_mq(sizeof(struct niu), NIU_NUM_TXCHAN);
9775 if (!dev) { 9685 if (!dev) {
9776 dev_err(gen_dev, PFX "Etherdev alloc failed, aborting.\n"); 9686 dev_err(gen_dev, "Etherdev alloc failed, aborting\n");
9777 return NULL; 9687 return NULL;
9778 } 9688 }
9779 9689
@@ -9859,30 +9769,26 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9859 9769
9860 err = pci_enable_device(pdev); 9770 err = pci_enable_device(pdev);
9861 if (err) { 9771 if (err) {
9862 dev_err(&pdev->dev, PFX "Cannot enable PCI device, " 9772 dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n");
9863 "aborting.\n");
9864 return err; 9773 return err;
9865 } 9774 }
9866 9775
9867 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) || 9776 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
9868 !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { 9777 !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
9869 dev_err(&pdev->dev, PFX "Cannot find proper PCI device " 9778 dev_err(&pdev->dev, "Cannot find proper PCI device base addresses, aborting\n");
9870 "base addresses, aborting.\n");
9871 err = -ENODEV; 9779 err = -ENODEV;
9872 goto err_out_disable_pdev; 9780 goto err_out_disable_pdev;
9873 } 9781 }
9874 9782
9875 err = pci_request_regions(pdev, DRV_MODULE_NAME); 9783 err = pci_request_regions(pdev, DRV_MODULE_NAME);
9876 if (err) { 9784 if (err) {
9877 dev_err(&pdev->dev, PFX "Cannot obtain PCI resources, " 9785 dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
9878 "aborting.\n");
9879 goto err_out_disable_pdev; 9786 goto err_out_disable_pdev;
9880 } 9787 }
9881 9788
9882 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); 9789 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
9883 if (pos <= 0) { 9790 if (pos <= 0) {
9884 dev_err(&pdev->dev, PFX "Cannot find PCI Express capability, " 9791 dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n");
9885 "aborting.\n");
9886 goto err_out_free_res; 9792 goto err_out_free_res;
9887 } 9793 }
9888 9794
@@ -9915,23 +9821,20 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9915 PCI_EXP_DEVCTL_RELAX_EN); 9821 PCI_EXP_DEVCTL_RELAX_EN);
9916 pci_write_config_word(pdev, pos + PCI_EXP_DEVCTL, val16); 9822 pci_write_config_word(pdev, pos + PCI_EXP_DEVCTL, val16);
9917 9823
9918 dma_mask = DMA_44BIT_MASK; 9824 dma_mask = DMA_BIT_MASK(44);
9919 err = pci_set_dma_mask(pdev, dma_mask); 9825 err = pci_set_dma_mask(pdev, dma_mask);
9920 if (!err) { 9826 if (!err) {
9921 dev->features |= NETIF_F_HIGHDMA; 9827 dev->features |= NETIF_F_HIGHDMA;
9922 err = pci_set_consistent_dma_mask(pdev, dma_mask); 9828 err = pci_set_consistent_dma_mask(pdev, dma_mask);
9923 if (err) { 9829 if (err) {
9924 dev_err(&pdev->dev, PFX "Unable to obtain 44 bit " 9830 dev_err(&pdev->dev, "Unable to obtain 44 bit DMA for consistent allocations, aborting\n");
9925 "DMA for consistent allocations, "
9926 "aborting.\n");
9927 goto err_out_release_parent; 9831 goto err_out_release_parent;
9928 } 9832 }
9929 } 9833 }
9930 if (err || dma_mask == DMA_BIT_MASK(32)) { 9834 if (err || dma_mask == DMA_BIT_MASK(32)) {
9931 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 9835 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
9932 if (err) { 9836 if (err) {
9933 dev_err(&pdev->dev, PFX "No usable DMA configuration, " 9837 dev_err(&pdev->dev, "No usable DMA configuration, aborting\n");
9934 "aborting.\n");
9935 goto err_out_release_parent; 9838 goto err_out_release_parent;
9936 } 9839 }
9937 } 9840 }
@@ -9940,8 +9843,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9940 9843
9941 np->regs = pci_ioremap_bar(pdev, 0); 9844 np->regs = pci_ioremap_bar(pdev, 0);
9942 if (!np->regs) { 9845 if (!np->regs) {
9943 dev_err(&pdev->dev, PFX "Cannot map device registers, " 9846 dev_err(&pdev->dev, "Cannot map device registers, aborting\n");
9944 "aborting.\n");
9945 err = -ENOMEM; 9847 err = -ENOMEM;
9946 goto err_out_release_parent; 9848 goto err_out_release_parent;
9947 } 9849 }
@@ -9956,15 +9858,13 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9956 err = niu_get_invariants(np); 9858 err = niu_get_invariants(np);
9957 if (err) { 9859 if (err) {
9958 if (err != -ENODEV) 9860 if (err != -ENODEV)
9959 dev_err(&pdev->dev, PFX "Problem fetching invariants " 9861 dev_err(&pdev->dev, "Problem fetching invariants of chip, aborting\n");
9960 "of chip, aborting.\n");
9961 goto err_out_iounmap; 9862 goto err_out_iounmap;
9962 } 9863 }
9963 9864
9964 err = register_netdev(dev); 9865 err = register_netdev(dev);
9965 if (err) { 9866 if (err) {
9966 dev_err(&pdev->dev, PFX "Cannot register net device, " 9867 dev_err(&pdev->dev, "Cannot register net device, aborting\n");
9967 "aborting.\n");
9968 goto err_out_iounmap; 9868 goto err_out_iounmap;
9969 } 9869 }
9970 9870
@@ -10158,7 +10058,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10158 10058
10159 reg = of_get_property(op->node, "reg", NULL); 10059 reg = of_get_property(op->node, "reg", NULL);
10160 if (!reg) { 10060 if (!reg) {
10161 dev_err(&op->dev, PFX "%s: No 'reg' property, aborting.\n", 10061 dev_err(&op->dev, "%s: No 'reg' property, aborting\n",
10162 op->node->full_name); 10062 op->node->full_name);
10163 return -ENODEV; 10063 return -ENODEV;
10164 } 10064 }
@@ -10187,8 +10087,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10187 resource_size(&op->resource[1]), 10087 resource_size(&op->resource[1]),
10188 "niu regs"); 10088 "niu regs");
10189 if (!np->regs) { 10089 if (!np->regs) {
10190 dev_err(&op->dev, PFX "Cannot map device registers, " 10090 dev_err(&op->dev, "Cannot map device registers, aborting\n");
10191 "aborting.\n");
10192 err = -ENOMEM; 10091 err = -ENOMEM;
10193 goto err_out_release_parent; 10092 goto err_out_release_parent;
10194 } 10093 }
@@ -10197,8 +10096,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10197 resource_size(&op->resource[2]), 10096 resource_size(&op->resource[2]),
10198 "niu vregs-1"); 10097 "niu vregs-1");
10199 if (!np->vir_regs_1) { 10098 if (!np->vir_regs_1) {
10200 dev_err(&op->dev, PFX "Cannot map device vir registers 1, " 10099 dev_err(&op->dev, "Cannot map device vir registers 1, aborting\n");
10201 "aborting.\n");
10202 err = -ENOMEM; 10100 err = -ENOMEM;
10203 goto err_out_iounmap; 10101 goto err_out_iounmap;
10204 } 10102 }
@@ -10207,8 +10105,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10207 resource_size(&op->resource[3]), 10105 resource_size(&op->resource[3]),
10208 "niu vregs-2"); 10106 "niu vregs-2");
10209 if (!np->vir_regs_2) { 10107 if (!np->vir_regs_2) {
10210 dev_err(&op->dev, PFX "Cannot map device vir registers 2, " 10108 dev_err(&op->dev, "Cannot map device vir registers 2, aborting\n");
10211 "aborting.\n");
10212 err = -ENOMEM; 10109 err = -ENOMEM;
10213 goto err_out_iounmap; 10110 goto err_out_iounmap;
10214 } 10111 }
@@ -10218,15 +10115,13 @@ static int __devinit niu_of_probe(struct of_device *op,
10218 err = niu_get_invariants(np); 10115 err = niu_get_invariants(np);
10219 if (err) { 10116 if (err) {
10220 if (err != -ENODEV) 10117 if (err != -ENODEV)
10221 dev_err(&op->dev, PFX "Problem fetching invariants " 10118 dev_err(&op->dev, "Problem fetching invariants of chip, aborting\n");
10222 "of chip, aborting.\n");
10223 goto err_out_iounmap; 10119 goto err_out_iounmap;
10224 } 10120 }
10225 10121
10226 err = register_netdev(dev); 10122 err = register_netdev(dev);
10227 if (err) { 10123 if (err) {
10228 dev_err(&op->dev, PFX "Cannot register net device, " 10124 dev_err(&op->dev, "Cannot register net device, aborting\n");
10229 "aborting.\n");
10230 goto err_out_iounmap; 10125 goto err_out_iounmap;
10231 } 10126 }
10232 10127