aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/niu.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-15 01:40:39 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-15 01:40:39 -0500
commitf10a1f2e7e93a35cb603b63090ff0e70a576a641 (patch)
tree8129803053ffd64aa367b284555740fbfb61947a /drivers/net/niu.c
parenta1467085dcad8214bbb1d7edafbaa295cbd8c0e7 (diff)
niu: Use pr_<level>, netdev_<level> and netif_<level> macros
Remove #define PFX Add pr_fmt(fmt) KBUILD_MODNAME ": " fmt Convert printks to pr_<level> Convert printks without levels to pr_cont Convert pr_<level> with np->dev to netdev_<level> Convert dev_<level> to netdev_<level> Convert niudbg to netif_printk Convert niuinfo, niuwarn macros to netif_<level>(priv, type, dev... Coalesce long formats Convert embedded function names to "%s", __func__ Always use "%s()..." when __func__ is printed Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r--drivers/net/niu.c703
1 files changed, 311 insertions, 392 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 7b52d9762b00..347788f11c74 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>
@@ -33,7 +35,6 @@
33#include "niu.h" 35#include "niu.h"
34 36
35#define DRV_MODULE_NAME "niu" 37#define DRV_MODULE_NAME "niu"
36#define PFX DRV_MODULE_NAME ": "
37#define DRV_MODULE_VERSION "1.0" 38#define DRV_MODULE_VERSION "1.0"
38#define DRV_MODULE_RELDATE "Nov 14, 2008" 39#define DRV_MODULE_RELDATE "Nov 14, 2008"
39 40
@@ -89,21 +90,6 @@ static int debug = -1;
89module_param(debug, int, 0); 90module_param(debug, int, 0);
90MODULE_PARM_DESC(debug, "NIU debug level"); 91MODULE_PARM_DESC(debug, "NIU debug level");
91 92
92#define niudbg(TYPE, f, a...) \
93do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \
94 printk(KERN_DEBUG PFX f, ## a); \
95} while (0)
96
97#define niuinfo(TYPE, f, a...) \
98do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \
99 printk(KERN_INFO PFX f, ## a); \
100} while (0)
101
102#define niuwarn(TYPE, f, a...) \
103do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \
104 printk(KERN_WARNING PFX f, ## a); \
105} while (0)
106
107#define niu_lock_parent(np, flags) \ 93#define niu_lock_parent(np, flags) \
108 spin_lock_irqsave(&np->parent->lock, flags) 94 spin_lock_irqsave(&np->parent->lock, flags)
109#define niu_unlock_parent(np, flags) \ 95#define niu_unlock_parent(np, flags) \
@@ -135,10 +121,9 @@ static int __niu_set_and_wait_clear_mac(struct niu *np, unsigned long reg,
135 nw64_mac(reg, bits); 121 nw64_mac(reg, bits);
136 err = __niu_wait_bits_clear_mac(np, reg, bits, limit, delay); 122 err = __niu_wait_bits_clear_mac(np, reg, bits, limit, delay);
137 if (err) 123 if (err)
138 dev_err(np->device, PFX "%s: bits (%llx) of register %s " 124 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n",
139 "would not clear, val[%llx]\n", 125 (unsigned long long)bits, reg_name,
140 np->dev->name, (unsigned long long) bits, reg_name, 126 (unsigned long long)nr64_mac(reg));
141 (unsigned long long) nr64_mac(reg));
142 return err; 127 return err;
143} 128}
144 129
@@ -175,10 +160,9 @@ static int __niu_set_and_wait_clear_ipp(struct niu *np, unsigned long reg,
175 160
176 err = __niu_wait_bits_clear_ipp(np, reg, bits, limit, delay); 161 err = __niu_wait_bits_clear_ipp(np, reg, bits, limit, delay);
177 if (err) 162 if (err)
178 dev_err(np->device, PFX "%s: bits (%llx) of register %s " 163 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n",
179 "would not clear, val[%llx]\n", 164 (unsigned long long)bits, reg_name,
180 np->dev->name, (unsigned long long) bits, reg_name, 165 (unsigned long long)nr64_ipp(reg));
181 (unsigned long long) nr64_ipp(reg));
182 return err; 166 return err;
183} 167}
184 168
@@ -216,10 +200,9 @@ static int __niu_set_and_wait_clear(struct niu *np, unsigned long reg,
216 nw64(reg, bits); 200 nw64(reg, bits);
217 err = __niu_wait_bits_clear(np, reg, bits, limit, delay); 201 err = __niu_wait_bits_clear(np, reg, bits, limit, delay);
218 if (err) 202 if (err)
219 dev_err(np->device, PFX "%s: bits (%llx) of register %s " 203 netdev_err(np->dev, "bits (%llx) of register %s would not clear, val[%llx]\n",
220 "would not clear, val[%llx]\n", 204 (unsigned long long)bits, reg_name,
221 np->dev->name, (unsigned long long) bits, reg_name, 205 (unsigned long long)nr64(reg));
222 (unsigned long long) nr64(reg));
223 return err; 206 return err;
224} 207}
225 208
@@ -475,9 +458,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np)
475 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 458 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
476 ESR2_TI_PLL_CFG_L, pll_cfg); 459 ESR2_TI_PLL_CFG_L, pll_cfg);
477 if (err) { 460 if (err) {
478 dev_err(np->device, PFX "NIU Port %d " 461 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_CFG_L failed\n",
479 "serdes_init_niu_1g_serdes: " 462 np->port, __func__);
480 "mdio write to ESR2_TI_PLL_CFG_L failed", np->port);
481 return err; 463 return err;
482 } 464 }
483 465
@@ -486,9 +468,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np)
486 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 468 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
487 ESR2_TI_PLL_STS_L, pll_sts); 469 ESR2_TI_PLL_STS_L, pll_sts);
488 if (err) { 470 if (err) {
489 dev_err(np->device, PFX "NIU Port %d " 471 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_STS_L failed\n",
490 "serdes_init_niu_1g_serdes: " 472 np->port, __func__);
491 "mdio write to ESR2_TI_PLL_STS_L failed", np->port);
492 return err; 473 return err;
493 } 474 }
494 475
@@ -531,8 +512,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np)
531 } 512 }
532 513
533 if ((sig & mask) != val) { 514 if ((sig & mask) != val) {
534 dev_err(np->device, PFX "Port %u signal bits [%08x] are not " 515 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n",
535 "[%08x]\n", np->port, (int) (sig & mask), (int) val); 516 np->port, (int)(sig & mask), (int)val);
536 return -ENODEV; 517 return -ENODEV;
537 } 518 }
538 519
@@ -569,9 +550,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
569 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 550 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
570 ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff); 551 ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff);
571 if (err) { 552 if (err) {
572 dev_err(np->device, PFX "NIU Port %d " 553 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_CFG_L failed\n",
573 "serdes_init_niu_10g_serdes: " 554 np->port, __func__);
574 "mdio write to ESR2_TI_PLL_CFG_L failed", np->port);
575 return err; 555 return err;
576 } 556 }
577 557
@@ -580,9 +560,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
580 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, 560 err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
581 ESR2_TI_PLL_STS_L, pll_sts & 0xffff); 561 ESR2_TI_PLL_STS_L, pll_sts & 0xffff);
582 if (err) { 562 if (err) {
583 dev_err(np->device, PFX "NIU Port %d " 563 netdev_err(np->dev, "NIU Port %d %s() mdio write to ESR2_TI_PLL_STS_L failed\n",
584 "serdes_init_niu_10g_serdes: " 564 np->port, __func__);
585 "mdio write to ESR2_TI_PLL_STS_L failed", np->port);
586 return err; 565 return err;
587 } 566 }
588 567
@@ -639,9 +618,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
639 } 618 }
640 619
641 if ((sig & mask) != val) { 620 if ((sig & mask) != val) {
642 pr_info(PFX "NIU Port %u signal bits [%08x] are not " 621 pr_info("NIU Port %u signal bits [%08x] are not [%08x] for 10G...trying 1G\n",
643 "[%08x] for 10G...trying 1G\n", 622 np->port, (int)(sig & mask), (int)val);
644 np->port, (int) (sig & mask), (int) val);
645 623
646 /* 10G failed, try initializing at 1G */ 624 /* 10G failed, try initializing at 1G */
647 err = serdes_init_niu_1g_serdes(np); 625 err = serdes_init_niu_1g_serdes(np);
@@ -649,8 +627,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np)
649 np->flags &= ~NIU_FLAGS_10G; 627 np->flags &= ~NIU_FLAGS_10G;
650 np->mac_xcvr = MAC_XCVR_PCS; 628 np->mac_xcvr = MAC_XCVR_PCS;
651 } else { 629 } else {
652 dev_err(np->device, PFX "Port %u 10G/1G SERDES " 630 netdev_err(np->dev, "Port %u 10G/1G SERDES Link Failed\n",
653 "Link Failed \n", np->port); 631 np->port);
654 return -ENODEV; 632 return -ENODEV;
655 } 633 }
656 } 634 }
@@ -764,9 +742,8 @@ static int esr_reset(struct niu *np)
764 if (err) 742 if (err)
765 return err; 743 return err;
766 if (reset != 0) { 744 if (reset != 0) {
767 dev_err(np->device, PFX "Port %u ESR_RESET " 745 netdev_err(np->dev, "Port %u ESR_RESET did not clear [%08x]\n",
768 "did not clear [%08x]\n", 746 np->port, reset);
769 np->port, reset);
770 return -ENODEV; 747 return -ENODEV;
771 } 748 }
772 749
@@ -890,8 +867,8 @@ static int serdes_init_10g(struct niu *np)
890 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; 867 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT;
891 return 0; 868 return 0;
892 } 869 }
893 dev_err(np->device, PFX "Port %u signal bits [%08x] are not " 870 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n",
894 "[%08x]\n", np->port, (int) (sig & mask), (int) val); 871 np->port, (int)(sig & mask), (int)val);
895 return -ENODEV; 872 return -ENODEV;
896 } 873 }
897 if (np->flags & NIU_FLAGS_HOTPLUG_PHY) 874 if (np->flags & NIU_FLAGS_HOTPLUG_PHY)
@@ -1039,8 +1016,8 @@ static int serdes_init_1g_serdes(struct niu *np)
1039 } 1016 }
1040 1017
1041 if ((sig & mask) != val) { 1018 if ((sig & mask) != val) {
1042 dev_err(np->device, PFX "Port %u signal bits [%08x] are not " 1019 netdev_err(np->dev, "Port %u signal bits [%08x] are not [%08x]\n",
1043 "[%08x]\n", np->port, (int) (sig & mask), (int) val); 1020 np->port, (int)(sig & mask), (int)val);
1044 return -ENODEV; 1021 return -ENODEV;
1045 } 1022 }
1046 1023
@@ -1332,8 +1309,8 @@ static int bcm8704_reset(struct niu *np)
1332 break; 1309 break;
1333 } 1310 }
1334 if (limit < 0) { 1311 if (limit < 0) {
1335 dev_err(np->device, PFX "Port %u PHY will not reset " 1312 netdev_err(np->dev, "Port %u PHY will not reset (bmcr=%04x)\n",
1336 "(bmcr=%04x)\n", np->port, (err & 0xffff)); 1313 np->port, (err & 0xffff));
1337 return -ENODEV; 1314 return -ENODEV;
1338 } 1315 }
1339 return 0; 1316 return 0;
@@ -1515,21 +1492,18 @@ static int xcvr_diag_bcm870x(struct niu *np)
1515 MII_STAT1000); 1492 MII_STAT1000);
1516 if (err < 0) 1493 if (err < 0)
1517 return err; 1494 return err;
1518 pr_info(PFX "Port %u PMA_PMD(MII_STAT1000) [%04x]\n", 1495 pr_info("Port %u PMA_PMD(MII_STAT1000) [%04x]\n", np->port, err);
1519 np->port, err);
1520 1496
1521 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, 0x20); 1497 err = mdio_read(np, np->phy_addr, BCM8704_USER_DEV3_ADDR, 0x20);
1522 if (err < 0) 1498 if (err < 0)
1523 return err; 1499 return err;
1524 pr_info(PFX "Port %u USER_DEV3(0x20) [%04x]\n", 1500 pr_info("Port %u USER_DEV3(0x20) [%04x]\n", np->port, err);
1525 np->port, err);
1526 1501
1527 err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, 1502 err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR,
1528 MII_NWAYTEST); 1503 MII_NWAYTEST);
1529 if (err < 0) 1504 if (err < 0)
1530 return err; 1505 return err;
1531 pr_info(PFX "Port %u PHYXS(MII_NWAYTEST) [%04x]\n", 1506 pr_info("Port %u PHYXS(MII_NWAYTEST) [%04x]\n", np->port, err);
1532 np->port, err);
1533#endif 1507#endif
1534 1508
1535 /* XXX dig this out it might not be so useful XXX */ 1509 /* XXX dig this out it might not be so useful XXX */
@@ -1555,11 +1529,11 @@ static int xcvr_diag_bcm870x(struct niu *np)
1555 1529
1556 if (analog_stat0 != 0x03fc) { 1530 if (analog_stat0 != 0x03fc) {
1557 if ((analog_stat0 == 0x43bc) && (tx_alarm_status != 0)) { 1531 if ((analog_stat0 == 0x43bc) && (tx_alarm_status != 0)) {
1558 pr_info(PFX "Port %u cable not connected " 1532 pr_info("Port %u cable not connected or bad cable\n",
1559 "or bad cable.\n", np->port); 1533 np->port);
1560 } else if (analog_stat0 == 0x639c) { 1534 } else if (analog_stat0 == 0x639c) {
1561 pr_info(PFX "Port %u optical module is bad " 1535 pr_info("Port %u optical module is bad or missing\n",
1562 "or missing.\n", np->port); 1536 np->port);
1563 } 1537 }
1564 } 1538 }
1565 1539
@@ -1699,8 +1673,8 @@ static int mii_reset(struct niu *np)
1699 break; 1673 break;
1700 } 1674 }
1701 if (limit < 0) { 1675 if (limit < 0) {
1702 dev_err(np->device, PFX "Port %u MII would not reset, " 1676 netdev_err(np->dev, "Port %u MII would not reset, bmcr[%04x]\n",
1703 "bmcr[%04x]\n", np->port, err); 1677 np->port, err);
1704 return -ENODEV; 1678 return -ENODEV;
1705 } 1679 }
1706 1680
@@ -1895,7 +1869,7 @@ static int mii_init_common(struct niu *np)
1895 return err; 1869 return err;
1896 bmsr = err; 1870 bmsr = err;
1897 1871
1898 pr_info(PFX "Port %u after MII init bmcr[%04x] bmsr[%04x]\n", 1872 pr_info("Port %u after MII init bmcr[%04x] bmsr[%04x]\n",
1899 np->port, bmcr, bmsr); 1873 np->port, bmcr, bmsr);
1900#endif 1874#endif
1901 1875
@@ -1948,16 +1922,12 @@ static int niu_link_status_common(struct niu *np, int link_up)
1948 unsigned long flags; 1922 unsigned long flags;
1949 1923
1950 if (!netif_carrier_ok(dev) && link_up) { 1924 if (!netif_carrier_ok(dev) && link_up) {
1951 niuinfo(LINK, "%s: Link is up at %s, %s duplex\n", 1925 netif_info(np, link, dev, "Link is up at %s, %s duplex\n",
1952 dev->name, 1926 lp->active_speed == SPEED_10000 ? "10Gb/sec" :
1953 (lp->active_speed == SPEED_10000 ? 1927 lp->active_speed == SPEED_1000 ? "1Gb/sec" :
1954 "10Gb/sec" : 1928 lp->active_speed == SPEED_100 ? "100Mbit/sec" :
1955 (lp->active_speed == SPEED_1000 ? 1929 "10Mbit/sec",
1956 "1Gb/sec" : 1930 lp->active_duplex == DUPLEX_FULL ? "full" : "half");
1957 (lp->active_speed == SPEED_100 ?
1958 "100Mbit/sec" : "10Mbit/sec"))),
1959 (lp->active_duplex == DUPLEX_FULL ?
1960 "full" : "half"));
1961 1931
1962 spin_lock_irqsave(&np->lock, flags); 1932 spin_lock_irqsave(&np->lock, flags);
1963 niu_init_xif(np); 1933 niu_init_xif(np);
@@ -1966,7 +1936,7 @@ static int niu_link_status_common(struct niu *np, int link_up)
1966 1936
1967 netif_carrier_on(dev); 1937 netif_carrier_on(dev);
1968 } else if (netif_carrier_ok(dev) && !link_up) { 1938 } else if (netif_carrier_ok(dev) && !link_up) {
1969 niuwarn(LINK, "%s: Link is down\n", dev->name); 1939 netif_warn(np, link, dev, "Link is down\n");
1970 spin_lock_irqsave(&np->lock, flags); 1940 spin_lock_irqsave(&np->lock, flags);
1971 niu_handle_led(np, 0); 1941 niu_handle_led(np, 0);
1972 spin_unlock_irqrestore(&np->lock, flags); 1942 spin_unlock_irqrestore(&np->lock, flags);
@@ -2232,8 +2202,8 @@ static int link_status_10g_hotplug(struct niu *np, int *link_up_p)
2232 } else { 2202 } else {
2233 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; 2203 np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT;
2234 *link_up_p = 0; 2204 *link_up_p = 0;
2235 niuwarn(LINK, "%s: Hotplug PHY Removed\n", 2205 netif_warn(np, link, np->dev,
2236 np->dev->name); 2206 "Hotplug PHY Removed\n");
2237 } 2207 }
2238 } 2208 }
2239out: 2209out:
@@ -2531,8 +2501,8 @@ static int serdes_init_10g_serdes(struct niu *np)
2531 np->flags &= ~NIU_FLAGS_10G; 2501 np->flags &= ~NIU_FLAGS_10G;
2532 np->mac_xcvr = MAC_XCVR_PCS; 2502 np->mac_xcvr = MAC_XCVR_PCS;
2533 } else { 2503 } else {
2534 dev_err(np->device, PFX "Port %u 10G/1G SERDES Link Failed \n", 2504 netdev_err(np->dev, "Port %u 10G/1G SERDES Link Failed\n",
2535 np->port); 2505 np->port);
2536 return -ENODEV; 2506 return -ENODEV;
2537 } 2507 }
2538 } 2508 }
@@ -3234,23 +3204,25 @@ static int fflp_early_init(struct niu *np)
3234 parent = np->parent; 3204 parent = np->parent;
3235 err = 0; 3205 err = 0;
3236 if (!(parent->flags & PARENT_FLGS_CLS_HWINIT)) { 3206 if (!(parent->flags & PARENT_FLGS_CLS_HWINIT)) {
3237 niudbg(PROBE, "fflp_early_init: Initting hw on port %u\n", 3207 netif_printk(np, probe, KERN_DEBUG, np->dev,
3238 np->port); 3208 "%s() Initting hw on port %u\n",
3209 __func__, np->port);
3239 if (np->parent->plat_type != PLAT_TYPE_NIU) { 3210 if (np->parent->plat_type != PLAT_TYPE_NIU) {
3240 fflp_reset(np); 3211 fflp_reset(np);
3241 fflp_set_timings(np); 3212 fflp_set_timings(np);
3242 err = fflp_disable_all_partitions(np); 3213 err = fflp_disable_all_partitions(np);
3243 if (err) { 3214 if (err) {
3244 niudbg(PROBE, "fflp_disable_all_partitions " 3215 netif_printk(np, probe, KERN_DEBUG, np->dev,
3245 "failed, err=%d\n", err); 3216 "fflp_disable_all_partitions failed, err=%d\n",
3217 err);
3246 goto out; 3218 goto out;
3247 } 3219 }
3248 } 3220 }
3249 3221
3250 err = tcam_early_init(np); 3222 err = tcam_early_init(np);
3251 if (err) { 3223 if (err) {
3252 niudbg(PROBE, "tcam_early_init failed, err=%d\n", 3224 netif_printk(np, probe, KERN_DEBUG, np->dev,
3253 err); 3225 "tcam_early_init failed, err=%d\n", err);
3254 goto out; 3226 goto out;
3255 } 3227 }
3256 fflp_llcsnap_enable(np, 1); 3228 fflp_llcsnap_enable(np, 1);
@@ -3260,22 +3232,24 @@ static int fflp_early_init(struct niu *np)
3260 3232
3261 err = tcam_flush_all(np); 3233 err = tcam_flush_all(np);
3262 if (err) { 3234 if (err) {
3263 niudbg(PROBE, "tcam_flush_all failed, err=%d\n", 3235 netif_printk(np, probe, KERN_DEBUG, np->dev,
3264 err); 3236 "tcam_flush_all failed, err=%d\n", err);
3265 goto out; 3237 goto out;
3266 } 3238 }
3267 if (np->parent->plat_type != PLAT_TYPE_NIU) { 3239 if (np->parent->plat_type != PLAT_TYPE_NIU) {
3268 err = fflp_hash_clear(np); 3240 err = fflp_hash_clear(np);
3269 if (err) { 3241 if (err) {
3270 niudbg(PROBE, "fflp_hash_clear failed, " 3242 netif_printk(np, probe, KERN_DEBUG, np->dev,
3271 "err=%d\n", err); 3243 "fflp_hash_clear failed, err=%d\n",
3244 err);
3272 goto out; 3245 goto out;
3273 } 3246 }
3274 } 3247 }
3275 3248
3276 vlan_tbl_clear(np); 3249 vlan_tbl_clear(np);
3277 3250
3278 niudbg(PROBE, "fflp_early_init: Success\n"); 3251 netif_printk(np, probe, KERN_DEBUG, np->dev,
3252 "%s() Success\n", __func__);
3279 parent->flags |= PARENT_FLGS_CLS_HWINIT; 3253 parent->flags |= PARENT_FLGS_CLS_HWINIT;
3280 } 3254 }
3281out: 3255out:
@@ -3665,8 +3639,8 @@ static void niu_tx_work(struct niu *np, struct tx_ring_info *rp)
3665 3639
3666 cons = rp->cons; 3640 cons = rp->cons;
3667 3641
3668 niudbg(TX_DONE, "%s: niu_tx_work() pkt_cnt[%u] cons[%d]\n", 3642 netif_printk(np, tx_done, KERN_DEBUG, np->dev,
3669 np->dev->name, pkt_cnt, cons); 3643 "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons);
3670 3644
3671 while (pkt_cnt--) 3645 while (pkt_cnt--)
3672 cons = release_tx_packet(np, rp, cons); 3646 cons = release_tx_packet(np, rp, cons);
@@ -3714,11 +3688,12 @@ static inline void niu_sync_rx_discard_stats(struct niu *np,
3714 rp->rx_errors += misc & RXMISC_COUNT; 3688 rp->rx_errors += misc & RXMISC_COUNT;
3715 3689
3716 if (unlikely(misc & RXMISC_OFLOW)) 3690 if (unlikely(misc & RXMISC_OFLOW))
3717 dev_err(np->device, "rx-%d: Counter overflow " 3691 dev_err(np->device, "rx-%d: Counter overflow RXMISC discard\n",
3718 "RXMISC discard\n", rx_channel); 3692 rx_channel);
3719 3693
3720 niudbg(RX_ERR, "%s-rx-%d: MISC drop=%u over=%u\n", 3694 netif_printk(np, rx_err, KERN_DEBUG, np->dev,
3721 np->dev->name, rx_channel, misc, misc-limit); 3695 "rx-%d: MISC drop=%u over=%u\n",
3696 rx_channel, misc, misc-limit);
3722 } 3697 }
3723 3698
3724 /* WRED (Weighted Random Early Discard) by hardware */ 3699 /* WRED (Weighted Random Early Discard) by hardware */
@@ -3728,11 +3703,11 @@ static inline void niu_sync_rx_discard_stats(struct niu *np,
3728 rp->rx_dropped += wred & RED_DIS_CNT_COUNT; 3703 rp->rx_dropped += wred & RED_DIS_CNT_COUNT;
3729 3704
3730 if (unlikely(wred & RED_DIS_CNT_OFLOW)) 3705 if (unlikely(wred & RED_DIS_CNT_OFLOW))
3731 dev_err(np->device, "rx-%d: Counter overflow " 3706 dev_err(np->device, "rx-%d: Counter overflow WRED discard\n", rx_channel);
3732 "WRED discard\n", rx_channel);
3733 3707
3734 niudbg(RX_ERR, "%s-rx-%d: WRED drop=%u over=%u\n", 3708 netif_printk(np, rx_err, KERN_DEBUG, np->dev,
3735 np->dev->name, rx_channel, wred, wred-limit); 3709 "rx-%d: WRED drop=%u over=%u\n",
3710 rx_channel, wred, wred-limit);
3736 } 3711 }
3737} 3712}
3738 3713
@@ -3753,8 +3728,9 @@ static int niu_rx_work(struct napi_struct *napi, struct niu *np,
3753 mbox->rx_dma_ctl_stat = 0; 3728 mbox->rx_dma_ctl_stat = 0;
3754 mbox->rcrstat_a = 0; 3729 mbox->rcrstat_a = 0;
3755 3730
3756 niudbg(RX_STATUS, "%s: niu_rx_work(chan[%d]), stat[%llx] qlen=%d\n", 3731 netif_printk(np, rx_status, KERN_DEBUG, np->dev,
3757 np->dev->name, rp->rx_channel, (unsigned long long) stat, qlen); 3732 "%s(chan[%d]), stat[%llx] qlen=%d\n",
3733 __func__, rp->rx_channel, (unsigned long long)stat, qlen);
3758 3734
3759 rcr_done = work_done = 0; 3735 rcr_done = work_done = 0;
3760 qlen = min(qlen, budget); 3736 qlen = min(qlen, budget);
@@ -3791,8 +3767,8 @@ static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget)
3791 u32 rx_vec = (v0 & 0xffffffff); 3767 u32 rx_vec = (v0 & 0xffffffff);
3792 int i, work_done = 0; 3768 int i, work_done = 0;
3793 3769
3794 niudbg(INTR, "%s: niu_poll_core() v0[%016llx]\n", 3770 netif_printk(np, intr, KERN_DEBUG, np->dev,
3795 np->dev->name, (unsigned long long) v0); 3771 "%s() v0[%016llx]\n", __func__, (unsigned long long)v0);
3796 3772
3797 for (i = 0; i < np->num_tx_rings; i++) { 3773 for (i = 0; i < np->num_tx_rings; i++) {
3798 struct tx_ring_info *rp = &np->tx_rings[i]; 3774 struct tx_ring_info *rp = &np->tx_rings[i];
@@ -3837,39 +3813,38 @@ static int niu_poll(struct napi_struct *napi, int budget)
3837static void niu_log_rxchan_errors(struct niu *np, struct rx_ring_info *rp, 3813static void niu_log_rxchan_errors(struct niu *np, struct rx_ring_info *rp,
3838 u64 stat) 3814 u64 stat)
3839{ 3815{
3840 dev_err(np->device, PFX "%s: RX channel %u errors ( ", 3816 netdev_err(np->dev, "RX channel %u errors ( ", rp->rx_channel);
3841 np->dev->name, rp->rx_channel);
3842 3817
3843 if (stat & RX_DMA_CTL_STAT_RBR_TMOUT) 3818 if (stat & RX_DMA_CTL_STAT_RBR_TMOUT)
3844 printk("RBR_TMOUT "); 3819 pr_cont("RBR_TMOUT ");
3845 if (stat & RX_DMA_CTL_STAT_RSP_CNT_ERR) 3820 if (stat & RX_DMA_CTL_STAT_RSP_CNT_ERR)
3846 printk("RSP_CNT "); 3821 pr_cont("RSP_CNT ");
3847 if (stat & RX_DMA_CTL_STAT_BYTE_EN_BUS) 3822 if (stat & RX_DMA_CTL_STAT_BYTE_EN_BUS)
3848 printk("BYTE_EN_BUS "); 3823 pr_cont("BYTE_EN_BUS ");
3849 if (stat & RX_DMA_CTL_STAT_RSP_DAT_ERR) 3824 if (stat & RX_DMA_CTL_STAT_RSP_DAT_ERR)
3850 printk("RSP_DAT "); 3825 pr_cont("RSP_DAT ");
3851 if (stat & RX_DMA_CTL_STAT_RCR_ACK_ERR) 3826 if (stat & RX_DMA_CTL_STAT_RCR_ACK_ERR)
3852 printk("RCR_ACK "); 3827 pr_cont("RCR_ACK ");
3853 if (stat & RX_DMA_CTL_STAT_RCR_SHA_PAR) 3828 if (stat & RX_DMA_CTL_STAT_RCR_SHA_PAR)
3854 printk("RCR_SHA_PAR "); 3829 pr_cont("RCR_SHA_PAR ");
3855 if (stat & RX_DMA_CTL_STAT_RBR_PRE_PAR) 3830 if (stat & RX_DMA_CTL_STAT_RBR_PRE_PAR)
3856 printk("RBR_PRE_PAR "); 3831 pr_cont("RBR_PRE_PAR ");
3857 if (stat & RX_DMA_CTL_STAT_CONFIG_ERR) 3832 if (stat & RX_DMA_CTL_STAT_CONFIG_ERR)
3858 printk("CONFIG "); 3833 pr_cont("CONFIG ");
3859 if (stat & RX_DMA_CTL_STAT_RCRINCON) 3834 if (stat & RX_DMA_CTL_STAT_RCRINCON)
3860 printk("RCRINCON "); 3835 pr_cont("RCRINCON ");
3861 if (stat & RX_DMA_CTL_STAT_RCRFULL) 3836 if (stat & RX_DMA_CTL_STAT_RCRFULL)
3862 printk("RCRFULL "); 3837 pr_cont("RCRFULL ");
3863 if (stat & RX_DMA_CTL_STAT_RBRFULL) 3838 if (stat & RX_DMA_CTL_STAT_RBRFULL)
3864 printk("RBRFULL "); 3839 pr_cont("RBRFULL ");
3865 if (stat & RX_DMA_CTL_STAT_RBRLOGPAGE) 3840 if (stat & RX_DMA_CTL_STAT_RBRLOGPAGE)
3866 printk("RBRLOGPAGE "); 3841 pr_cont("RBRLOGPAGE ");
3867 if (stat & RX_DMA_CTL_STAT_CFIGLOGPAGE) 3842 if (stat & RX_DMA_CTL_STAT_CFIGLOGPAGE)
3868 printk("CFIGLOGPAGE "); 3843 pr_cont("CFIGLOGPAGE ");
3869 if (stat & RX_DMA_CTL_STAT_DC_FIFO_ERR) 3844 if (stat & RX_DMA_CTL_STAT_DC_FIFO_ERR)
3870 printk("DC_FIDO "); 3845 pr_cont("DC_FIDO ");
3871 3846
3872 printk(")\n"); 3847 pr_cont(")\n");
3873} 3848}
3874 3849
3875static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) 3850static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
@@ -3883,9 +3858,9 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
3883 err = -EINVAL; 3858 err = -EINVAL;
3884 3859
3885 if (err) { 3860 if (err) {
3886 dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n", 3861 netdev_err(np->dev, "RX channel %u error, stat[%llx]\n",
3887 np->dev->name, rp->rx_channel, 3862 rp->rx_channel,
3888 (unsigned long long) stat); 3863 (unsigned long long) stat);
3889 3864
3890 niu_log_rxchan_errors(np, rp, stat); 3865 niu_log_rxchan_errors(np, rp, stat);
3891 } 3866 }
@@ -3899,27 +3874,26 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
3899static void niu_log_txchan_errors(struct niu *np, struct tx_ring_info *rp, 3874static void niu_log_txchan_errors(struct niu *np, struct tx_ring_info *rp,
3900 u64 cs) 3875 u64 cs)
3901{ 3876{
3902 dev_err(np->device, PFX "%s: TX channel %u errors ( ", 3877 netdev_err(np->dev, "TX channel %u errors ( ", rp->tx_channel);
3903 np->dev->name, rp->tx_channel);
3904 3878
3905 if (cs & TX_CS_MBOX_ERR) 3879 if (cs & TX_CS_MBOX_ERR)
3906 printk("MBOX "); 3880 pr_cont("MBOX ");
3907 if (cs & TX_CS_PKT_SIZE_ERR) 3881 if (cs & TX_CS_PKT_SIZE_ERR)
3908 printk("PKT_SIZE "); 3882 pr_cont("PKT_SIZE ");
3909 if (cs & TX_CS_TX_RING_OFLOW) 3883 if (cs & TX_CS_TX_RING_OFLOW)
3910 printk("TX_RING_OFLOW "); 3884 pr_cont("TX_RING_OFLOW ");
3911 if (cs & TX_CS_PREF_BUF_PAR_ERR) 3885 if (cs & TX_CS_PREF_BUF_PAR_ERR)
3912 printk("PREF_BUF_PAR "); 3886 pr_cont("PREF_BUF_PAR ");
3913 if (cs & TX_CS_NACK_PREF) 3887 if (cs & TX_CS_NACK_PREF)
3914 printk("NACK_PREF "); 3888 pr_cont("NACK_PREF ");
3915 if (cs & TX_CS_NACK_PKT_RD) 3889 if (cs & TX_CS_NACK_PKT_RD)
3916 printk("NACK_PKT_RD "); 3890 pr_cont("NACK_PKT_RD ");
3917 if (cs & TX_CS_CONF_PART_ERR) 3891 if (cs & TX_CS_CONF_PART_ERR)
3918 printk("CONF_PART "); 3892 pr_cont("CONF_PART ");
3919 if (cs & TX_CS_PKT_PRT_ERR) 3893 if (cs & TX_CS_PKT_PRT_ERR)
3920 printk("PKT_PTR "); 3894 pr_cont("PKT_PTR ");
3921 3895
3922 printk(")\n"); 3896 pr_cont(")\n");
3923} 3897}
3924 3898
3925static int niu_tx_error(struct niu *np, struct tx_ring_info *rp) 3899static int niu_tx_error(struct niu *np, struct tx_ring_info *rp)
@@ -3930,12 +3904,11 @@ static int niu_tx_error(struct niu *np, struct tx_ring_info *rp)
3930 logh = nr64(TX_RNG_ERR_LOGH(rp->tx_channel)); 3904 logh = nr64(TX_RNG_ERR_LOGH(rp->tx_channel));
3931 logl = nr64(TX_RNG_ERR_LOGL(rp->tx_channel)); 3905 logl = nr64(TX_RNG_ERR_LOGL(rp->tx_channel));
3932 3906
3933 dev_err(np->device, PFX "%s: TX channel %u error, " 3907 netdev_err(np->dev, "TX channel %u error, cs[%llx] logh[%llx] logl[%llx]\n",
3934 "cs[%llx] logh[%llx] logl[%llx]\n", 3908 rp->tx_channel,
3935 np->dev->name, rp->tx_channel, 3909 (unsigned long long)cs,
3936 (unsigned long long) cs, 3910 (unsigned long long)logh,
3937 (unsigned long long) logh, 3911 (unsigned long long)logl);
3938 (unsigned long long) logl);
3939 3912
3940 niu_log_txchan_errors(np, rp, cs); 3913 niu_log_txchan_errors(np, rp, cs);
3941 3914
@@ -3954,9 +3927,8 @@ static int niu_mif_interrupt(struct niu *np)
3954 phy_mdint = 1; 3927 phy_mdint = 1;
3955 } 3928 }
3956 3929
3957 dev_err(np->device, PFX "%s: MIF interrupt, " 3930 netdev_err(np->dev, "MIF interrupt, stat[%llx] phy_mdint(%d)\n",
3958 "stat[%llx] phy_mdint(%d)\n", 3931 (unsigned long long)mif_status, phy_mdint);
3959 np->dev->name, (unsigned long long) mif_status, phy_mdint);
3960 3932
3961 return -ENODEV; 3933 return -ENODEV;
3962} 3934}
@@ -4081,41 +4053,40 @@ static int niu_mac_interrupt(struct niu *np)
4081 4053
4082static void niu_log_device_error(struct niu *np, u64 stat) 4054static void niu_log_device_error(struct niu *np, u64 stat)
4083{ 4055{
4084 dev_err(np->device, PFX "%s: Core device errors ( ", 4056 netdev_err(np->dev, "Core device errors ( ");
4085 np->dev->name);
4086 4057
4087 if (stat & SYS_ERR_MASK_META2) 4058 if (stat & SYS_ERR_MASK_META2)
4088 printk("META2 "); 4059 pr_cont("META2 ");
4089 if (stat & SYS_ERR_MASK_META1) 4060 if (stat & SYS_ERR_MASK_META1)
4090 printk("META1 "); 4061 pr_cont("META1 ");
4091 if (stat & SYS_ERR_MASK_PEU) 4062 if (stat & SYS_ERR_MASK_PEU)
4092 printk("PEU "); 4063 pr_cont("PEU ");
4093 if (stat & SYS_ERR_MASK_TXC) 4064 if (stat & SYS_ERR_MASK_TXC)
4094 printk("TXC "); 4065 pr_cont("TXC ");
4095 if (stat & SYS_ERR_MASK_RDMC) 4066 if (stat & SYS_ERR_MASK_RDMC)
4096 printk("RDMC "); 4067 pr_cont("RDMC ");
4097 if (stat & SYS_ERR_MASK_TDMC) 4068 if (stat & SYS_ERR_MASK_TDMC)
4098 printk("TDMC "); 4069 pr_cont("TDMC ");
4099 if (stat & SYS_ERR_MASK_ZCP) 4070 if (stat & SYS_ERR_MASK_ZCP)
4100 printk("ZCP "); 4071 pr_cont("ZCP ");
4101 if (stat & SYS_ERR_MASK_FFLP) 4072 if (stat & SYS_ERR_MASK_FFLP)
4102 printk("FFLP "); 4073 pr_cont("FFLP ");
4103 if (stat & SYS_ERR_MASK_IPP) 4074 if (stat & SYS_ERR_MASK_IPP)
4104 printk("IPP "); 4075 pr_cont("IPP ");
4105 if (stat & SYS_ERR_MASK_MAC) 4076 if (stat & SYS_ERR_MASK_MAC)
4106 printk("MAC "); 4077 pr_cont("MAC ");
4107 if (stat & SYS_ERR_MASK_SMX) 4078 if (stat & SYS_ERR_MASK_SMX)
4108 printk("SMX "); 4079 pr_cont("SMX ");
4109 4080
4110 printk(")\n"); 4081 pr_cont(")\n");
4111} 4082}
4112 4083
4113static int niu_device_error(struct niu *np) 4084static int niu_device_error(struct niu *np)
4114{ 4085{
4115 u64 stat = nr64(SYS_ERR_STAT); 4086 u64 stat = nr64(SYS_ERR_STAT);
4116 4087
4117 dev_err(np->device, PFX "%s: Core device error, stat[%llx]\n", 4088 netdev_err(np->dev, "Core device error, stat[%llx]\n",
4118 np->dev->name, (unsigned long long) stat); 4089 (unsigned long long)stat);
4119 4090
4120 niu_log_device_error(np, stat); 4091 niu_log_device_error(np, stat);
4121 4092
@@ -4197,8 +4168,8 @@ static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp,
4197 RX_DMA_CTL_STAT_RCRTO); 4168 RX_DMA_CTL_STAT_RCRTO);
4198 nw64(RX_DMA_CTL_STAT(rp->rx_channel), stat_write); 4169 nw64(RX_DMA_CTL_STAT(rp->rx_channel), stat_write);
4199 4170
4200 niudbg(INTR, "%s: rxchan_intr stat[%llx]\n", 4171 netif_printk(np, intr, KERN_DEBUG, np->dev,
4201 np->dev->name, (unsigned long long) stat); 4172 "%s() stat[%llx]\n", __func__, (unsigned long long)stat);
4202} 4173}
4203 4174
4204static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp, 4175static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp,
@@ -4206,8 +4177,8 @@ static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp,
4206{ 4177{
4207 rp->tx_cs = nr64(TX_CS(rp->tx_channel)); 4178 rp->tx_cs = nr64(TX_CS(rp->tx_channel));
4208 4179
4209 niudbg(INTR, "%s: txchan_intr cs[%llx]\n", 4180 netif_printk(np, intr, KERN_DEBUG, np->dev,
4210 np->dev->name, (unsigned long long) rp->tx_cs); 4181 "%s() cs[%llx]\n", __func__, (unsigned long long)rp->tx_cs);
4211} 4182}
4212 4183
4213static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0) 4184static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0)
@@ -4265,8 +4236,8 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id)
4265 u64 v0, v1, v2; 4236 u64 v0, v1, v2;
4266 4237
4267 if (netif_msg_intr(np)) 4238 if (netif_msg_intr(np))
4268 printk(KERN_DEBUG PFX "niu_interrupt() ldg[%p](%d) ", 4239 printk(KERN_DEBUG KBUILD_MODNAME ": " "%s() ldg[%p](%d)",
4269 lp, ldg); 4240 __func__, lp, ldg);
4270 4241
4271 spin_lock_irqsave(&np->lock, flags); 4242 spin_lock_irqsave(&np->lock, flags);
4272 4243
@@ -4275,11 +4246,13 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id)
4275 v2 = nr64(LDSV2(ldg)); 4246 v2 = nr64(LDSV2(ldg));
4276 4247
4277 if (netif_msg_intr(np)) 4248 if (netif_msg_intr(np))
4278 printk("v0[%llx] v1[%llx] v2[%llx]\n", 4249 pr_cont(" v0[%llx] v1[%llx] v2[%llx]",
4279 (unsigned long long) v0, 4250 (unsigned long long) v0,
4280 (unsigned long long) v1, 4251 (unsigned long long) v1,
4281 (unsigned long long) v2); 4252 (unsigned long long) v2);
4282 4253
4254 pr_cont("\n");
4255
4283 if (unlikely(!v0 && !v1 && !v2)) { 4256 if (unlikely(!v0 && !v1 && !v2)) {
4284 spin_unlock_irqrestore(&np->lock, flags); 4257 spin_unlock_irqrestore(&np->lock, flags);
4285 return IRQ_NONE; 4258 return IRQ_NONE;
@@ -4400,8 +4373,8 @@ static int niu_alloc_rx_ring_info(struct niu *np,
4400 if (!rp->mbox) 4373 if (!rp->mbox)
4401 return -ENOMEM; 4374 return -ENOMEM;
4402 if ((unsigned long)rp->mbox & (64UL - 1)) { 4375 if ((unsigned long)rp->mbox & (64UL - 1)) {
4403 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4376 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA mailbox %p\n",
4404 "RXDMA mailbox %p\n", np->dev->name, rp->mbox); 4377 rp->mbox);
4405 return -EINVAL; 4378 return -EINVAL;
4406 } 4379 }
4407 4380
@@ -4411,8 +4384,8 @@ static int niu_alloc_rx_ring_info(struct niu *np,
4411 if (!rp->rcr) 4384 if (!rp->rcr)
4412 return -ENOMEM; 4385 return -ENOMEM;
4413 if ((unsigned long)rp->rcr & (64UL - 1)) { 4386 if ((unsigned long)rp->rcr & (64UL - 1)) {
4414 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4387 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA RCR table %p\n",
4415 "RXDMA RCR table %p\n", np->dev->name, rp->rcr); 4388 rp->rcr);
4416 return -EINVAL; 4389 return -EINVAL;
4417 } 4390 }
4418 rp->rcr_table_size = MAX_RCR_RING_SIZE; 4391 rp->rcr_table_size = MAX_RCR_RING_SIZE;
@@ -4424,8 +4397,8 @@ static int niu_alloc_rx_ring_info(struct niu *np,
4424 if (!rp->rbr) 4397 if (!rp->rbr)
4425 return -ENOMEM; 4398 return -ENOMEM;
4426 if ((unsigned long)rp->rbr & (64UL - 1)) { 4399 if ((unsigned long)rp->rbr & (64UL - 1)) {
4427 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4400 netdev_err(np->dev, "Coherent alloc gives misaligned RXDMA RBR table %p\n",
4428 "RXDMA RBR table %p\n", np->dev->name, rp->rbr); 4401 rp->rbr);
4429 return -EINVAL; 4402 return -EINVAL;
4430 } 4403 }
4431 rp->rbr_table_size = MAX_RBR_RING_SIZE; 4404 rp->rbr_table_size = MAX_RBR_RING_SIZE;
@@ -4458,8 +4431,8 @@ static int niu_alloc_tx_ring_info(struct niu *np,
4458 if (!rp->mbox) 4431 if (!rp->mbox)
4459 return -ENOMEM; 4432 return -ENOMEM;
4460 if ((unsigned long)rp->mbox & (64UL - 1)) { 4433 if ((unsigned long)rp->mbox & (64UL - 1)) {
4461 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4434 netdev_err(np->dev, "Coherent alloc gives misaligned TXDMA mailbox %p\n",
4462 "TXDMA mailbox %p\n", np->dev->name, rp->mbox); 4435 rp->mbox);
4463 return -EINVAL; 4436 return -EINVAL;
4464 } 4437 }
4465 4438
@@ -4469,8 +4442,8 @@ static int niu_alloc_tx_ring_info(struct niu *np,
4469 if (!rp->descr) 4442 if (!rp->descr)
4470 return -ENOMEM; 4443 return -ENOMEM;
4471 if ((unsigned long)rp->descr & (64UL - 1)) { 4444 if ((unsigned long)rp->descr & (64UL - 1)) {
4472 dev_err(np->device, PFX "%s: Coherent alloc gives misaligned " 4445 netdev_err(np->dev, "Coherent alloc gives misaligned TXDMA descr table %p\n",
4473 "TXDMA descr table %p\n", np->dev->name, rp->descr); 4446 rp->descr);
4474 return -EINVAL; 4447 return -EINVAL;
4475 } 4448 }
4476 4449
@@ -4726,10 +4699,8 @@ static int niu_init_one_tx_channel(struct niu *np, struct tx_ring_info *rp)
4726 4699
4727 if (rp->descr_dma & ~(TX_RNG_CFIG_STADDR_BASE | 4700 if (rp->descr_dma & ~(TX_RNG_CFIG_STADDR_BASE |
4728 TX_RNG_CFIG_STADDR)) { 4701 TX_RNG_CFIG_STADDR)) {
4729 dev_err(np->device, PFX "%s: TX ring channel %d " 4702 netdev_err(np->dev, "TX ring channel %d DMA addr (%llx) is not aligned\n",
4730 "DMA addr (%llx) is not aligned.\n", 4703 channel, (unsigned long long)rp->descr_dma);
4731 np->dev->name, channel,
4732 (unsigned long long) rp->descr_dma);
4733 return -EINVAL; 4704 return -EINVAL;
4734 } 4705 }
4735 4706
@@ -4746,10 +4717,8 @@ static int niu_init_one_tx_channel(struct niu *np, struct tx_ring_info *rp)
4746 4717
4747 if (((rp->mbox_dma >> 32) & ~TXDMA_MBH_MBADDR) || 4718 if (((rp->mbox_dma >> 32) & ~TXDMA_MBH_MBADDR) ||
4748 ((u32)rp->mbox_dma & ~TXDMA_MBL_MBADDR)) { 4719 ((u32)rp->mbox_dma & ~TXDMA_MBL_MBADDR)) {
4749 dev_err(np->device, PFX "%s: TX ring channel %d " 4720 netdev_err(np->dev, "TX ring channel %d MBOX addr (%llx) has invalid bits\n",
4750 "MBOX addr (%llx) is has illegal bits.\n", 4721 channel, (unsigned long long)rp->mbox_dma);
4751 np->dev->name, channel,
4752 (unsigned long long) rp->mbox_dma);
4753 return -EINVAL; 4722 return -EINVAL;
4754 } 4723 }
4755 nw64(TXDMA_MBH(channel), rp->mbox_dma >> 32); 4724 nw64(TXDMA_MBH(channel), rp->mbox_dma >> 32);
@@ -5146,9 +5115,8 @@ static int niu_zcp_read(struct niu *np, int index, u64 *data)
5146 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, 5115 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY,
5147 1000, 100); 5116 1000, 100);
5148 if (err) { 5117 if (err) {
5149 dev_err(np->device, PFX "%s: ZCP read busy won't clear, " 5118 netdev_err(np->dev, "ZCP read busy won't clear, ZCP_RAM_ACC[%llx]\n",
5150 "ZCP_RAM_ACC[%llx]\n", np->dev->name, 5119 (unsigned long long)nr64(ZCP_RAM_ACC));
5151 (unsigned long long) nr64(ZCP_RAM_ACC));
5152 return err; 5120 return err;
5153 } 5121 }
5154 5122
@@ -5160,9 +5128,8 @@ static int niu_zcp_read(struct niu *np, int index, u64 *data)
5160 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, 5128 err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY,
5161 1000, 100); 5129 1000, 100);
5162 if (err) { 5130 if (err) {
5163 dev_err(np->device, PFX "%s: ZCP read busy2 won't clear, " 5131 netdev_err(np->dev, "ZCP read busy2 won't clear, ZCP_RAM_ACC[%llx]\n",
5164 "ZCP_RAM_ACC[%llx]\n", np->dev->name, 5132 (unsigned long long)nr64(ZCP_RAM_ACC));
5165 (unsigned long long) nr64(ZCP_RAM_ACC));
5166 return err; 5133 return err;
5167 } 5134 }
5168 5135
@@ -5527,8 +5494,7 @@ static int niu_reset_tx_bmac(struct niu *np)
5527 udelay(100); 5494 udelay(100);
5528 } 5495 }
5529 if (limit < 0) { 5496 if (limit < 0) {
5530 dev_err(np->device, PFX "Port %u TX BMAC would not reset, " 5497 dev_err(np->device, "Port %u TX BMAC would not reset, BTXMAC_SW_RST[%llx]\n",
5531 "BTXMAC_SW_RST[%llx]\n",
5532 np->port, 5498 np->port,
5533 (unsigned long long) nr64_mac(BTXMAC_SW_RST)); 5499 (unsigned long long) nr64_mac(BTXMAC_SW_RST));
5534 return -ENODEV; 5500 return -ENODEV;
@@ -5629,12 +5595,11 @@ static int niu_reset_rx_xmac(struct niu *np)
5629 while (--limit >= 0) { 5595 while (--limit >= 0) {
5630 if (!(nr64_mac(XRXMAC_SW_RST) & (XRXMAC_SW_RST_REG_RS | 5596 if (!(nr64_mac(XRXMAC_SW_RST) & (XRXMAC_SW_RST_REG_RS |
5631 XRXMAC_SW_RST_SOFT_RST))) 5597 XRXMAC_SW_RST_SOFT_RST)))
5632 break; 5598 break;
5633 udelay(100); 5599 udelay(100);
5634 } 5600 }
5635 if (limit < 0) { 5601 if (limit < 0) {
5636 dev_err(np->device, PFX "Port %u RX XMAC would not reset, " 5602 dev_err(np->device, "Port %u RX XMAC would not reset, XRXMAC_SW_RST[%llx]\n",
5637 "XRXMAC_SW_RST[%llx]\n",
5638 np->port, 5603 np->port,
5639 (unsigned long long) nr64_mac(XRXMAC_SW_RST)); 5604 (unsigned long long) nr64_mac(XRXMAC_SW_RST));
5640 return -ENODEV; 5605 return -ENODEV;
@@ -5655,8 +5620,7 @@ static int niu_reset_rx_bmac(struct niu *np)
5655 udelay(100); 5620 udelay(100);
5656 } 5621 }
5657 if (limit < 0) { 5622 if (limit < 0) {
5658 dev_err(np->device, PFX "Port %u RX BMAC would not reset, " 5623 dev_err(np->device, "Port %u RX BMAC would not reset, BRXMAC_SW_RST[%llx]\n",
5659 "BRXMAC_SW_RST[%llx]\n",
5660 np->port, 5624 np->port,
5661 (unsigned long long) nr64_mac(BRXMAC_SW_RST)); 5625 (unsigned long long) nr64_mac(BRXMAC_SW_RST));
5662 return -ENODEV; 5626 return -ENODEV;
@@ -5960,11 +5924,9 @@ static void niu_disable_ipp(struct niu *np)
5960 } 5924 }
5961 if (limit < 0 && 5925 if (limit < 0 &&
5962 (rd != 0 && wr != 1)) { 5926 (rd != 0 && wr != 1)) {
5963 dev_err(np->device, PFX "%s: IPP would not quiesce, " 5927 netdev_err(np->dev, "IPP would not quiesce, rd_ptr[%llx] wr_ptr[%llx]\n",
5964 "rd_ptr[%llx] wr_ptr[%llx]\n", 5928 (unsigned long long)nr64_ipp(IPP_DFIFO_RD_PTR),
5965 np->dev->name, 5929 (unsigned long long)nr64_ipp(IPP_DFIFO_WR_PTR));
5966 (unsigned long long) nr64_ipp(IPP_DFIFO_RD_PTR),
5967 (unsigned long long) nr64_ipp(IPP_DFIFO_WR_PTR));
5968 } 5930 }
5969 5931
5970 val = nr64_ipp(IPP_CFIG); 5932 val = nr64_ipp(IPP_CFIG);
@@ -5981,12 +5943,12 @@ static int niu_init_hw(struct niu *np)
5981{ 5943{
5982 int i, err; 5944 int i, err;
5983 5945
5984 niudbg(IFUP, "%s: Initialize TXC\n", np->dev->name); 5946 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TXC\n");
5985 niu_txc_enable_port(np, 1); 5947 niu_txc_enable_port(np, 1);
5986 niu_txc_port_dma_enable(np, 1); 5948 niu_txc_port_dma_enable(np, 1);
5987 niu_txc_set_imask(np, 0); 5949 niu_txc_set_imask(np, 0);
5988 5950
5989 niudbg(IFUP, "%s: Initialize TX channels\n", np->dev->name); 5951 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TX channels\n");
5990 for (i = 0; i < np->num_tx_rings; i++) { 5952 for (i = 0; i < np->num_tx_rings; i++) {
5991 struct tx_ring_info *rp = &np->tx_rings[i]; 5953 struct tx_ring_info *rp = &np->tx_rings[i];
5992 5954
@@ -5995,27 +5957,27 @@ static int niu_init_hw(struct niu *np)
5995 return err; 5957 return err;
5996 } 5958 }
5997 5959
5998 niudbg(IFUP, "%s: Initialize RX channels\n", np->dev->name); 5960 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize RX channels\n");
5999 err = niu_init_rx_channels(np); 5961 err = niu_init_rx_channels(np);
6000 if (err) 5962 if (err)
6001 goto out_uninit_tx_channels; 5963 goto out_uninit_tx_channels;
6002 5964
6003 niudbg(IFUP, "%s: Initialize classifier\n", np->dev->name); 5965 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize classifier\n");
6004 err = niu_init_classifier_hw(np); 5966 err = niu_init_classifier_hw(np);
6005 if (err) 5967 if (err)
6006 goto out_uninit_rx_channels; 5968 goto out_uninit_rx_channels;
6007 5969
6008 niudbg(IFUP, "%s: Initialize ZCP\n", np->dev->name); 5970 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize ZCP\n");
6009 err = niu_init_zcp(np); 5971 err = niu_init_zcp(np);
6010 if (err) 5972 if (err)
6011 goto out_uninit_rx_channels; 5973 goto out_uninit_rx_channels;
6012 5974
6013 niudbg(IFUP, "%s: Initialize IPP\n", np->dev->name); 5975 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize IPP\n");
6014 err = niu_init_ipp(np); 5976 err = niu_init_ipp(np);
6015 if (err) 5977 if (err)
6016 goto out_uninit_rx_channels; 5978 goto out_uninit_rx_channels;
6017 5979
6018 niudbg(IFUP, "%s: Initialize MAC\n", np->dev->name); 5980 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize MAC\n");
6019 err = niu_init_mac(np); 5981 err = niu_init_mac(np);
6020 if (err) 5982 if (err)
6021 goto out_uninit_ipp; 5983 goto out_uninit_ipp;
@@ -6023,16 +5985,16 @@ static int niu_init_hw(struct niu *np)
6023 return 0; 5985 return 0;
6024 5986
6025out_uninit_ipp: 5987out_uninit_ipp:
6026 niudbg(IFUP, "%s: Uninit IPP\n", np->dev->name); 5988 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit IPP\n");
6027 niu_disable_ipp(np); 5989 niu_disable_ipp(np);
6028 5990
6029out_uninit_rx_channels: 5991out_uninit_rx_channels:
6030 niudbg(IFUP, "%s: Uninit RX channels\n", np->dev->name); 5992 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit RX channels\n");
6031 niu_stop_rx_channels(np); 5993 niu_stop_rx_channels(np);
6032 niu_reset_rx_channels(np); 5994 niu_reset_rx_channels(np);
6033 5995
6034out_uninit_tx_channels: 5996out_uninit_tx_channels:
6035 niudbg(IFUP, "%s: Uninit TX channels\n", np->dev->name); 5997 netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit TX channels\n");
6036 niu_stop_tx_channels(np); 5998 niu_stop_tx_channels(np);
6037 niu_reset_tx_channels(np); 5999 niu_reset_tx_channels(np);
6038 6000
@@ -6041,25 +6003,25 @@ out_uninit_tx_channels:
6041 6003
6042static void niu_stop_hw(struct niu *np) 6004static void niu_stop_hw(struct niu *np)
6043{ 6005{
6044 niudbg(IFDOWN, "%s: Disable interrupts\n", np->dev->name); 6006 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable interrupts\n");
6045 niu_enable_interrupts(np, 0); 6007 niu_enable_interrupts(np, 0);
6046 6008
6047 niudbg(IFDOWN, "%s: Disable RX MAC\n", np->dev->name); 6009 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable RX MAC\n");
6048 niu_enable_rx_mac(np, 0); 6010 niu_enable_rx_mac(np, 0);
6049 6011
6050 niudbg(IFDOWN, "%s: Disable IPP\n", np->dev->name); 6012 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable IPP\n");
6051 niu_disable_ipp(np); 6013 niu_disable_ipp(np);
6052 6014
6053 niudbg(IFDOWN, "%s: Stop TX channels\n", np->dev->name); 6015 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop TX channels\n");
6054 niu_stop_tx_channels(np); 6016 niu_stop_tx_channels(np);
6055 6017
6056 niudbg(IFDOWN, "%s: Stop RX channels\n", np->dev->name); 6018 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop RX channels\n");
6057 niu_stop_rx_channels(np); 6019 niu_stop_rx_channels(np);
6058 6020
6059 niudbg(IFDOWN, "%s: Reset TX channels\n", np->dev->name); 6021 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset TX channels\n");
6060 niu_reset_tx_channels(np); 6022 niu_reset_tx_channels(np);
6061 6023
6062 niudbg(IFDOWN, "%s: Reset RX channels\n", np->dev->name); 6024 netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset RX channels\n");
6063 niu_reset_rx_channels(np); 6025 niu_reset_rx_channels(np);
6064} 6026}
6065 6027
@@ -6384,14 +6346,12 @@ static void niu_set_rx_mode(struct net_device *dev)
6384 netdev_for_each_uc_addr(ha, dev) { 6346 netdev_for_each_uc_addr(ha, dev) {
6385 err = niu_set_alt_mac(np, index, ha->addr); 6347 err = niu_set_alt_mac(np, index, ha->addr);
6386 if (err) 6348 if (err)
6387 printk(KERN_WARNING PFX "%s: Error %d " 6349 netdev_warn(dev, "Error %d adding alt mac %d\n",
6388 "adding alt mac %d\n", 6350 err, index);
6389 dev->name, err, index);
6390 err = niu_enable_alt_mac(np, index, 1); 6351 err = niu_enable_alt_mac(np, index, 1);
6391 if (err) 6352 if (err)
6392 printk(KERN_WARNING PFX "%s: Error %d " 6353 netdev_warn(dev, "Error %d enabling alt mac %d\n",
6393 "enabling alt mac %d\n", 6354 err, index);
6394 dev->name, err, index);
6395 6355
6396 index++; 6356 index++;
6397 } 6357 }
@@ -6404,9 +6364,8 @@ static void niu_set_rx_mode(struct net_device *dev)
6404 for (i = alt_start; i < niu_num_alt_addr(np); i++) { 6364 for (i = alt_start; i < niu_num_alt_addr(np); i++) {
6405 err = niu_enable_alt_mac(np, i, 0); 6365 err = niu_enable_alt_mac(np, i, 0);
6406 if (err) 6366 if (err)
6407 printk(KERN_WARNING PFX "%s: Error %d " 6367 netdev_warn(dev, "Error %d disabling alt mac %d\n",
6408 "disabling alt mac %d\n", 6368 err, i);
6409 dev->name, err, i);
6410 } 6369 }
6411 } 6370 }
6412 if (dev->flags & IFF_ALLMULTI) { 6371 if (dev->flags & IFF_ALLMULTI) {
@@ -6570,7 +6529,7 @@ static void niu_tx_timeout(struct net_device *dev)
6570{ 6529{
6571 struct niu *np = netdev_priv(dev); 6530 struct niu *np = netdev_priv(dev);
6572 6531
6573 dev_err(np->device, PFX "%s: Transmit timed out, resetting\n", 6532 dev_err(np->device, "%s: Transmit timed out, resetting\n",
6574 dev->name); 6533 dev->name);
6575 6534
6576 schedule_work(&np->reset_task); 6535 schedule_work(&np->reset_task);
@@ -6672,8 +6631,7 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb,
6672 6631
6673 if (niu_tx_avail(rp) <= (skb_shinfo(skb)->nr_frags + 1)) { 6632 if (niu_tx_avail(rp) <= (skb_shinfo(skb)->nr_frags + 1)) {
6674 netif_tx_stop_queue(txq); 6633 netif_tx_stop_queue(txq);
6675 dev_err(np->device, PFX "%s: BUG! Tx ring full when " 6634 dev_err(np->device, "%s: BUG! Tx ring full when queue awake!\n", dev->name);
6676 "queue awake!\n", dev->name);
6677 rp->tx_errors++; 6635 rp->tx_errors++;
6678 return NETDEV_TX_BUSY; 6636 return NETDEV_TX_BUSY;
6679 } 6637 }
@@ -7237,8 +7195,8 @@ static int niu_get_ethtool_tcam_entry(struct niu *np,
7237 7195
7238 tp = &parent->tcam[idx]; 7196 tp = &parent->tcam[idx];
7239 if (!tp->valid) { 7197 if (!tp->valid) {
7240 pr_info(PFX "niu%d: %s entry [%d] invalid for idx[%d]\n", 7198 netdev_info(np->dev, "niu%d: entry [%d] invalid for idx[%d]\n",
7241 parent->index, np->dev->name, (u16)nfc->fs.location, idx); 7199 parent->index, (u16)nfc->fs.location, idx);
7242 return -EINVAL; 7200 return -EINVAL;
7243 } 7201 }
7244 7202
@@ -7248,8 +7206,8 @@ static int niu_get_ethtool_tcam_entry(struct niu *np,
7248 ret = niu_class_to_ethflow(class, &fsp->flow_type); 7206 ret = niu_class_to_ethflow(class, &fsp->flow_type);
7249 7207
7250 if (ret < 0) { 7208 if (ret < 0) {
7251 pr_info(PFX "niu%d: %s niu_class_to_ethflow failed\n", 7209 netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n",
7252 parent->index, np->dev->name); 7210 parent->index);
7253 ret = -EINVAL; 7211 ret = -EINVAL;
7254 goto out; 7212 goto out;
7255 } 7213 }
@@ -7332,9 +7290,8 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
7332 7290
7333 if (n_entries != cnt) { 7291 if (n_entries != cnt) {
7334 /* print warning, this should not happen */ 7292 /* print warning, this should not happen */
7335 pr_info(PFX "niu%d: %s In niu_get_ethtool_tcam_all, " 7293 netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n",
7336 "n_entries[%d] != cnt[%d]!!!\n\n", 7294 np->parent->index, __func__, n_entries, cnt);
7337 np->parent->index, np->dev->name, n_entries, cnt);
7338 } 7295 }
7339 7296
7340 return 0; 7297 return 0;
@@ -7561,9 +7518,8 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7561 } 7518 }
7562 } 7519 }
7563 if (!add_usr_cls) { 7520 if (!add_usr_cls) {
7564 pr_info(PFX "niu%d: %s niu_add_ethtool_tcam_entry: " 7521 netdev_info(np->dev, "niu%d: %s(): Could not find/insert class for pid %d\n",
7565 "Could not find/insert class for pid %d\n", 7522 parent->index, __func__, uspec->proto);
7566 parent->index, np->dev->name, uspec->proto);
7567 ret = -EINVAL; 7523 ret = -EINVAL;
7568 goto out; 7524 goto out;
7569 } 7525 }
@@ -7596,9 +7552,8 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7596 case AH_V6_FLOW: 7552 case AH_V6_FLOW:
7597 case ESP_V6_FLOW: 7553 case ESP_V6_FLOW:
7598 /* Not yet implemented */ 7554 /* Not yet implemented */
7599 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7555 netdev_info(np->dev, "niu%d: In %s(): flow %d for IPv6 not implemented\n",
7600 "flow %d for IPv6 not implemented\n\n", 7556 parent->index, __func__, fsp->flow_type);
7601 parent->index, np->dev->name, fsp->flow_type);
7602 ret = -EINVAL; 7557 ret = -EINVAL;
7603 goto out; 7558 goto out;
7604 case IP_USER_FLOW: 7559 case IP_USER_FLOW:
@@ -7607,17 +7562,15 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7607 class); 7562 class);
7608 } else { 7563 } else {
7609 /* Not yet implemented */ 7564 /* Not yet implemented */
7610 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7565 netdev_info(np->dev, "niu%d: In %s(): usr flow for IPv6 not implemented\n",
7611 "usr flow for IPv6 not implemented\n\n", 7566 parent->index, __func__);
7612 parent->index, np->dev->name);
7613 ret = -EINVAL; 7567 ret = -EINVAL;
7614 goto out; 7568 goto out;
7615 } 7569 }
7616 break; 7570 break;
7617 default: 7571 default:
7618 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7572 netdev_info(np->dev, "niu%d: In %s(): Unknown flow type %d\n",
7619 "Unknown flow type %d\n\n", 7573 parent->index, __func__, fsp->flow_type);
7620 parent->index, np->dev->name, fsp->flow_type);
7621 ret = -EINVAL; 7574 ret = -EINVAL;
7622 goto out; 7575 goto out;
7623 } 7576 }
@@ -7627,10 +7580,9 @@ static int niu_add_ethtool_tcam_entry(struct niu *np,
7627 tp->assoc_data = TCAM_ASSOCDATA_DISC; 7580 tp->assoc_data = TCAM_ASSOCDATA_DISC;
7628 } else { 7581 } else {
7629 if (fsp->ring_cookie >= np->num_rx_rings) { 7582 if (fsp->ring_cookie >= np->num_rx_rings) {
7630 pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " 7583 netdev_info(np->dev, "niu%d: In %s(): Invalid RX ring %lld\n",
7631 "Invalid RX ring %lld\n\n", 7584 parent->index, __func__,
7632 parent->index, np->dev->name, 7585 (long long)fsp->ring_cookie);
7633 (long long) fsp->ring_cookie);
7634 ret = -EINVAL; 7586 ret = -EINVAL;
7635 goto out; 7587 goto out;
7636 } 7588 }
@@ -7699,10 +7651,9 @@ static int niu_del_ethtool_tcam_entry(struct niu *np, u32 loc)
7699 } 7651 }
7700 } 7652 }
7701 if (i == NIU_L3_PROG_CLS) { 7653 if (i == NIU_L3_PROG_CLS) {
7702 pr_info(PFX "niu%d: %s In niu_del_ethtool_tcam_entry," 7654 netdev_info(np->dev, "niu%d: In %s(): Usr class 0x%llx not found\n",
7703 "Usr class 0x%llx not found \n", 7655 parent->index, __func__,
7704 parent->index, np->dev->name, 7656 (unsigned long long)class);
7705 (unsigned long long) class);
7706 ret = -EINVAL; 7657 ret = -EINVAL;
7707 goto out; 7658 goto out;
7708 } 7659 }
@@ -8001,9 +7952,7 @@ static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
8001 * won't get any interrupts and that's painful to debug. 7952 * won't get any interrupts and that's painful to debug.
8002 */ 7953 */
8003 if (nr64(LDG_NUM(ldn)) != ldg) { 7954 if (nr64(LDG_NUM(ldn)) != ldg) {
8004 dev_err(np->device, PFX "Port %u, mis-matched " 7955 dev_err(np->device, "Port %u, mis-matched LDG assignment for ldn %d, should be %d is %llu\n",
8005 "LDG assignment "
8006 "for ldn %d, should be %d is %llu\n",
8007 np->port, ldn, ldg, 7956 np->port, ldn, ldg,
8008 (unsigned long long) nr64(LDG_NUM(ldn))); 7957 (unsigned long long) nr64(LDG_NUM(ldn)));
8009 return -EINVAL; 7958 return -EINVAL;
@@ -8056,7 +8005,7 @@ static int __devinit niu_pci_eeprom_read(struct niu *np, u32 addr)
8056 break; 8005 break;
8057 } while (limit--); 8006 } while (limit--);
8058 if (!(frame & ESPC_PIO_STAT_READ_END)) { 8007 if (!(frame & ESPC_PIO_STAT_READ_END)) {
8059 dev_err(np->device, PFX "EEPROM read timeout frame[%llx]\n", 8008 dev_err(np->device, "EEPROM read timeout frame[%llx]\n",
8060 (unsigned long long) frame); 8009 (unsigned long long) frame);
8061 return -ENODEV; 8010 return -ENODEV;
8062 } 8011 }
@@ -8071,7 +8020,7 @@ static int __devinit niu_pci_eeprom_read(struct niu *np, u32 addr)
8071 break; 8020 break;
8072 } while (limit--); 8021 } while (limit--);
8073 if (!(frame & ESPC_PIO_STAT_READ_END)) { 8022 if (!(frame & ESPC_PIO_STAT_READ_END)) {
8074 dev_err(np->device, PFX "EEPROM read timeout frame[%llx]\n", 8023 dev_err(np->device, "EEPROM read timeout frame[%llx]\n",
8075 (unsigned long long) frame); 8024 (unsigned long long) frame);
8076 return -ENODEV; 8025 return -ENODEV;
8077 } 8026 }
@@ -8152,8 +8101,9 @@ static void __devinit niu_vpd_parse_version(struct niu *np)
8152 s += i + 5; 8101 s += i + 5;
8153 sscanf(s, "%d.%d", &vpd->fcode_major, &vpd->fcode_minor); 8102 sscanf(s, "%d.%d", &vpd->fcode_major, &vpd->fcode_minor);
8154 8103
8155 niudbg(PROBE, "VPD_SCAN: FCODE major(%d) minor(%d)\n", 8104 netif_printk(np, probe, KERN_DEBUG, np->dev,
8156 vpd->fcode_major, vpd->fcode_minor); 8105 "VPD_SCAN: FCODE major(%d) minor(%d)\n",
8106 vpd->fcode_major, vpd->fcode_minor);
8157 if (vpd->fcode_major > NIU_VPD_MIN_MAJOR || 8107 if (vpd->fcode_major > NIU_VPD_MIN_MAJOR ||
8158 (vpd->fcode_major == NIU_VPD_MIN_MAJOR && 8108 (vpd->fcode_major == NIU_VPD_MIN_MAJOR &&
8159 vpd->fcode_minor >= NIU_VPD_MIN_MINOR)) 8109 vpd->fcode_minor >= NIU_VPD_MIN_MINOR))
@@ -8173,8 +8123,8 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np,
8173#define FOUND_MASK_PHY 0x00000020 8123#define FOUND_MASK_PHY 0x00000020
8174#define FOUND_MASK_ALL 0x0000003f 8124#define FOUND_MASK_ALL 0x0000003f
8175 8125
8176 niudbg(PROBE, "VPD_SCAN: start[%x] end[%x]\n", 8126 netif_printk(np, probe, KERN_DEBUG, np->dev,
8177 start, end); 8127 "VPD_SCAN: start[%x] end[%x]\n", start, end);
8178 while (start < end) { 8128 while (start < end) {
8179 int len, err, instance, type, prop_len; 8129 int len, err, instance, type, prop_len;
8180 char namebuf[64]; 8130 char namebuf[64];
@@ -8228,8 +8178,7 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np,
8228 } 8178 }
8229 8179
8230 if (max_len && prop_len > max_len) { 8180 if (max_len && prop_len > max_len) {
8231 dev_err(np->device, PFX "Property '%s' length (%d) is " 8181 dev_err(np->device, "Property '%s' length (%d) is too long\n", namebuf, prop_len);
8232 "too long.\n", namebuf, prop_len);
8233 return -EINVAL; 8182 return -EINVAL;
8234 } 8183 }
8235 8184
@@ -8237,8 +8186,9 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np,
8237 u32 off = start + 5 + err; 8186 u32 off = start + 5 + err;
8238 int i; 8187 int i;
8239 8188
8240 niudbg(PROBE, "VPD_SCAN: Reading in property [%s] " 8189 netif_printk(np, probe, KERN_DEBUG, np->dev,
8241 "len[%d]\n", namebuf, prop_len); 8190 "VPD_SCAN: Reading in property [%s] len[%d]\n",
8191 namebuf, prop_len);
8242 for (i = 0; i < prop_len; i++) 8192 for (i = 0; i < prop_len; i++)
8243 *prop_buf++ = niu_pci_eeprom_read(np, off + i); 8193 *prop_buf++ = niu_pci_eeprom_read(np, off + i);
8244 } 8194 }
@@ -8402,8 +8352,7 @@ static void __devinit niu_pci_vpd_validate(struct niu *np)
8402 u8 val8; 8352 u8 val8;
8403 8353
8404 if (!is_valid_ether_addr(&vpd->local_mac[0])) { 8354 if (!is_valid_ether_addr(&vpd->local_mac[0])) {
8405 dev_err(np->device, PFX "VPD MAC invalid, " 8355 dev_err(np->device, "VPD MAC invalid, falling back to SPROM\n");
8406 "falling back to SPROM.\n");
8407 8356
8408 np->flags &= ~NIU_FLAGS_VPD_VALID; 8357 np->flags &= ~NIU_FLAGS_VPD_VALID;
8409 return; 8358 return;
@@ -8420,14 +8369,14 @@ static void __devinit niu_pci_vpd_validate(struct niu *np)
8420 np->flags &= ~NIU_FLAGS_10G; 8369 np->flags &= ~NIU_FLAGS_10G;
8421 } 8370 }
8422 if (np->flags & NIU_FLAGS_10G) 8371 if (np->flags & NIU_FLAGS_10G)
8423 np->mac_xcvr = MAC_XCVR_XPCS; 8372 np->mac_xcvr = MAC_XCVR_XPCS;
8424 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { 8373 } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) {
8425 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | 8374 np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER |
8426 NIU_FLAGS_HOTPLUG_PHY); 8375 NIU_FLAGS_HOTPLUG_PHY);
8427 } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { 8376 } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) {
8428 dev_err(np->device, PFX "Illegal phy string [%s].\n", 8377 dev_err(np->device, "Illegal phy string [%s]\n",
8429 np->vpd.phy_type); 8378 np->vpd.phy_type);
8430 dev_err(np->device, PFX "Falling back to SPROM.\n"); 8379 dev_err(np->device, "Falling back to SPROM\n");
8431 np->flags &= ~NIU_FLAGS_VPD_VALID; 8380 np->flags &= ~NIU_FLAGS_VPD_VALID;
8432 return; 8381 return;
8433 } 8382 }
@@ -8455,7 +8404,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8455 8404
8456 np->eeprom_len = len; 8405 np->eeprom_len = len;
8457 8406
8458 niudbg(PROBE, "SPROM: Image size %llu\n", (unsigned long long) val); 8407 netif_printk(np, probe, KERN_DEBUG, np->dev,
8408 "SPROM: Image size %llu\n", (unsigned long long)val);
8459 8409
8460 sum = 0; 8410 sum = 0;
8461 for (i = 0; i < len; i++) { 8411 for (i = 0; i < len; i++) {
@@ -8465,10 +8415,10 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8465 sum += (val >> 16) & 0xff; 8415 sum += (val >> 16) & 0xff;
8466 sum += (val >> 24) & 0xff; 8416 sum += (val >> 24) & 0xff;
8467 } 8417 }
8468 niudbg(PROBE, "SPROM: Checksum %x\n", (int)(sum & 0xff)); 8418 netif_printk(np, probe, KERN_DEBUG, np->dev,
8419 "SPROM: Checksum %x\n", (int)(sum & 0xff));
8469 if ((sum & 0xff) != 0xab) { 8420 if ((sum & 0xff) != 0xab) {
8470 dev_err(np->device, PFX "Bad SPROM checksum " 8421 dev_err(np->device, "Bad SPROM checksum (%x, should be 0xab)\n", (int)(sum & 0xff));
8471 "(%x, should be 0xab)\n", (int) (sum & 0xff));
8472 return -EINVAL; 8422 return -EINVAL;
8473 } 8423 }
8474 8424
@@ -8491,11 +8441,12 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8491 ESPC_PHY_TYPE_PORT3_SHIFT; 8441 ESPC_PHY_TYPE_PORT3_SHIFT;
8492 break; 8442 break;
8493 default: 8443 default:
8494 dev_err(np->device, PFX "Bogus port number %u\n", 8444 dev_err(np->device, "Bogus port number %u\n",
8495 np->port); 8445 np->port);
8496 return -EINVAL; 8446 return -EINVAL;
8497 } 8447 }
8498 niudbg(PROBE, "SPROM: PHY type %x\n", val8); 8448 netif_printk(np, probe, KERN_DEBUG, np->dev,
8449 "SPROM: PHY type %x\n", val8);
8499 8450
8500 switch (val8) { 8451 switch (val8) {
8501 case ESPC_PHY_TYPE_1G_COPPER: 8452 case ESPC_PHY_TYPE_1G_COPPER:
@@ -8527,30 +8478,27 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8527 break; 8478 break;
8528 8479
8529 default: 8480 default:
8530 dev_err(np->device, PFX "Bogus SPROM phy type %u\n", val8); 8481 dev_err(np->device, "Bogus SPROM phy type %u\n", val8);
8531 return -EINVAL; 8482 return -EINVAL;
8532 } 8483 }
8533 8484
8534 val = nr64(ESPC_MAC_ADDR0); 8485 val = nr64(ESPC_MAC_ADDR0);
8535 niudbg(PROBE, "SPROM: MAC_ADDR0[%08llx]\n", 8486 netif_printk(np, probe, KERN_DEBUG, np->dev,
8536 (unsigned long long) val); 8487 "SPROM: MAC_ADDR0[%08llx]\n", (unsigned long long)val);
8537 dev->perm_addr[0] = (val >> 0) & 0xff; 8488 dev->perm_addr[0] = (val >> 0) & 0xff;
8538 dev->perm_addr[1] = (val >> 8) & 0xff; 8489 dev->perm_addr[1] = (val >> 8) & 0xff;
8539 dev->perm_addr[2] = (val >> 16) & 0xff; 8490 dev->perm_addr[2] = (val >> 16) & 0xff;
8540 dev->perm_addr[3] = (val >> 24) & 0xff; 8491 dev->perm_addr[3] = (val >> 24) & 0xff;
8541 8492
8542 val = nr64(ESPC_MAC_ADDR1); 8493 val = nr64(ESPC_MAC_ADDR1);
8543 niudbg(PROBE, "SPROM: MAC_ADDR1[%08llx]\n", 8494 netif_printk(np, probe, KERN_DEBUG, np->dev,
8544 (unsigned long long) val); 8495 "SPROM: MAC_ADDR1[%08llx]\n", (unsigned long long)val);
8545 dev->perm_addr[4] = (val >> 0) & 0xff; 8496 dev->perm_addr[4] = (val >> 0) & 0xff;
8546 dev->perm_addr[5] = (val >> 8) & 0xff; 8497 dev->perm_addr[5] = (val >> 8) & 0xff;
8547 8498
8548 if (!is_valid_ether_addr(&dev->perm_addr[0])) { 8499 if (!is_valid_ether_addr(&dev->perm_addr[0])) {
8549 dev_err(np->device, PFX "SPROM MAC address invalid\n"); 8500 dev_err(np->device, "SPROM MAC address invalid [ %pM ]\n",
8550 dev_err(np->device, PFX "[ \n"); 8501 dev->perm_addr);
8551 for (i = 0; i < 6; i++)
8552 printk("%02x ", dev->perm_addr[i]);
8553 printk("]\n");
8554 return -EINVAL; 8502 return -EINVAL;
8555 } 8503 }
8556 8504
@@ -8562,8 +8510,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8562 memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len); 8510 memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len);
8563 8511
8564 val = nr64(ESPC_MOD_STR_LEN); 8512 val = nr64(ESPC_MOD_STR_LEN);
8565 niudbg(PROBE, "SPROM: MOD_STR_LEN[%llu]\n", 8513 netif_printk(np, probe, KERN_DEBUG, np->dev,
8566 (unsigned long long) val); 8514 "SPROM: MOD_STR_LEN[%llu]\n", (unsigned long long)val);
8567 if (val >= 8 * 4) 8515 if (val >= 8 * 4)
8568 return -EINVAL; 8516 return -EINVAL;
8569 8517
@@ -8578,8 +8526,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8578 np->vpd.model[val] = '\0'; 8526 np->vpd.model[val] = '\0';
8579 8527
8580 val = nr64(ESPC_BD_MOD_STR_LEN); 8528 val = nr64(ESPC_BD_MOD_STR_LEN);
8581 niudbg(PROBE, "SPROM: BD_MOD_STR_LEN[%llu]\n", 8529 netif_printk(np, probe, KERN_DEBUG, np->dev,
8582 (unsigned long long) val); 8530 "SPROM: BD_MOD_STR_LEN[%llu]\n", (unsigned long long)val);
8583 if (val >= 4 * 4) 8531 if (val >= 4 * 4)
8584 return -EINVAL; 8532 return -EINVAL;
8585 8533
@@ -8595,8 +8543,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
8595 8543
8596 np->vpd.mac_num = 8544 np->vpd.mac_num =
8597 nr64(ESPC_NUM_PORTS_MACS) & ESPC_NUM_PORTS_MACS_VAL; 8545 nr64(ESPC_NUM_PORTS_MACS) & ESPC_NUM_PORTS_MACS_VAL;
8598 niudbg(PROBE, "SPROM: NUM_PORTS_MACS[%d]\n", 8546 netif_printk(np, probe, KERN_DEBUG, np->dev,
8599 np->vpd.mac_num); 8547 "SPROM: NUM_PORTS_MACS[%d]\n", np->vpd.mac_num);
8600 8548
8601 return 0; 8549 return 0;
8602} 8550}
@@ -8629,8 +8577,9 @@ static int __devinit niu_get_and_validate_port(struct niu *np)
8629 } 8577 }
8630 } 8578 }
8631 8579
8632 niudbg(PROBE, "niu_get_and_validate_port: port[%d] num_ports[%d]\n", 8580 netif_printk(np, probe, KERN_DEBUG, np->dev,
8633 np->port, parent->num_ports); 8581 "%s() port[%d] num_ports[%d]\n",
8582 __func__, np->port, parent->num_ports);
8634 if (np->port >= parent->num_ports) 8583 if (np->port >= parent->num_ports)
8635 return -ENODEV; 8584 return -ENODEV;
8636 8585
@@ -8659,14 +8608,12 @@ static int __devinit phy_record(struct niu_parent *parent,
8659 8608
8660 pr_info("niu%d: Found PHY %08x type %s at phy_port %u\n", 8609 pr_info("niu%d: Found PHY %08x type %s at phy_port %u\n",
8661 parent->index, id, 8610 parent->index, id,
8662 (type == PHY_TYPE_PMA_PMD ? 8611 type == PHY_TYPE_PMA_PMD ? "PMA/PMD" :
8663 "PMA/PMD" : 8612 type == PHY_TYPE_PCS ? "PCS" : "MII",
8664 (type == PHY_TYPE_PCS ?
8665 "PCS" : "MII")),
8666 phy_port); 8613 phy_port);
8667 8614
8668 if (p->cur[type] >= NIU_MAX_PORTS) { 8615 if (p->cur[type] >= NIU_MAX_PORTS) {
8669 printk(KERN_ERR PFX "Too many PHY ports.\n"); 8616 pr_err("Too many PHY ports\n");
8670 return -EINVAL; 8617 return -EINVAL;
8671 } 8618 }
8672 idx = p->cur[type]; 8619 idx = p->cur[type];
@@ -8727,8 +8674,7 @@ static void __devinit niu_n2_divide_channels(struct niu_parent *parent)
8727 parent->rxchan_per_port[i] = (16 / num_ports); 8674 parent->rxchan_per_port[i] = (16 / num_ports);
8728 parent->txchan_per_port[i] = (16 / num_ports); 8675 parent->txchan_per_port[i] = (16 / num_ports);
8729 8676
8730 pr_info(PFX "niu%d: Port %u [%u RX chans] " 8677 pr_info("niu%d: Port %u [%u RX chans] [%u TX chans]\n",
8731 "[%u TX chans]\n",
8732 parent->index, i, 8678 parent->index, i,
8733 parent->rxchan_per_port[i], 8679 parent->rxchan_per_port[i],
8734 parent->txchan_per_port[i]); 8680 parent->txchan_per_port[i]);
@@ -8771,8 +8717,7 @@ static void __devinit niu_divide_channels(struct niu_parent *parent,
8771 parent->rxchan_per_port[i] = rx_chans_per_1g; 8717 parent->rxchan_per_port[i] = rx_chans_per_1g;
8772 parent->txchan_per_port[i] = tx_chans_per_1g; 8718 parent->txchan_per_port[i] = tx_chans_per_1g;
8773 } 8719 }
8774 pr_info(PFX "niu%d: Port %u [%u RX chans] " 8720 pr_info("niu%d: Port %u [%u RX chans] [%u TX chans]\n",
8775 "[%u TX chans]\n",
8776 parent->index, i, 8721 parent->index, i,
8777 parent->rxchan_per_port[i], 8722 parent->rxchan_per_port[i],
8778 parent->txchan_per_port[i]); 8723 parent->txchan_per_port[i]);
@@ -8781,23 +8726,20 @@ static void __devinit niu_divide_channels(struct niu_parent *parent,
8781 } 8726 }
8782 8727
8783 if (tot_rx > NIU_NUM_RXCHAN) { 8728 if (tot_rx > NIU_NUM_RXCHAN) {
8784 printk(KERN_ERR PFX "niu%d: Too many RX channels (%d), " 8729 pr_err("niu%d: Too many RX channels (%d), resetting to one per port\n",
8785 "resetting to one per port.\n",
8786 parent->index, tot_rx); 8730 parent->index, tot_rx);
8787 for (i = 0; i < num_ports; i++) 8731 for (i = 0; i < num_ports; i++)
8788 parent->rxchan_per_port[i] = 1; 8732 parent->rxchan_per_port[i] = 1;
8789 } 8733 }
8790 if (tot_tx > NIU_NUM_TXCHAN) { 8734 if (tot_tx > NIU_NUM_TXCHAN) {
8791 printk(KERN_ERR PFX "niu%d: Too many TX channels (%d), " 8735 pr_err("niu%d: Too many TX channels (%d), resetting to one per port\n",
8792 "resetting to one per port.\n",
8793 parent->index, tot_tx); 8736 parent->index, tot_tx);
8794 for (i = 0; i < num_ports; i++) 8737 for (i = 0; i < num_ports; i++)
8795 parent->txchan_per_port[i] = 1; 8738 parent->txchan_per_port[i] = 1;
8796 } 8739 }
8797 if (tot_rx < NIU_NUM_RXCHAN || tot_tx < NIU_NUM_TXCHAN) { 8740 if (tot_rx < NIU_NUM_RXCHAN || tot_tx < NIU_NUM_TXCHAN) {
8798 printk(KERN_WARNING PFX "niu%d: Driver bug, wasted channels, " 8741 pr_warning("niu%d: Driver bug, wasted channels, RX[%d] TX[%d]\n",
8799 "RX[%d] TX[%d]\n", 8742 parent->index, tot_rx, tot_tx);
8800 parent->index, tot_rx, tot_tx);
8801 } 8743 }
8802} 8744}
8803 8745
@@ -8825,18 +8767,18 @@ static void __devinit niu_divide_rdc_groups(struct niu_parent *parent,
8825 struct rdc_table *rt = &tp->tables[grp]; 8767 struct rdc_table *rt = &tp->tables[grp];
8826 int slot; 8768 int slot;
8827 8769
8828 pr_info(PFX "niu%d: Port %d RDC tbl(%d) [ ", 8770 pr_info("niu%d: Port %d RDC tbl(%d) [ ",
8829 parent->index, i, tp->first_table_num + grp); 8771 parent->index, i, tp->first_table_num + grp);
8830 for (slot = 0; slot < NIU_RDC_TABLE_SLOTS; slot++) { 8772 for (slot = 0; slot < NIU_RDC_TABLE_SLOTS; slot++) {
8831 rt->rxdma_channel[slot] = 8773 rt->rxdma_channel[slot] =
8832 rdc_channel_base + this_channel_offset; 8774 rdc_channel_base + this_channel_offset;
8833 8775
8834 printk("%d ", rt->rxdma_channel[slot]); 8776 pr_cont("%d ", rt->rxdma_channel[slot]);
8835 8777
8836 if (++this_channel_offset == num_channels) 8778 if (++this_channel_offset == num_channels)
8837 this_channel_offset = 0; 8779 this_channel_offset = 0;
8838 } 8780 }
8839 printk("]\n"); 8781 pr_cont("]\n");
8840 } 8782 }
8841 8783
8842 parent->rdc_default[i] = rdc_channel_base; 8784 parent->rdc_default[i] = rdc_channel_base;
@@ -8996,8 +8938,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
8996 break; 8938 break;
8997 8939
8998 default: 8940 default:
8999 printk(KERN_ERR PFX "Unsupported port config " 8941 pr_err("Unsupported port config 10G[%d] 1G[%d]\n",
9000 "10G[%d] 1G[%d]\n",
9001 num_10g, num_1g); 8942 num_10g, num_1g);
9002 return -EINVAL; 8943 return -EINVAL;
9003 } 8944 }
@@ -9015,8 +8956,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
9015 return 0; 8956 return 0;
9016 8957
9017unknown_vg_1g_port: 8958unknown_vg_1g_port:
9018 printk(KERN_ERR PFX "Cannot identify platform type, 1gport=%d\n", 8959 pr_err("Cannot identify platform type, 1gport=%d\n", lowest_1g);
9019 lowest_1g);
9020 return -EINVAL; 8960 return -EINVAL;
9021} 8961}
9022 8962
@@ -9025,8 +8965,8 @@ static int __devinit niu_probe_ports(struct niu *np)
9025 struct niu_parent *parent = np->parent; 8965 struct niu_parent *parent = np->parent;
9026 int err, i; 8966 int err, i;
9027 8967
9028 niudbg(PROBE, "niu_probe_ports(): port_phy[%08x]\n", 8968 netif_printk(np, probe, KERN_DEBUG, np->dev,
9029 parent->port_phy); 8969 "%s() port_phy[%08x]\n", __func__, parent->port_phy);
9030 8970
9031 if (parent->port_phy == PORT_PHY_UNKNOWN) { 8971 if (parent->port_phy == PORT_PHY_UNKNOWN) {
9032 err = walk_phys(np, parent); 8972 err = walk_phys(np, parent);
@@ -9048,8 +8988,9 @@ static int __devinit niu_classifier_swstate_init(struct niu *np)
9048{ 8988{
9049 struct niu_classifier *cp = &np->clas; 8989 struct niu_classifier *cp = &np->clas;
9050 8990
9051 niudbg(PROBE, "niu_classifier_swstate_init: num_tcam(%d)\n", 8991 netif_printk(np, probe, KERN_DEBUG, np->dev,
9052 np->parent->tcam_num_entries); 8992 "%s() num_tcam(%d)\n",
8993 __func__, np->parent->tcam_num_entries);
9053 8994
9054 cp->tcam_top = (u16) np->port; 8995 cp->tcam_top = (u16) np->port;
9055 cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports; 8996 cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports;
@@ -9116,8 +9057,7 @@ static int __devinit niu_init_mac_ipp_pcs_base(struct niu *np)
9116 break; 9057 break;
9117 9058
9118 default: 9059 default:
9119 dev_err(np->device, PFX "Port %u is invalid, cannot " 9060 dev_err(np->device, "Port %u is invalid, cannot compute MAC block offset\n", np->port);
9120 "compute MAC block offset.\n", np->port);
9121 return -EINVAL; 9061 return -EINVAL;
9122 } 9062 }
9123 9063
@@ -9327,9 +9267,8 @@ static int __devinit niu_get_of_props(struct niu *np)
9327 9267
9328 phy_type = of_get_property(dp, "phy-type", &prop_len); 9268 phy_type = of_get_property(dp, "phy-type", &prop_len);
9329 if (!phy_type) { 9269 if (!phy_type) {
9330 dev_err(np->device, PFX "%s: OF node lacks " 9270 netdev_err(dev, "%s: OF node lacks phy-type property\n",
9331 "phy-type property\n", 9271 dp->full_name);
9332 dp->full_name);
9333 return -EINVAL; 9272 return -EINVAL;
9334 } 9273 }
9335 9274
@@ -9339,34 +9278,26 @@ static int __devinit niu_get_of_props(struct niu *np)
9339 strcpy(np->vpd.phy_type, phy_type); 9278 strcpy(np->vpd.phy_type, phy_type);
9340 9279
9341 if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { 9280 if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) {
9342 dev_err(np->device, PFX "%s: Illegal phy string [%s].\n", 9281 netdev_err(dev, "%s: Illegal phy string [%s]\n",
9343 dp->full_name, np->vpd.phy_type); 9282 dp->full_name, np->vpd.phy_type);
9344 return -EINVAL; 9283 return -EINVAL;
9345 } 9284 }
9346 9285
9347 mac_addr = of_get_property(dp, "local-mac-address", &prop_len); 9286 mac_addr = of_get_property(dp, "local-mac-address", &prop_len);
9348 if (!mac_addr) { 9287 if (!mac_addr) {
9349 dev_err(np->device, PFX "%s: OF node lacks " 9288 netdev_err(dev, "%s: OF node lacks local-mac-address property\n",
9350 "local-mac-address property\n", 9289 dp->full_name);
9351 dp->full_name);
9352 return -EINVAL; 9290 return -EINVAL;
9353 } 9291 }
9354 if (prop_len != dev->addr_len) { 9292 if (prop_len != dev->addr_len) {
9355 dev_err(np->device, PFX "%s: OF MAC address prop len (%d) " 9293 netdev_err(dev, "%s: OF MAC address prop len (%d) is wrong\n",
9356 "is wrong.\n", 9294 dp->full_name, prop_len);
9357 dp->full_name, prop_len);
9358 } 9295 }
9359 memcpy(dev->perm_addr, mac_addr, dev->addr_len); 9296 memcpy(dev->perm_addr, mac_addr, dev->addr_len);
9360 if (!is_valid_ether_addr(&dev->perm_addr[0])) { 9297 if (!is_valid_ether_addr(&dev->perm_addr[0])) {
9361 int i; 9298 netdev_err(dev, "%s: OF MAC address is invalid\n",
9362 9299 dp->full_name);
9363 dev_err(np->device, PFX "%s: OF MAC address is invalid\n", 9300 netdev_err(dev, "%s: [ %pM ]\n", dp->full_name, dev->perm_addr);
9364 dp->full_name);
9365 dev_err(np->device, PFX "%s: [ \n",
9366 dp->full_name);
9367 for (i = 0; i < 6; i++)
9368 printk("%02x ", dev->perm_addr[i]);
9369 printk("]\n");
9370 return -EINVAL; 9301 return -EINVAL;
9371 } 9302 }
9372 9303
@@ -9414,8 +9345,8 @@ static int __devinit niu_get_invariants(struct niu *np)
9414 9345
9415 nw64(ESPC_PIO_EN, ESPC_PIO_EN_ENABLE); 9346 nw64(ESPC_PIO_EN, ESPC_PIO_EN_ENABLE);
9416 offset = niu_pci_vpd_offset(np); 9347 offset = niu_pci_vpd_offset(np);
9417 niudbg(PROBE, "niu_get_invariants: VPD offset [%08x]\n", 9348 netif_printk(np, probe, KERN_DEBUG, np->dev,
9418 offset); 9349 "%s() VPD offset [%08x]\n", __func__, offset);
9419 if (offset) 9350 if (offset)
9420 niu_pci_vpd_fetch(np, offset); 9351 niu_pci_vpd_fetch(np, offset);
9421 nw64(ESPC_PIO_EN, 0); 9352 nw64(ESPC_PIO_EN, 0);
@@ -9575,7 +9506,8 @@ static struct niu_parent * __devinit niu_new_parent(struct niu *np,
9575 struct niu_parent *p; 9506 struct niu_parent *p;
9576 int i; 9507 int i;
9577 9508
9578 niudbg(PROBE, "niu_new_parent: Creating new parent.\n"); 9509 netif_printk(np, probe, KERN_DEBUG, np->dev,
9510 "%s() Creating new parent\n", __func__);
9579 9511
9580 plat_dev = platform_device_register_simple("niu", niu_parent_index, 9512 plat_dev = platform_device_register_simple("niu", niu_parent_index,
9581 NULL, 0); 9513 NULL, 0);
@@ -9641,8 +9573,9 @@ static struct niu_parent * __devinit niu_get_parent(struct niu *np,
9641 struct niu_parent *p, *tmp; 9573 struct niu_parent *p, *tmp;
9642 int port = np->port; 9574 int port = np->port;
9643 9575
9644 niudbg(PROBE, "niu_get_parent: platform_type[%u] port[%u]\n", 9576 netif_printk(np, probe, KERN_DEBUG, np->dev,
9645 ptype, port); 9577 "%s() platform_type[%u] port[%u]\n",
9578 __func__, ptype, port);
9646 9579
9647 mutex_lock(&niu_parent_lock); 9580 mutex_lock(&niu_parent_lock);
9648 p = NULL; 9581 p = NULL;
@@ -9681,7 +9614,8 @@ static void niu_put_parent(struct niu *np)
9681 9614
9682 BUG_ON(!p || p->ports[port] != np); 9615 BUG_ON(!p || p->ports[port] != np);
9683 9616
9684 niudbg(PROBE, "niu_put_parent: port[%u]\n", port); 9617 netif_printk(np, probe, KERN_DEBUG, np->dev,
9618 "%s() port[%u]\n", __func__, port);
9685 9619
9686 sprintf(port_name, "port%d", port); 9620 sprintf(port_name, "port%d", port);
9687 9621
@@ -9772,7 +9706,7 @@ static struct net_device * __devinit niu_alloc_and_init(
9772 9706
9773 dev = alloc_etherdev_mq(sizeof(struct niu), NIU_NUM_TXCHAN); 9707 dev = alloc_etherdev_mq(sizeof(struct niu), NIU_NUM_TXCHAN);
9774 if (!dev) { 9708 if (!dev) {
9775 dev_err(gen_dev, PFX "Etherdev alloc failed, aborting.\n"); 9709 dev_err(gen_dev, "Etherdev alloc failed, aborting\n");
9776 return NULL; 9710 return NULL;
9777 } 9711 }
9778 9712
@@ -9858,30 +9792,26 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9858 9792
9859 err = pci_enable_device(pdev); 9793 err = pci_enable_device(pdev);
9860 if (err) { 9794 if (err) {
9861 dev_err(&pdev->dev, PFX "Cannot enable PCI device, " 9795 dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n");
9862 "aborting.\n");
9863 return err; 9796 return err;
9864 } 9797 }
9865 9798
9866 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) || 9799 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
9867 !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { 9800 !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
9868 dev_err(&pdev->dev, PFX "Cannot find proper PCI device " 9801 dev_err(&pdev->dev, "Cannot find proper PCI device base addresses, aborting\n");
9869 "base addresses, aborting.\n");
9870 err = -ENODEV; 9802 err = -ENODEV;
9871 goto err_out_disable_pdev; 9803 goto err_out_disable_pdev;
9872 } 9804 }
9873 9805
9874 err = pci_request_regions(pdev, DRV_MODULE_NAME); 9806 err = pci_request_regions(pdev, DRV_MODULE_NAME);
9875 if (err) { 9807 if (err) {
9876 dev_err(&pdev->dev, PFX "Cannot obtain PCI resources, " 9808 dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
9877 "aborting.\n");
9878 goto err_out_disable_pdev; 9809 goto err_out_disable_pdev;
9879 } 9810 }
9880 9811
9881 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); 9812 pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
9882 if (pos <= 0) { 9813 if (pos <= 0) {
9883 dev_err(&pdev->dev, PFX "Cannot find PCI Express capability, " 9814 dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n");
9884 "aborting.\n");
9885 goto err_out_free_res; 9815 goto err_out_free_res;
9886 } 9816 }
9887 9817
@@ -9920,17 +9850,14 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9920 dev->features |= NETIF_F_HIGHDMA; 9850 dev->features |= NETIF_F_HIGHDMA;
9921 err = pci_set_consistent_dma_mask(pdev, dma_mask); 9851 err = pci_set_consistent_dma_mask(pdev, dma_mask);
9922 if (err) { 9852 if (err) {
9923 dev_err(&pdev->dev, PFX "Unable to obtain 44 bit " 9853 dev_err(&pdev->dev, "Unable to obtain 44 bit DMA for consistent allocations, aborting\n");
9924 "DMA for consistent allocations, "
9925 "aborting.\n");
9926 goto err_out_release_parent; 9854 goto err_out_release_parent;
9927 } 9855 }
9928 } 9856 }
9929 if (err || dma_mask == DMA_BIT_MASK(32)) { 9857 if (err || dma_mask == DMA_BIT_MASK(32)) {
9930 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 9858 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
9931 if (err) { 9859 if (err) {
9932 dev_err(&pdev->dev, PFX "No usable DMA configuration, " 9860 dev_err(&pdev->dev, "No usable DMA configuration, aborting\n");
9933 "aborting.\n");
9934 goto err_out_release_parent; 9861 goto err_out_release_parent;
9935 } 9862 }
9936 } 9863 }
@@ -9939,8 +9866,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9939 9866
9940 np->regs = pci_ioremap_bar(pdev, 0); 9867 np->regs = pci_ioremap_bar(pdev, 0);
9941 if (!np->regs) { 9868 if (!np->regs) {
9942 dev_err(&pdev->dev, PFX "Cannot map device registers, " 9869 dev_err(&pdev->dev, "Cannot map device registers, aborting\n");
9943 "aborting.\n");
9944 err = -ENOMEM; 9870 err = -ENOMEM;
9945 goto err_out_release_parent; 9871 goto err_out_release_parent;
9946 } 9872 }
@@ -9955,15 +9881,13 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9955 err = niu_get_invariants(np); 9881 err = niu_get_invariants(np);
9956 if (err) { 9882 if (err) {
9957 if (err != -ENODEV) 9883 if (err != -ENODEV)
9958 dev_err(&pdev->dev, PFX "Problem fetching invariants " 9884 dev_err(&pdev->dev, "Problem fetching invariants of chip, aborting\n");
9959 "of chip, aborting.\n");
9960 goto err_out_iounmap; 9885 goto err_out_iounmap;
9961 } 9886 }
9962 9887
9963 err = register_netdev(dev); 9888 err = register_netdev(dev);
9964 if (err) { 9889 if (err) {
9965 dev_err(&pdev->dev, PFX "Cannot register net device, " 9890 dev_err(&pdev->dev, "Cannot register net device, aborting\n");
9966 "aborting.\n");
9967 goto err_out_iounmap; 9891 goto err_out_iounmap;
9968 } 9892 }
9969 9893
@@ -10157,7 +10081,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10157 10081
10158 reg = of_get_property(op->node, "reg", NULL); 10082 reg = of_get_property(op->node, "reg", NULL);
10159 if (!reg) { 10083 if (!reg) {
10160 dev_err(&op->dev, PFX "%s: No 'reg' property, aborting.\n", 10084 dev_err(&op->dev, "%s: No 'reg' property, aborting\n",
10161 op->node->full_name); 10085 op->node->full_name);
10162 return -ENODEV; 10086 return -ENODEV;
10163 } 10087 }
@@ -10186,8 +10110,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10186 resource_size(&op->resource[1]), 10110 resource_size(&op->resource[1]),
10187 "niu regs"); 10111 "niu regs");
10188 if (!np->regs) { 10112 if (!np->regs) {
10189 dev_err(&op->dev, PFX "Cannot map device registers, " 10113 dev_err(&op->dev, "Cannot map device registers, aborting\n");
10190 "aborting.\n");
10191 err = -ENOMEM; 10114 err = -ENOMEM;
10192 goto err_out_release_parent; 10115 goto err_out_release_parent;
10193 } 10116 }
@@ -10196,8 +10119,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10196 resource_size(&op->resource[2]), 10119 resource_size(&op->resource[2]),
10197 "niu vregs-1"); 10120 "niu vregs-1");
10198 if (!np->vir_regs_1) { 10121 if (!np->vir_regs_1) {
10199 dev_err(&op->dev, PFX "Cannot map device vir registers 1, " 10122 dev_err(&op->dev, "Cannot map device vir registers 1, aborting\n");
10200 "aborting.\n");
10201 err = -ENOMEM; 10123 err = -ENOMEM;
10202 goto err_out_iounmap; 10124 goto err_out_iounmap;
10203 } 10125 }
@@ -10206,8 +10128,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10206 resource_size(&op->resource[3]), 10128 resource_size(&op->resource[3]),
10207 "niu vregs-2"); 10129 "niu vregs-2");
10208 if (!np->vir_regs_2) { 10130 if (!np->vir_regs_2) {
10209 dev_err(&op->dev, PFX "Cannot map device vir registers 2, " 10131 dev_err(&op->dev, "Cannot map device vir registers 2, aborting\n");
10210 "aborting.\n");
10211 err = -ENOMEM; 10132 err = -ENOMEM;
10212 goto err_out_iounmap; 10133 goto err_out_iounmap;
10213 } 10134 }
@@ -10217,15 +10138,13 @@ static int __devinit niu_of_probe(struct of_device *op,
10217 err = niu_get_invariants(np); 10138 err = niu_get_invariants(np);
10218 if (err) { 10139 if (err) {
10219 if (err != -ENODEV) 10140 if (err != -ENODEV)
10220 dev_err(&op->dev, PFX "Problem fetching invariants " 10141 dev_err(&op->dev, "Problem fetching invariants of chip, aborting\n");
10221 "of chip, aborting.\n");
10222 goto err_out_iounmap; 10142 goto err_out_iounmap;
10223 } 10143 }
10224 10144
10225 err = register_netdev(dev); 10145 err = register_netdev(dev);
10226 if (err) { 10146 if (err) {
10227 dev_err(&op->dev, PFX "Cannot register net device, " 10147 dev_err(&op->dev, "Cannot register net device, aborting\n");
10228 "aborting.\n");
10229 goto err_out_iounmap; 10148 goto err_out_iounmap;
10230 } 10149 }
10231 10150