diff options
author | Michal Marek <mmarek@suse.cz> | 2010-08-04 08:05:07 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-08-04 08:05:07 -0400 |
commit | 7a996d3ab150bb0e1b71fa182f70199a703efdd1 (patch) | |
tree | 96a36947d90c9b96580899abd38cb3b70cd9d40b /drivers/net/niu.c | |
parent | 7cf3d73b4360e91b14326632ab1aeda4cb26308d (diff) | |
parent | 9fe6206f400646a2322096b56c59891d530e8d51 (diff) |
Merge commit 'v2.6.35' into kbuild/kconfig
Conflicts:
scripts/kconfig/Makefile
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r-- | drivers/net/niu.c | 772 |
1 files changed, 349 insertions, 423 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 2aed2b382c40..63e8e3893bd6 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,9 +36,8 @@ | |||
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 ": " | 39 | #define DRV_MODULE_VERSION "1.1" |
37 | #define DRV_MODULE_VERSION "1.0" | 40 | #define DRV_MODULE_RELDATE "Apr 22, 2010" |
38 | #define DRV_MODULE_RELDATE "Nov 14, 2008" | ||
39 | 41 | ||
40 | static char version[] __devinitdata = | 42 | static char version[] __devinitdata = |
41 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 43 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
@@ -58,7 +60,7 @@ static void writeq(u64 val, void __iomem *reg) | |||
58 | } | 60 | } |
59 | #endif | 61 | #endif |
60 | 62 | ||
61 | static struct pci_device_id niu_pci_tbl[] = { | 63 | static DEFINE_PCI_DEVICE_TABLE(niu_pci_tbl) = { |
62 | {PCI_DEVICE(PCI_VENDOR_ID_SUN, 0xabcd)}, | 64 | {PCI_DEVICE(PCI_VENDOR_ID_SUN, 0xabcd)}, |
63 | {} | 65 | {} |
64 | }; | 66 | }; |
@@ -89,21 +91,6 @@ static int debug = -1; | |||
89 | module_param(debug, int, 0); | 91 | module_param(debug, int, 0); |
90 | MODULE_PARM_DESC(debug, "NIU debug level"); | 92 | MODULE_PARM_DESC(debug, "NIU debug level"); |
91 | 93 | ||
92 | #define niudbg(TYPE, f, a...) \ | ||
93 | do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \ | ||
94 | printk(KERN_DEBUG PFX f, ## a); \ | ||
95 | } while (0) | ||
96 | |||
97 | #define niuinfo(TYPE, f, a...) \ | ||
98 | do { if ((np)->msg_enable & NETIF_MSG_##TYPE) \ | ||
99 | printk(KERN_INFO PFX f, ## a); \ | ||
100 | } while (0) | ||
101 | |||
102 | #define niuwarn(TYPE, f, a...) \ | ||
103 | do { 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) \ | 94 | #define niu_lock_parent(np, flags) \ |
108 | spin_lock_irqsave(&np->parent->lock, flags) | 95 | spin_lock_irqsave(&np->parent->lock, flags) |
109 | #define niu_unlock_parent(np, flags) \ | 96 | #define niu_unlock_parent(np, flags) \ |
@@ -135,10 +122,9 @@ static int __niu_set_and_wait_clear_mac(struct niu *np, unsigned long reg, | |||
135 | nw64_mac(reg, bits); | 122 | nw64_mac(reg, bits); |
136 | err = __niu_wait_bits_clear_mac(np, reg, bits, limit, delay); | 123 | err = __niu_wait_bits_clear_mac(np, reg, bits, limit, delay); |
137 | if (err) | 124 | if (err) |
138 | 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", |
139 | "would not clear, val[%llx]\n", | 126 | (unsigned long long)bits, reg_name, |
140 | np->dev->name, (unsigned long long) bits, reg_name, | 127 | (unsigned long long)nr64_mac(reg)); |
141 | (unsigned long long) nr64_mac(reg)); | ||
142 | return err; | 128 | return err; |
143 | } | 129 | } |
144 | 130 | ||
@@ -175,10 +161,9 @@ static int __niu_set_and_wait_clear_ipp(struct niu *np, unsigned long reg, | |||
175 | 161 | ||
176 | err = __niu_wait_bits_clear_ipp(np, reg, bits, limit, delay); | 162 | err = __niu_wait_bits_clear_ipp(np, reg, bits, limit, delay); |
177 | if (err) | 163 | if (err) |
178 | 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", |
179 | "would not clear, val[%llx]\n", | 165 | (unsigned long long)bits, reg_name, |
180 | np->dev->name, (unsigned long long) bits, reg_name, | 166 | (unsigned long long)nr64_ipp(reg)); |
181 | (unsigned long long) nr64_ipp(reg)); | ||
182 | return err; | 167 | return err; |
183 | } | 168 | } |
184 | 169 | ||
@@ -216,10 +201,9 @@ static int __niu_set_and_wait_clear(struct niu *np, unsigned long reg, | |||
216 | nw64(reg, bits); | 201 | nw64(reg, bits); |
217 | err = __niu_wait_bits_clear(np, reg, bits, limit, delay); | 202 | err = __niu_wait_bits_clear(np, reg, bits, limit, delay); |
218 | if (err) | 203 | if (err) |
219 | 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", |
220 | "would not clear, val[%llx]\n", | 205 | (unsigned long long)bits, reg_name, |
221 | np->dev->name, (unsigned long long) bits, reg_name, | 206 | (unsigned long long)nr64(reg)); |
222 | (unsigned long long) nr64(reg)); | ||
223 | return err; | 207 | return err; |
224 | } | 208 | } |
225 | 209 | ||
@@ -475,9 +459,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np) | |||
475 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | 459 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, |
476 | ESR2_TI_PLL_CFG_L, pll_cfg); | 460 | ESR2_TI_PLL_CFG_L, pll_cfg); |
477 | if (err) { | 461 | if (err) { |
478 | 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", |
479 | "serdes_init_niu_1g_serdes: " | 463 | np->port, __func__); |
480 | "mdio write to ESR2_TI_PLL_CFG_L failed", np->port); | ||
481 | return err; | 464 | return err; |
482 | } | 465 | } |
483 | 466 | ||
@@ -486,9 +469,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np) | |||
486 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | 469 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, |
487 | ESR2_TI_PLL_STS_L, pll_sts); | 470 | ESR2_TI_PLL_STS_L, pll_sts); |
488 | if (err) { | 471 | if (err) { |
489 | 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", |
490 | "serdes_init_niu_1g_serdes: " | 473 | np->port, __func__); |
491 | "mdio write to ESR2_TI_PLL_STS_L failed", np->port); | ||
492 | return err; | 474 | return err; |
493 | } | 475 | } |
494 | 476 | ||
@@ -531,8 +513,8 @@ static int serdes_init_niu_1g_serdes(struct niu *np) | |||
531 | } | 513 | } |
532 | 514 | ||
533 | if ((sig & mask) != val) { | 515 | if ((sig & mask) != val) { |
534 | 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", |
535 | "[%08x]\n", np->port, (int) (sig & mask), (int) val); | 517 | np->port, (int)(sig & mask), (int)val); |
536 | return -ENODEV; | 518 | return -ENODEV; |
537 | } | 519 | } |
538 | 520 | ||
@@ -569,9 +551,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np) | |||
569 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | 551 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, |
570 | ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff); | 552 | ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff); |
571 | if (err) { | 553 | if (err) { |
572 | 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", |
573 | "serdes_init_niu_10g_serdes: " | 555 | np->port, __func__); |
574 | "mdio write to ESR2_TI_PLL_CFG_L failed", np->port); | ||
575 | return err; | 556 | return err; |
576 | } | 557 | } |
577 | 558 | ||
@@ -580,9 +561,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np) | |||
580 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, | 561 | err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR, |
581 | ESR2_TI_PLL_STS_L, pll_sts & 0xffff); | 562 | ESR2_TI_PLL_STS_L, pll_sts & 0xffff); |
582 | if (err) { | 563 | if (err) { |
583 | 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", |
584 | "serdes_init_niu_10g_serdes: " | 565 | np->port, __func__); |
585 | "mdio write to ESR2_TI_PLL_STS_L failed", np->port); | ||
586 | return err; | 566 | return err; |
587 | } | 567 | } |
588 | 568 | ||
@@ -639,9 +619,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np) | |||
639 | } | 619 | } |
640 | 620 | ||
641 | if ((sig & mask) != val) { | 621 | if ((sig & mask) != val) { |
642 | 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", |
643 | "[%08x] for 10G...trying 1G\n", | 623 | np->port, (int)(sig & mask), (int)val); |
644 | np->port, (int) (sig & mask), (int) val); | ||
645 | 624 | ||
646 | /* 10G failed, try initializing at 1G */ | 625 | /* 10G failed, try initializing at 1G */ |
647 | err = serdes_init_niu_1g_serdes(np); | 626 | err = serdes_init_niu_1g_serdes(np); |
@@ -649,8 +628,8 @@ static int serdes_init_niu_10g_serdes(struct niu *np) | |||
649 | np->flags &= ~NIU_FLAGS_10G; | 628 | np->flags &= ~NIU_FLAGS_10G; |
650 | np->mac_xcvr = MAC_XCVR_PCS; | 629 | np->mac_xcvr = MAC_XCVR_PCS; |
651 | } else { | 630 | } else { |
652 | dev_err(np->device, PFX "Port %u 10G/1G SERDES " | 631 | netdev_err(np->dev, "Port %u 10G/1G SERDES Link Failed\n", |
653 | "Link Failed \n", np->port); | 632 | np->port); |
654 | return -ENODEV; | 633 | return -ENODEV; |
655 | } | 634 | } |
656 | } | 635 | } |
@@ -764,9 +743,8 @@ static int esr_reset(struct niu *np) | |||
764 | if (err) | 743 | if (err) |
765 | return err; | 744 | return err; |
766 | if (reset != 0) { | 745 | if (reset != 0) { |
767 | dev_err(np->device, PFX "Port %u ESR_RESET " | 746 | netdev_err(np->dev, "Port %u ESR_RESET did not clear [%08x]\n", |
768 | "did not clear [%08x]\n", | 747 | np->port, reset); |
769 | np->port, reset); | ||
770 | return -ENODEV; | 748 | return -ENODEV; |
771 | } | 749 | } |
772 | 750 | ||
@@ -890,8 +868,8 @@ static int serdes_init_10g(struct niu *np) | |||
890 | np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; | 868 | np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; |
891 | return 0; | 869 | return 0; |
892 | } | 870 | } |
893 | 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", |
894 | "[%08x]\n", np->port, (int) (sig & mask), (int) val); | 872 | np->port, (int)(sig & mask), (int)val); |
895 | return -ENODEV; | 873 | return -ENODEV; |
896 | } | 874 | } |
897 | if (np->flags & NIU_FLAGS_HOTPLUG_PHY) | 875 | if (np->flags & NIU_FLAGS_HOTPLUG_PHY) |
@@ -1039,8 +1017,8 @@ static int serdes_init_1g_serdes(struct niu *np) | |||
1039 | } | 1017 | } |
1040 | 1018 | ||
1041 | if ((sig & mask) != val) { | 1019 | if ((sig & mask) != val) { |
1042 | 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", |
1043 | "[%08x]\n", np->port, (int) (sig & mask), (int) val); | 1021 | np->port, (int)(sig & mask), (int)val); |
1044 | return -ENODEV; | 1022 | return -ENODEV; |
1045 | } | 1023 | } |
1046 | 1024 | ||
@@ -1332,8 +1310,8 @@ static int bcm8704_reset(struct niu *np) | |||
1332 | break; | 1310 | break; |
1333 | } | 1311 | } |
1334 | if (limit < 0) { | 1312 | if (limit < 0) { |
1335 | 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", |
1336 | "(bmcr=%04x)\n", np->port, (err & 0xffff)); | 1314 | np->port, (err & 0xffff)); |
1337 | return -ENODEV; | 1315 | return -ENODEV; |
1338 | } | 1316 | } |
1339 | return 0; | 1317 | return 0; |
@@ -1515,21 +1493,18 @@ static int xcvr_diag_bcm870x(struct niu *np) | |||
1515 | MII_STAT1000); | 1493 | MII_STAT1000); |
1516 | if (err < 0) | 1494 | if (err < 0) |
1517 | return err; | 1495 | return err; |
1518 | 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); |
1519 | np->port, err); | ||
1520 | 1497 | ||
1521 | 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); |
1522 | if (err < 0) | 1499 | if (err < 0) |
1523 | return err; | 1500 | return err; |
1524 | pr_info(PFX "Port %u USER_DEV3(0x20) [%04x]\n", | 1501 | pr_info("Port %u USER_DEV3(0x20) [%04x]\n", np->port, err); |
1525 | np->port, err); | ||
1526 | 1502 | ||
1527 | err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, | 1503 | err = mdio_read(np, np->phy_addr, BCM8704_PHYXS_DEV_ADDR, |
1528 | MII_NWAYTEST); | 1504 | MII_NWAYTEST); |
1529 | if (err < 0) | 1505 | if (err < 0) |
1530 | return err; | 1506 | return err; |
1531 | pr_info(PFX "Port %u PHYXS(MII_NWAYTEST) [%04x]\n", | 1507 | pr_info("Port %u PHYXS(MII_NWAYTEST) [%04x]\n", np->port, err); |
1532 | np->port, err); | ||
1533 | #endif | 1508 | #endif |
1534 | 1509 | ||
1535 | /* XXX dig this out it might not be so useful XXX */ | 1510 | /* XXX dig this out it might not be so useful XXX */ |
@@ -1555,11 +1530,11 @@ static int xcvr_diag_bcm870x(struct niu *np) | |||
1555 | 1530 | ||
1556 | if (analog_stat0 != 0x03fc) { | 1531 | if (analog_stat0 != 0x03fc) { |
1557 | if ((analog_stat0 == 0x43bc) && (tx_alarm_status != 0)) { | 1532 | if ((analog_stat0 == 0x43bc) && (tx_alarm_status != 0)) { |
1558 | pr_info(PFX "Port %u cable not connected " | 1533 | pr_info("Port %u cable not connected or bad cable\n", |
1559 | "or bad cable.\n", np->port); | 1534 | np->port); |
1560 | } else if (analog_stat0 == 0x639c) { | 1535 | } else if (analog_stat0 == 0x639c) { |
1561 | pr_info(PFX "Port %u optical module is bad " | 1536 | pr_info("Port %u optical module is bad or missing\n", |
1562 | "or missing.\n", np->port); | 1537 | np->port); |
1563 | } | 1538 | } |
1564 | } | 1539 | } |
1565 | 1540 | ||
@@ -1699,8 +1674,8 @@ static int mii_reset(struct niu *np) | |||
1699 | break; | 1674 | break; |
1700 | } | 1675 | } |
1701 | if (limit < 0) { | 1676 | if (limit < 0) { |
1702 | 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", |
1703 | "bmcr[%04x]\n", np->port, err); | 1678 | np->port, err); |
1704 | return -ENODEV; | 1679 | return -ENODEV; |
1705 | } | 1680 | } |
1706 | 1681 | ||
@@ -1895,7 +1870,7 @@ static int mii_init_common(struct niu *np) | |||
1895 | return err; | 1870 | return err; |
1896 | bmsr = err; | 1871 | bmsr = err; |
1897 | 1872 | ||
1898 | 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", |
1899 | np->port, bmcr, bmsr); | 1874 | np->port, bmcr, bmsr); |
1900 | #endif | 1875 | #endif |
1901 | 1876 | ||
@@ -1948,16 +1923,12 @@ static int niu_link_status_common(struct niu *np, int link_up) | |||
1948 | unsigned long flags; | 1923 | unsigned long flags; |
1949 | 1924 | ||
1950 | if (!netif_carrier_ok(dev) && link_up) { | 1925 | if (!netif_carrier_ok(dev) && link_up) { |
1951 | 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", |
1952 | dev->name, | 1927 | lp->active_speed == SPEED_10000 ? "10Gb/sec" : |
1953 | (lp->active_speed == SPEED_10000 ? | 1928 | lp->active_speed == SPEED_1000 ? "1Gb/sec" : |
1954 | "10Gb/sec" : | 1929 | lp->active_speed == SPEED_100 ? "100Mbit/sec" : |
1955 | (lp->active_speed == SPEED_1000 ? | 1930 | "10Mbit/sec", |
1956 | "1Gb/sec" : | 1931 | 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 | 1932 | ||
1962 | spin_lock_irqsave(&np->lock, flags); | 1933 | spin_lock_irqsave(&np->lock, flags); |
1963 | niu_init_xif(np); | 1934 | niu_init_xif(np); |
@@ -1966,7 +1937,7 @@ static int niu_link_status_common(struct niu *np, int link_up) | |||
1966 | 1937 | ||
1967 | netif_carrier_on(dev); | 1938 | netif_carrier_on(dev); |
1968 | } else if (netif_carrier_ok(dev) && !link_up) { | 1939 | } else if (netif_carrier_ok(dev) && !link_up) { |
1969 | niuwarn(LINK, "%s: Link is down\n", dev->name); | 1940 | netif_warn(np, link, dev, "Link is down\n"); |
1970 | spin_lock_irqsave(&np->lock, flags); | 1941 | spin_lock_irqsave(&np->lock, flags); |
1971 | niu_handle_led(np, 0); | 1942 | niu_handle_led(np, 0); |
1972 | spin_unlock_irqrestore(&np->lock, flags); | 1943 | spin_unlock_irqrestore(&np->lock, flags); |
@@ -2232,8 +2203,8 @@ static int link_status_10g_hotplug(struct niu *np, int *link_up_p) | |||
2232 | } else { | 2203 | } else { |
2233 | np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; | 2204 | np->flags &= ~NIU_FLAGS_HOTPLUG_PHY_PRESENT; |
2234 | *link_up_p = 0; | 2205 | *link_up_p = 0; |
2235 | niuwarn(LINK, "%s: Hotplug PHY Removed\n", | 2206 | netif_warn(np, link, np->dev, |
2236 | np->dev->name); | 2207 | "Hotplug PHY Removed\n"); |
2237 | } | 2208 | } |
2238 | } | 2209 | } |
2239 | out: | 2210 | out: |
@@ -2531,8 +2502,8 @@ static int serdes_init_10g_serdes(struct niu *np) | |||
2531 | np->flags &= ~NIU_FLAGS_10G; | 2502 | np->flags &= ~NIU_FLAGS_10G; |
2532 | np->mac_xcvr = MAC_XCVR_PCS; | 2503 | np->mac_xcvr = MAC_XCVR_PCS; |
2533 | } else { | 2504 | } else { |
2534 | 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", |
2535 | np->port); | 2506 | np->port); |
2536 | return -ENODEV; | 2507 | return -ENODEV; |
2537 | } | 2508 | } |
2538 | } | 2509 | } |
@@ -3234,23 +3205,22 @@ static int fflp_early_init(struct niu *np) | |||
3234 | parent = np->parent; | 3205 | parent = np->parent; |
3235 | err = 0; | 3206 | err = 0; |
3236 | if (!(parent->flags & PARENT_FLGS_CLS_HWINIT)) { | 3207 | if (!(parent->flags & PARENT_FLGS_CLS_HWINIT)) { |
3237 | niudbg(PROBE, "fflp_early_init: Initting hw on port %u\n", | ||
3238 | np->port); | ||
3239 | if (np->parent->plat_type != PLAT_TYPE_NIU) { | 3208 | if (np->parent->plat_type != PLAT_TYPE_NIU) { |
3240 | fflp_reset(np); | 3209 | fflp_reset(np); |
3241 | fflp_set_timings(np); | 3210 | fflp_set_timings(np); |
3242 | err = fflp_disable_all_partitions(np); | 3211 | err = fflp_disable_all_partitions(np); |
3243 | if (err) { | 3212 | if (err) { |
3244 | niudbg(PROBE, "fflp_disable_all_partitions " | 3213 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
3245 | "failed, err=%d\n", err); | 3214 | "fflp_disable_all_partitions failed, err=%d\n", |
3215 | err); | ||
3246 | goto out; | 3216 | goto out; |
3247 | } | 3217 | } |
3248 | } | 3218 | } |
3249 | 3219 | ||
3250 | err = tcam_early_init(np); | 3220 | err = tcam_early_init(np); |
3251 | if (err) { | 3221 | if (err) { |
3252 | niudbg(PROBE, "tcam_early_init failed, err=%d\n", | 3222 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
3253 | err); | 3223 | "tcam_early_init failed, err=%d\n", err); |
3254 | goto out; | 3224 | goto out; |
3255 | } | 3225 | } |
3256 | fflp_llcsnap_enable(np, 1); | 3226 | fflp_llcsnap_enable(np, 1); |
@@ -3260,22 +3230,22 @@ static int fflp_early_init(struct niu *np) | |||
3260 | 3230 | ||
3261 | err = tcam_flush_all(np); | 3231 | err = tcam_flush_all(np); |
3262 | if (err) { | 3232 | if (err) { |
3263 | niudbg(PROBE, "tcam_flush_all failed, err=%d\n", | 3233 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
3264 | err); | 3234 | "tcam_flush_all failed, err=%d\n", err); |
3265 | goto out; | 3235 | goto out; |
3266 | } | 3236 | } |
3267 | if (np->parent->plat_type != PLAT_TYPE_NIU) { | 3237 | if (np->parent->plat_type != PLAT_TYPE_NIU) { |
3268 | err = fflp_hash_clear(np); | 3238 | err = fflp_hash_clear(np); |
3269 | if (err) { | 3239 | if (err) { |
3270 | niudbg(PROBE, "fflp_hash_clear failed, " | 3240 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
3271 | "err=%d\n", err); | 3241 | "fflp_hash_clear failed, err=%d\n", |
3242 | err); | ||
3272 | goto out; | 3243 | goto out; |
3273 | } | 3244 | } |
3274 | } | 3245 | } |
3275 | 3246 | ||
3276 | vlan_tbl_clear(np); | 3247 | vlan_tbl_clear(np); |
3277 | 3248 | ||
3278 | niudbg(PROBE, "fflp_early_init: Success\n"); | ||
3279 | parent->flags |= PARENT_FLGS_CLS_HWINIT; | 3249 | parent->flags |= PARENT_FLGS_CLS_HWINIT; |
3280 | } | 3250 | } |
3281 | out: | 3251 | out: |
@@ -3474,6 +3444,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, | |||
3474 | struct rx_ring_info *rp) | 3444 | struct rx_ring_info *rp) |
3475 | { | 3445 | { |
3476 | unsigned int index = rp->rcr_index; | 3446 | unsigned int index = rp->rcr_index; |
3447 | struct rx_pkt_hdr1 *rh; | ||
3477 | struct sk_buff *skb; | 3448 | struct sk_buff *skb; |
3478 | int len, num_rcr; | 3449 | int len, num_rcr; |
3479 | 3450 | ||
@@ -3507,9 +3478,6 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, | |||
3507 | if (num_rcr == 1) { | 3478 | if (num_rcr == 1) { |
3508 | int ptype; | 3479 | int ptype; |
3509 | 3480 | ||
3510 | off += 2; | ||
3511 | append_size -= 2; | ||
3512 | |||
3513 | ptype = (val >> RCR_ENTRY_PKT_TYPE_SHIFT); | 3481 | ptype = (val >> RCR_ENTRY_PKT_TYPE_SHIFT); |
3514 | if ((ptype == RCR_PKT_TYPE_TCP || | 3482 | if ((ptype == RCR_PKT_TYPE_TCP || |
3515 | ptype == RCR_PKT_TYPE_UDP) && | 3483 | ptype == RCR_PKT_TYPE_UDP) && |
@@ -3518,8 +3486,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, | |||
3518 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 3486 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
3519 | else | 3487 | else |
3520 | skb->ip_summed = CHECKSUM_NONE; | 3488 | skb->ip_summed = CHECKSUM_NONE; |
3521 | } | 3489 | } else if (!(val & RCR_ENTRY_MULTI)) |
3522 | if (!(val & RCR_ENTRY_MULTI)) | ||
3523 | append_size = len - skb->len; | 3490 | append_size = len - skb->len; |
3524 | 3491 | ||
3525 | niu_rx_skb_append(skb, page, off, append_size); | 3492 | niu_rx_skb_append(skb, page, off, append_size); |
@@ -3540,8 +3507,17 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, | |||
3540 | } | 3507 | } |
3541 | rp->rcr_index = index; | 3508 | rp->rcr_index = index; |
3542 | 3509 | ||
3543 | skb_reserve(skb, NET_IP_ALIGN); | 3510 | len += sizeof(*rh); |
3544 | __pskb_pull_tail(skb, min(len, VLAN_ETH_HLEN)); | 3511 | len = min_t(int, len, sizeof(*rh) + VLAN_ETH_HLEN); |
3512 | __pskb_pull_tail(skb, len); | ||
3513 | |||
3514 | rh = (struct rx_pkt_hdr1 *) skb->data; | ||
3515 | if (np->dev->features & NETIF_F_RXHASH) | ||
3516 | skb->rxhash = ((u32)rh->hashval2_0 << 24 | | ||
3517 | (u32)rh->hashval2_1 << 16 | | ||
3518 | (u32)rh->hashval1_1 << 8 | | ||
3519 | (u32)rh->hashval1_2 << 0); | ||
3520 | skb_pull(skb, sizeof(*rh)); | ||
3545 | 3521 | ||
3546 | rp->rx_packets++; | 3522 | rp->rx_packets++; |
3547 | rp->rx_bytes += skb->len; | 3523 | rp->rx_bytes += skb->len; |
@@ -3665,8 +3641,8 @@ static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) | |||
3665 | 3641 | ||
3666 | cons = rp->cons; | 3642 | cons = rp->cons; |
3667 | 3643 | ||
3668 | niudbg(TX_DONE, "%s: niu_tx_work() pkt_cnt[%u] cons[%d]\n", | 3644 | netif_printk(np, tx_done, KERN_DEBUG, np->dev, |
3669 | np->dev->name, pkt_cnt, cons); | 3645 | "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons); |
3670 | 3646 | ||
3671 | while (pkt_cnt--) | 3647 | while (pkt_cnt--) |
3672 | cons = release_tx_packet(np, rp, cons); | 3648 | cons = release_tx_packet(np, rp, cons); |
@@ -3714,11 +3690,12 @@ static inline void niu_sync_rx_discard_stats(struct niu *np, | |||
3714 | rp->rx_errors += misc & RXMISC_COUNT; | 3690 | rp->rx_errors += misc & RXMISC_COUNT; |
3715 | 3691 | ||
3716 | if (unlikely(misc & RXMISC_OFLOW)) | 3692 | if (unlikely(misc & RXMISC_OFLOW)) |
3717 | dev_err(np->device, "rx-%d: Counter overflow " | 3693 | dev_err(np->device, "rx-%d: Counter overflow RXMISC discard\n", |
3718 | "RXMISC discard\n", rx_channel); | 3694 | rx_channel); |
3719 | 3695 | ||
3720 | niudbg(RX_ERR, "%s-rx-%d: MISC drop=%u over=%u\n", | 3696 | netif_printk(np, rx_err, KERN_DEBUG, np->dev, |
3721 | np->dev->name, rx_channel, misc, misc-limit); | 3697 | "rx-%d: MISC drop=%u over=%u\n", |
3698 | rx_channel, misc, misc-limit); | ||
3722 | } | 3699 | } |
3723 | 3700 | ||
3724 | /* WRED (Weighted Random Early Discard) by hardware */ | 3701 | /* WRED (Weighted Random Early Discard) by hardware */ |
@@ -3728,11 +3705,11 @@ static inline void niu_sync_rx_discard_stats(struct niu *np, | |||
3728 | rp->rx_dropped += wred & RED_DIS_CNT_COUNT; | 3705 | rp->rx_dropped += wred & RED_DIS_CNT_COUNT; |
3729 | 3706 | ||
3730 | if (unlikely(wred & RED_DIS_CNT_OFLOW)) | 3707 | if (unlikely(wred & RED_DIS_CNT_OFLOW)) |
3731 | dev_err(np->device, "rx-%d: Counter overflow " | 3708 | dev_err(np->device, "rx-%d: Counter overflow WRED discard\n", rx_channel); |
3732 | "WRED discard\n", rx_channel); | ||
3733 | 3709 | ||
3734 | niudbg(RX_ERR, "%s-rx-%d: WRED drop=%u over=%u\n", | 3710 | netif_printk(np, rx_err, KERN_DEBUG, np->dev, |
3735 | np->dev->name, rx_channel, wred, wred-limit); | 3711 | "rx-%d: WRED drop=%u over=%u\n", |
3712 | rx_channel, wred, wred-limit); | ||
3736 | } | 3713 | } |
3737 | } | 3714 | } |
3738 | 3715 | ||
@@ -3753,8 +3730,9 @@ static int niu_rx_work(struct napi_struct *napi, struct niu *np, | |||
3753 | mbox->rx_dma_ctl_stat = 0; | 3730 | mbox->rx_dma_ctl_stat = 0; |
3754 | mbox->rcrstat_a = 0; | 3731 | mbox->rcrstat_a = 0; |
3755 | 3732 | ||
3756 | niudbg(RX_STATUS, "%s: niu_rx_work(chan[%d]), stat[%llx] qlen=%d\n", | 3733 | netif_printk(np, rx_status, KERN_DEBUG, np->dev, |
3757 | np->dev->name, rp->rx_channel, (unsigned long long) stat, qlen); | 3734 | "%s(chan[%d]), stat[%llx] qlen=%d\n", |
3735 | __func__, rp->rx_channel, (unsigned long long)stat, qlen); | ||
3758 | 3736 | ||
3759 | rcr_done = work_done = 0; | 3737 | rcr_done = work_done = 0; |
3760 | qlen = min(qlen, budget); | 3738 | qlen = min(qlen, budget); |
@@ -3791,8 +3769,8 @@ static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget) | |||
3791 | u32 rx_vec = (v0 & 0xffffffff); | 3769 | u32 rx_vec = (v0 & 0xffffffff); |
3792 | int i, work_done = 0; | 3770 | int i, work_done = 0; |
3793 | 3771 | ||
3794 | niudbg(INTR, "%s: niu_poll_core() v0[%016llx]\n", | 3772 | netif_printk(np, intr, KERN_DEBUG, np->dev, |
3795 | np->dev->name, (unsigned long long) v0); | 3773 | "%s() v0[%016llx]\n", __func__, (unsigned long long)v0); |
3796 | 3774 | ||
3797 | for (i = 0; i < np->num_tx_rings; i++) { | 3775 | for (i = 0; i < np->num_tx_rings; i++) { |
3798 | struct tx_ring_info *rp = &np->tx_rings[i]; | 3776 | struct tx_ring_info *rp = &np->tx_rings[i]; |
@@ -3837,39 +3815,38 @@ static int niu_poll(struct napi_struct *napi, int budget) | |||
3837 | static void niu_log_rxchan_errors(struct niu *np, struct rx_ring_info *rp, | 3815 | static void niu_log_rxchan_errors(struct niu *np, struct rx_ring_info *rp, |
3838 | u64 stat) | 3816 | u64 stat) |
3839 | { | 3817 | { |
3840 | dev_err(np->device, PFX "%s: RX channel %u errors ( ", | 3818 | netdev_err(np->dev, "RX channel %u errors ( ", rp->rx_channel); |
3841 | np->dev->name, rp->rx_channel); | ||
3842 | 3819 | ||
3843 | if (stat & RX_DMA_CTL_STAT_RBR_TMOUT) | 3820 | if (stat & RX_DMA_CTL_STAT_RBR_TMOUT) |
3844 | printk("RBR_TMOUT "); | 3821 | pr_cont("RBR_TMOUT "); |
3845 | if (stat & RX_DMA_CTL_STAT_RSP_CNT_ERR) | 3822 | if (stat & RX_DMA_CTL_STAT_RSP_CNT_ERR) |
3846 | printk("RSP_CNT "); | 3823 | pr_cont("RSP_CNT "); |
3847 | if (stat & RX_DMA_CTL_STAT_BYTE_EN_BUS) | 3824 | if (stat & RX_DMA_CTL_STAT_BYTE_EN_BUS) |
3848 | printk("BYTE_EN_BUS "); | 3825 | pr_cont("BYTE_EN_BUS "); |
3849 | if (stat & RX_DMA_CTL_STAT_RSP_DAT_ERR) | 3826 | if (stat & RX_DMA_CTL_STAT_RSP_DAT_ERR) |
3850 | printk("RSP_DAT "); | 3827 | pr_cont("RSP_DAT "); |
3851 | if (stat & RX_DMA_CTL_STAT_RCR_ACK_ERR) | 3828 | if (stat & RX_DMA_CTL_STAT_RCR_ACK_ERR) |
3852 | printk("RCR_ACK "); | 3829 | pr_cont("RCR_ACK "); |
3853 | if (stat & RX_DMA_CTL_STAT_RCR_SHA_PAR) | 3830 | if (stat & RX_DMA_CTL_STAT_RCR_SHA_PAR) |
3854 | printk("RCR_SHA_PAR "); | 3831 | pr_cont("RCR_SHA_PAR "); |
3855 | if (stat & RX_DMA_CTL_STAT_RBR_PRE_PAR) | 3832 | if (stat & RX_DMA_CTL_STAT_RBR_PRE_PAR) |
3856 | printk("RBR_PRE_PAR "); | 3833 | pr_cont("RBR_PRE_PAR "); |
3857 | if (stat & RX_DMA_CTL_STAT_CONFIG_ERR) | 3834 | if (stat & RX_DMA_CTL_STAT_CONFIG_ERR) |
3858 | printk("CONFIG "); | 3835 | pr_cont("CONFIG "); |
3859 | if (stat & RX_DMA_CTL_STAT_RCRINCON) | 3836 | if (stat & RX_DMA_CTL_STAT_RCRINCON) |
3860 | printk("RCRINCON "); | 3837 | pr_cont("RCRINCON "); |
3861 | if (stat & RX_DMA_CTL_STAT_RCRFULL) | 3838 | if (stat & RX_DMA_CTL_STAT_RCRFULL) |
3862 | printk("RCRFULL "); | 3839 | pr_cont("RCRFULL "); |
3863 | if (stat & RX_DMA_CTL_STAT_RBRFULL) | 3840 | if (stat & RX_DMA_CTL_STAT_RBRFULL) |
3864 | printk("RBRFULL "); | 3841 | pr_cont("RBRFULL "); |
3865 | if (stat & RX_DMA_CTL_STAT_RBRLOGPAGE) | 3842 | if (stat & RX_DMA_CTL_STAT_RBRLOGPAGE) |
3866 | printk("RBRLOGPAGE "); | 3843 | pr_cont("RBRLOGPAGE "); |
3867 | if (stat & RX_DMA_CTL_STAT_CFIGLOGPAGE) | 3844 | if (stat & RX_DMA_CTL_STAT_CFIGLOGPAGE) |
3868 | printk("CFIGLOGPAGE "); | 3845 | pr_cont("CFIGLOGPAGE "); |
3869 | if (stat & RX_DMA_CTL_STAT_DC_FIFO_ERR) | 3846 | if (stat & RX_DMA_CTL_STAT_DC_FIFO_ERR) |
3870 | printk("DC_FIDO "); | 3847 | pr_cont("DC_FIDO "); |
3871 | 3848 | ||
3872 | printk(")\n"); | 3849 | pr_cont(")\n"); |
3873 | } | 3850 | } |
3874 | 3851 | ||
3875 | static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) | 3852 | static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) |
@@ -3883,9 +3860,9 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) | |||
3883 | err = -EINVAL; | 3860 | err = -EINVAL; |
3884 | 3861 | ||
3885 | if (err) { | 3862 | if (err) { |
3886 | dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n", | 3863 | netdev_err(np->dev, "RX channel %u error, stat[%llx]\n", |
3887 | np->dev->name, rp->rx_channel, | 3864 | rp->rx_channel, |
3888 | (unsigned long long) stat); | 3865 | (unsigned long long) stat); |
3889 | 3866 | ||
3890 | niu_log_rxchan_errors(np, rp, stat); | 3867 | niu_log_rxchan_errors(np, rp, stat); |
3891 | } | 3868 | } |
@@ -3899,27 +3876,26 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp) | |||
3899 | static void niu_log_txchan_errors(struct niu *np, struct tx_ring_info *rp, | 3876 | static void niu_log_txchan_errors(struct niu *np, struct tx_ring_info *rp, |
3900 | u64 cs) | 3877 | u64 cs) |
3901 | { | 3878 | { |
3902 | dev_err(np->device, PFX "%s: TX channel %u errors ( ", | 3879 | netdev_err(np->dev, "TX channel %u errors ( ", rp->tx_channel); |
3903 | np->dev->name, rp->tx_channel); | ||
3904 | 3880 | ||
3905 | if (cs & TX_CS_MBOX_ERR) | 3881 | if (cs & TX_CS_MBOX_ERR) |
3906 | printk("MBOX "); | 3882 | pr_cont("MBOX "); |
3907 | if (cs & TX_CS_PKT_SIZE_ERR) | 3883 | if (cs & TX_CS_PKT_SIZE_ERR) |
3908 | printk("PKT_SIZE "); | 3884 | pr_cont("PKT_SIZE "); |
3909 | if (cs & TX_CS_TX_RING_OFLOW) | 3885 | if (cs & TX_CS_TX_RING_OFLOW) |
3910 | printk("TX_RING_OFLOW "); | 3886 | pr_cont("TX_RING_OFLOW "); |
3911 | if (cs & TX_CS_PREF_BUF_PAR_ERR) | 3887 | if (cs & TX_CS_PREF_BUF_PAR_ERR) |
3912 | printk("PREF_BUF_PAR "); | 3888 | pr_cont("PREF_BUF_PAR "); |
3913 | if (cs & TX_CS_NACK_PREF) | 3889 | if (cs & TX_CS_NACK_PREF) |
3914 | printk("NACK_PREF "); | 3890 | pr_cont("NACK_PREF "); |
3915 | if (cs & TX_CS_NACK_PKT_RD) | 3891 | if (cs & TX_CS_NACK_PKT_RD) |
3916 | printk("NACK_PKT_RD "); | 3892 | pr_cont("NACK_PKT_RD "); |
3917 | if (cs & TX_CS_CONF_PART_ERR) | 3893 | if (cs & TX_CS_CONF_PART_ERR) |
3918 | printk("CONF_PART "); | 3894 | pr_cont("CONF_PART "); |
3919 | if (cs & TX_CS_PKT_PRT_ERR) | 3895 | if (cs & TX_CS_PKT_PRT_ERR) |
3920 | printk("PKT_PTR "); | 3896 | pr_cont("PKT_PTR "); |
3921 | 3897 | ||
3922 | printk(")\n"); | 3898 | pr_cont(")\n"); |
3923 | } | 3899 | } |
3924 | 3900 | ||
3925 | static int niu_tx_error(struct niu *np, struct tx_ring_info *rp) | 3901 | static int niu_tx_error(struct niu *np, struct tx_ring_info *rp) |
@@ -3930,12 +3906,11 @@ static int niu_tx_error(struct niu *np, struct tx_ring_info *rp) | |||
3930 | logh = nr64(TX_RNG_ERR_LOGH(rp->tx_channel)); | 3906 | logh = nr64(TX_RNG_ERR_LOGH(rp->tx_channel)); |
3931 | logl = nr64(TX_RNG_ERR_LOGL(rp->tx_channel)); | 3907 | logl = nr64(TX_RNG_ERR_LOGL(rp->tx_channel)); |
3932 | 3908 | ||
3933 | dev_err(np->device, PFX "%s: TX channel %u error, " | 3909 | netdev_err(np->dev, "TX channel %u error, cs[%llx] logh[%llx] logl[%llx]\n", |
3934 | "cs[%llx] logh[%llx] logl[%llx]\n", | 3910 | rp->tx_channel, |
3935 | np->dev->name, rp->tx_channel, | 3911 | (unsigned long long)cs, |
3936 | (unsigned long long) cs, | 3912 | (unsigned long long)logh, |
3937 | (unsigned long long) logh, | 3913 | (unsigned long long)logl); |
3938 | (unsigned long long) logl); | ||
3939 | 3914 | ||
3940 | niu_log_txchan_errors(np, rp, cs); | 3915 | niu_log_txchan_errors(np, rp, cs); |
3941 | 3916 | ||
@@ -3954,9 +3929,8 @@ static int niu_mif_interrupt(struct niu *np) | |||
3954 | phy_mdint = 1; | 3929 | phy_mdint = 1; |
3955 | } | 3930 | } |
3956 | 3931 | ||
3957 | dev_err(np->device, PFX "%s: MIF interrupt, " | 3932 | netdev_err(np->dev, "MIF interrupt, stat[%llx] phy_mdint(%d)\n", |
3958 | "stat[%llx] phy_mdint(%d)\n", | 3933 | (unsigned long long)mif_status, phy_mdint); |
3959 | np->dev->name, (unsigned long long) mif_status, phy_mdint); | ||
3960 | 3934 | ||
3961 | return -ENODEV; | 3935 | return -ENODEV; |
3962 | } | 3936 | } |
@@ -4081,41 +4055,40 @@ static int niu_mac_interrupt(struct niu *np) | |||
4081 | 4055 | ||
4082 | static void niu_log_device_error(struct niu *np, u64 stat) | 4056 | static void niu_log_device_error(struct niu *np, u64 stat) |
4083 | { | 4057 | { |
4084 | dev_err(np->device, PFX "%s: Core device errors ( ", | 4058 | netdev_err(np->dev, "Core device errors ( "); |
4085 | np->dev->name); | ||
4086 | 4059 | ||
4087 | if (stat & SYS_ERR_MASK_META2) | 4060 | if (stat & SYS_ERR_MASK_META2) |
4088 | printk("META2 "); | 4061 | pr_cont("META2 "); |
4089 | if (stat & SYS_ERR_MASK_META1) | 4062 | if (stat & SYS_ERR_MASK_META1) |
4090 | printk("META1 "); | 4063 | pr_cont("META1 "); |
4091 | if (stat & SYS_ERR_MASK_PEU) | 4064 | if (stat & SYS_ERR_MASK_PEU) |
4092 | printk("PEU "); | 4065 | pr_cont("PEU "); |
4093 | if (stat & SYS_ERR_MASK_TXC) | 4066 | if (stat & SYS_ERR_MASK_TXC) |
4094 | printk("TXC "); | 4067 | pr_cont("TXC "); |
4095 | if (stat & SYS_ERR_MASK_RDMC) | 4068 | if (stat & SYS_ERR_MASK_RDMC) |
4096 | printk("RDMC "); | 4069 | pr_cont("RDMC "); |
4097 | if (stat & SYS_ERR_MASK_TDMC) | 4070 | if (stat & SYS_ERR_MASK_TDMC) |
4098 | printk("TDMC "); | 4071 | pr_cont("TDMC "); |
4099 | if (stat & SYS_ERR_MASK_ZCP) | 4072 | if (stat & SYS_ERR_MASK_ZCP) |
4100 | printk("ZCP "); | 4073 | pr_cont("ZCP "); |
4101 | if (stat & SYS_ERR_MASK_FFLP) | 4074 | if (stat & SYS_ERR_MASK_FFLP) |
4102 | printk("FFLP "); | 4075 | pr_cont("FFLP "); |
4103 | if (stat & SYS_ERR_MASK_IPP) | 4076 | if (stat & SYS_ERR_MASK_IPP) |
4104 | printk("IPP "); | 4077 | pr_cont("IPP "); |
4105 | if (stat & SYS_ERR_MASK_MAC) | 4078 | if (stat & SYS_ERR_MASK_MAC) |
4106 | printk("MAC "); | 4079 | pr_cont("MAC "); |
4107 | if (stat & SYS_ERR_MASK_SMX) | 4080 | if (stat & SYS_ERR_MASK_SMX) |
4108 | printk("SMX "); | 4081 | pr_cont("SMX "); |
4109 | 4082 | ||
4110 | printk(")\n"); | 4083 | pr_cont(")\n"); |
4111 | } | 4084 | } |
4112 | 4085 | ||
4113 | static int niu_device_error(struct niu *np) | 4086 | static int niu_device_error(struct niu *np) |
4114 | { | 4087 | { |
4115 | u64 stat = nr64(SYS_ERR_STAT); | 4088 | u64 stat = nr64(SYS_ERR_STAT); |
4116 | 4089 | ||
4117 | dev_err(np->device, PFX "%s: Core device error, stat[%llx]\n", | 4090 | netdev_err(np->dev, "Core device error, stat[%llx]\n", |
4118 | np->dev->name, (unsigned long long) stat); | 4091 | (unsigned long long)stat); |
4119 | 4092 | ||
4120 | niu_log_device_error(np, stat); | 4093 | niu_log_device_error(np, stat); |
4121 | 4094 | ||
@@ -4197,8 +4170,8 @@ static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp, | |||
4197 | RX_DMA_CTL_STAT_RCRTO); | 4170 | RX_DMA_CTL_STAT_RCRTO); |
4198 | nw64(RX_DMA_CTL_STAT(rp->rx_channel), stat_write); | 4171 | nw64(RX_DMA_CTL_STAT(rp->rx_channel), stat_write); |
4199 | 4172 | ||
4200 | niudbg(INTR, "%s: rxchan_intr stat[%llx]\n", | 4173 | netif_printk(np, intr, KERN_DEBUG, np->dev, |
4201 | np->dev->name, (unsigned long long) stat); | 4174 | "%s() stat[%llx]\n", __func__, (unsigned long long)stat); |
4202 | } | 4175 | } |
4203 | 4176 | ||
4204 | static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp, | 4177 | static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp, |
@@ -4206,8 +4179,8 @@ static void niu_txchan_intr(struct niu *np, struct tx_ring_info *rp, | |||
4206 | { | 4179 | { |
4207 | rp->tx_cs = nr64(TX_CS(rp->tx_channel)); | 4180 | rp->tx_cs = nr64(TX_CS(rp->tx_channel)); |
4208 | 4181 | ||
4209 | niudbg(INTR, "%s: txchan_intr cs[%llx]\n", | 4182 | netif_printk(np, intr, KERN_DEBUG, np->dev, |
4210 | np->dev->name, (unsigned long long) rp->tx_cs); | 4183 | "%s() cs[%llx]\n", __func__, (unsigned long long)rp->tx_cs); |
4211 | } | 4184 | } |
4212 | 4185 | ||
4213 | static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0) | 4186 | static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0) |
@@ -4265,8 +4238,8 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id) | |||
4265 | u64 v0, v1, v2; | 4238 | u64 v0, v1, v2; |
4266 | 4239 | ||
4267 | if (netif_msg_intr(np)) | 4240 | if (netif_msg_intr(np)) |
4268 | printk(KERN_DEBUG PFX "niu_interrupt() ldg[%p](%d) ", | 4241 | printk(KERN_DEBUG KBUILD_MODNAME ": " "%s() ldg[%p](%d)", |
4269 | lp, ldg); | 4242 | __func__, lp, ldg); |
4270 | 4243 | ||
4271 | spin_lock_irqsave(&np->lock, flags); | 4244 | spin_lock_irqsave(&np->lock, flags); |
4272 | 4245 | ||
@@ -4275,7 +4248,7 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id) | |||
4275 | v2 = nr64(LDSV2(ldg)); | 4248 | v2 = nr64(LDSV2(ldg)); |
4276 | 4249 | ||
4277 | if (netif_msg_intr(np)) | 4250 | if (netif_msg_intr(np)) |
4278 | printk("v0[%llx] v1[%llx] v2[%llx]\n", | 4251 | pr_cont(" v0[%llx] v1[%llx] v2[%llx]\n", |
4279 | (unsigned long long) v0, | 4252 | (unsigned long long) v0, |
4280 | (unsigned long long) v1, | 4253 | (unsigned long long) v1, |
4281 | (unsigned long long) v2); | 4254 | (unsigned long long) v2); |
@@ -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); |
@@ -4983,7 +4952,9 @@ static int niu_init_one_rx_channel(struct niu *np, struct rx_ring_info *rp) | |||
4983 | RX_DMA_CTL_STAT_RCRTO | | 4952 | RX_DMA_CTL_STAT_RCRTO | |
4984 | RX_DMA_CTL_STAT_RBR_EMPTY)); | 4953 | RX_DMA_CTL_STAT_RBR_EMPTY)); |
4985 | nw64(RXDMA_CFIG1(channel), rp->mbox_dma >> 32); | 4954 | nw64(RXDMA_CFIG1(channel), rp->mbox_dma >> 32); |
4986 | nw64(RXDMA_CFIG2(channel), (rp->mbox_dma & 0x00000000ffffffc0)); | 4955 | nw64(RXDMA_CFIG2(channel), |
4956 | ((rp->mbox_dma & RXDMA_CFIG2_MBADDR_L) | | ||
4957 | RXDMA_CFIG2_FULL_HDR)); | ||
4987 | nw64(RBR_CFIG_A(channel), | 4958 | nw64(RBR_CFIG_A(channel), |
4988 | ((u64)rp->rbr_table_size << RBR_CFIG_A_LEN_SHIFT) | | 4959 | ((u64)rp->rbr_table_size << RBR_CFIG_A_LEN_SHIFT) | |
4989 | (rp->rbr_dma & (RBR_CFIG_A_STADDR_BASE | RBR_CFIG_A_STADDR))); | 4960 | (rp->rbr_dma & (RBR_CFIG_A_STADDR_BASE | RBR_CFIG_A_STADDR))); |
@@ -5146,9 +5117,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, | 5117 | err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, |
5147 | 1000, 100); | 5118 | 1000, 100); |
5148 | if (err) { | 5119 | if (err) { |
5149 | dev_err(np->device, PFX "%s: ZCP read busy won't clear, " | 5120 | netdev_err(np->dev, "ZCP read busy won't clear, ZCP_RAM_ACC[%llx]\n", |
5150 | "ZCP_RAM_ACC[%llx]\n", np->dev->name, | 5121 | (unsigned long long)nr64(ZCP_RAM_ACC)); |
5151 | (unsigned long long) nr64(ZCP_RAM_ACC)); | ||
5152 | return err; | 5122 | return err; |
5153 | } | 5123 | } |
5154 | 5124 | ||
@@ -5160,9 +5130,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, | 5130 | err = niu_wait_bits_clear(np, ZCP_RAM_ACC, ZCP_RAM_ACC_BUSY, |
5161 | 1000, 100); | 5131 | 1000, 100); |
5162 | if (err) { | 5132 | if (err) { |
5163 | dev_err(np->device, PFX "%s: ZCP read busy2 won't clear, " | 5133 | netdev_err(np->dev, "ZCP read busy2 won't clear, ZCP_RAM_ACC[%llx]\n", |
5164 | "ZCP_RAM_ACC[%llx]\n", np->dev->name, | 5134 | (unsigned long long)nr64(ZCP_RAM_ACC)); |
5165 | (unsigned long long) nr64(ZCP_RAM_ACC)); | ||
5166 | return err; | 5135 | return err; |
5167 | } | 5136 | } |
5168 | 5137 | ||
@@ -5527,8 +5496,7 @@ static int niu_reset_tx_bmac(struct niu *np) | |||
5527 | udelay(100); | 5496 | udelay(100); |
5528 | } | 5497 | } |
5529 | if (limit < 0) { | 5498 | if (limit < 0) { |
5530 | dev_err(np->device, PFX "Port %u TX BMAC would not reset, " | 5499 | 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, | 5500 | np->port, |
5533 | (unsigned long long) nr64_mac(BTXMAC_SW_RST)); | 5501 | (unsigned long long) nr64_mac(BTXMAC_SW_RST)); |
5534 | return -ENODEV; | 5502 | return -ENODEV; |
@@ -5629,12 +5597,11 @@ static int niu_reset_rx_xmac(struct niu *np) | |||
5629 | while (--limit >= 0) { | 5597 | while (--limit >= 0) { |
5630 | if (!(nr64_mac(XRXMAC_SW_RST) & (XRXMAC_SW_RST_REG_RS | | 5598 | if (!(nr64_mac(XRXMAC_SW_RST) & (XRXMAC_SW_RST_REG_RS | |
5631 | XRXMAC_SW_RST_SOFT_RST))) | 5599 | XRXMAC_SW_RST_SOFT_RST))) |
5632 | break; | 5600 | break; |
5633 | udelay(100); | 5601 | udelay(100); |
5634 | } | 5602 | } |
5635 | if (limit < 0) { | 5603 | if (limit < 0) { |
5636 | dev_err(np->device, PFX "Port %u RX XMAC would not reset, " | 5604 | 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, | 5605 | np->port, |
5639 | (unsigned long long) nr64_mac(XRXMAC_SW_RST)); | 5606 | (unsigned long long) nr64_mac(XRXMAC_SW_RST)); |
5640 | return -ENODEV; | 5607 | return -ENODEV; |
@@ -5655,8 +5622,7 @@ static int niu_reset_rx_bmac(struct niu *np) | |||
5655 | udelay(100); | 5622 | udelay(100); |
5656 | } | 5623 | } |
5657 | if (limit < 0) { | 5624 | if (limit < 0) { |
5658 | dev_err(np->device, PFX "Port %u RX BMAC would not reset, " | 5625 | 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, | 5626 | np->port, |
5661 | (unsigned long long) nr64_mac(BRXMAC_SW_RST)); | 5627 | (unsigned long long) nr64_mac(BRXMAC_SW_RST)); |
5662 | return -ENODEV; | 5628 | return -ENODEV; |
@@ -5960,11 +5926,9 @@ static void niu_disable_ipp(struct niu *np) | |||
5960 | } | 5926 | } |
5961 | if (limit < 0 && | 5927 | if (limit < 0 && |
5962 | (rd != 0 && wr != 1)) { | 5928 | (rd != 0 && wr != 1)) { |
5963 | dev_err(np->device, PFX "%s: IPP would not quiesce, " | 5929 | netdev_err(np->dev, "IPP would not quiesce, rd_ptr[%llx] wr_ptr[%llx]\n", |
5964 | "rd_ptr[%llx] wr_ptr[%llx]\n", | 5930 | (unsigned long long)nr64_ipp(IPP_DFIFO_RD_PTR), |
5965 | np->dev->name, | 5931 | (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 | } | 5932 | } |
5969 | 5933 | ||
5970 | val = nr64_ipp(IPP_CFIG); | 5934 | val = nr64_ipp(IPP_CFIG); |
@@ -5981,12 +5945,12 @@ static int niu_init_hw(struct niu *np) | |||
5981 | { | 5945 | { |
5982 | int i, err; | 5946 | int i, err; |
5983 | 5947 | ||
5984 | niudbg(IFUP, "%s: Initialize TXC\n", np->dev->name); | 5948 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TXC\n"); |
5985 | niu_txc_enable_port(np, 1); | 5949 | niu_txc_enable_port(np, 1); |
5986 | niu_txc_port_dma_enable(np, 1); | 5950 | niu_txc_port_dma_enable(np, 1); |
5987 | niu_txc_set_imask(np, 0); | 5951 | niu_txc_set_imask(np, 0); |
5988 | 5952 | ||
5989 | niudbg(IFUP, "%s: Initialize TX channels\n", np->dev->name); | 5953 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize TX channels\n"); |
5990 | for (i = 0; i < np->num_tx_rings; i++) { | 5954 | for (i = 0; i < np->num_tx_rings; i++) { |
5991 | struct tx_ring_info *rp = &np->tx_rings[i]; | 5955 | struct tx_ring_info *rp = &np->tx_rings[i]; |
5992 | 5956 | ||
@@ -5995,27 +5959,27 @@ static int niu_init_hw(struct niu *np) | |||
5995 | return err; | 5959 | return err; |
5996 | } | 5960 | } |
5997 | 5961 | ||
5998 | niudbg(IFUP, "%s: Initialize RX channels\n", np->dev->name); | 5962 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize RX channels\n"); |
5999 | err = niu_init_rx_channels(np); | 5963 | err = niu_init_rx_channels(np); |
6000 | if (err) | 5964 | if (err) |
6001 | goto out_uninit_tx_channels; | 5965 | goto out_uninit_tx_channels; |
6002 | 5966 | ||
6003 | niudbg(IFUP, "%s: Initialize classifier\n", np->dev->name); | 5967 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize classifier\n"); |
6004 | err = niu_init_classifier_hw(np); | 5968 | err = niu_init_classifier_hw(np); |
6005 | if (err) | 5969 | if (err) |
6006 | goto out_uninit_rx_channels; | 5970 | goto out_uninit_rx_channels; |
6007 | 5971 | ||
6008 | niudbg(IFUP, "%s: Initialize ZCP\n", np->dev->name); | 5972 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize ZCP\n"); |
6009 | err = niu_init_zcp(np); | 5973 | err = niu_init_zcp(np); |
6010 | if (err) | 5974 | if (err) |
6011 | goto out_uninit_rx_channels; | 5975 | goto out_uninit_rx_channels; |
6012 | 5976 | ||
6013 | niudbg(IFUP, "%s: Initialize IPP\n", np->dev->name); | 5977 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize IPP\n"); |
6014 | err = niu_init_ipp(np); | 5978 | err = niu_init_ipp(np); |
6015 | if (err) | 5979 | if (err) |
6016 | goto out_uninit_rx_channels; | 5980 | goto out_uninit_rx_channels; |
6017 | 5981 | ||
6018 | niudbg(IFUP, "%s: Initialize MAC\n", np->dev->name); | 5982 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Initialize MAC\n"); |
6019 | err = niu_init_mac(np); | 5983 | err = niu_init_mac(np); |
6020 | if (err) | 5984 | if (err) |
6021 | goto out_uninit_ipp; | 5985 | goto out_uninit_ipp; |
@@ -6023,16 +5987,16 @@ static int niu_init_hw(struct niu *np) | |||
6023 | return 0; | 5987 | return 0; |
6024 | 5988 | ||
6025 | out_uninit_ipp: | 5989 | out_uninit_ipp: |
6026 | niudbg(IFUP, "%s: Uninit IPP\n", np->dev->name); | 5990 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit IPP\n"); |
6027 | niu_disable_ipp(np); | 5991 | niu_disable_ipp(np); |
6028 | 5992 | ||
6029 | out_uninit_rx_channels: | 5993 | out_uninit_rx_channels: |
6030 | niudbg(IFUP, "%s: Uninit RX channels\n", np->dev->name); | 5994 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit RX channels\n"); |
6031 | niu_stop_rx_channels(np); | 5995 | niu_stop_rx_channels(np); |
6032 | niu_reset_rx_channels(np); | 5996 | niu_reset_rx_channels(np); |
6033 | 5997 | ||
6034 | out_uninit_tx_channels: | 5998 | out_uninit_tx_channels: |
6035 | niudbg(IFUP, "%s: Uninit TX channels\n", np->dev->name); | 5999 | netif_printk(np, ifup, KERN_DEBUG, np->dev, "Uninit TX channels\n"); |
6036 | niu_stop_tx_channels(np); | 6000 | niu_stop_tx_channels(np); |
6037 | niu_reset_tx_channels(np); | 6001 | niu_reset_tx_channels(np); |
6038 | 6002 | ||
@@ -6041,25 +6005,25 @@ out_uninit_tx_channels: | |||
6041 | 6005 | ||
6042 | static void niu_stop_hw(struct niu *np) | 6006 | static void niu_stop_hw(struct niu *np) |
6043 | { | 6007 | { |
6044 | niudbg(IFDOWN, "%s: Disable interrupts\n", np->dev->name); | 6008 | netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable interrupts\n"); |
6045 | niu_enable_interrupts(np, 0); | 6009 | niu_enable_interrupts(np, 0); |
6046 | 6010 | ||
6047 | niudbg(IFDOWN, "%s: Disable RX MAC\n", np->dev->name); | 6011 | netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable RX MAC\n"); |
6048 | niu_enable_rx_mac(np, 0); | 6012 | niu_enable_rx_mac(np, 0); |
6049 | 6013 | ||
6050 | niudbg(IFDOWN, "%s: Disable IPP\n", np->dev->name); | 6014 | netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Disable IPP\n"); |
6051 | niu_disable_ipp(np); | 6015 | niu_disable_ipp(np); |
6052 | 6016 | ||
6053 | niudbg(IFDOWN, "%s: Stop TX channels\n", np->dev->name); | 6017 | netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop TX channels\n"); |
6054 | niu_stop_tx_channels(np); | 6018 | niu_stop_tx_channels(np); |
6055 | 6019 | ||
6056 | niudbg(IFDOWN, "%s: Stop RX channels\n", np->dev->name); | 6020 | netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Stop RX channels\n"); |
6057 | niu_stop_rx_channels(np); | 6021 | niu_stop_rx_channels(np); |
6058 | 6022 | ||
6059 | niudbg(IFDOWN, "%s: Reset TX channels\n", np->dev->name); | 6023 | netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset TX channels\n"); |
6060 | niu_reset_tx_channels(np); | 6024 | niu_reset_tx_channels(np); |
6061 | 6025 | ||
6062 | niudbg(IFDOWN, "%s: Reset RX channels\n", np->dev->name); | 6026 | netif_printk(np, ifdown, KERN_DEBUG, np->dev, "Reset RX channels\n"); |
6063 | niu_reset_rx_channels(np); | 6027 | niu_reset_rx_channels(np); |
6064 | } | 6028 | } |
6065 | 6029 | ||
@@ -6358,7 +6322,6 @@ static void niu_set_rx_mode(struct net_device *dev) | |||
6358 | { | 6322 | { |
6359 | struct niu *np = netdev_priv(dev); | 6323 | struct niu *np = netdev_priv(dev); |
6360 | int i, alt_cnt, err; | 6324 | int i, alt_cnt, err; |
6361 | struct dev_addr_list *addr; | ||
6362 | struct netdev_hw_addr *ha; | 6325 | struct netdev_hw_addr *ha; |
6363 | unsigned long flags; | 6326 | unsigned long flags; |
6364 | u16 hash[16] = { 0, }; | 6327 | u16 hash[16] = { 0, }; |
@@ -6369,10 +6332,10 @@ static void niu_set_rx_mode(struct net_device *dev) | |||
6369 | np->flags &= ~(NIU_FLAGS_MCAST | NIU_FLAGS_PROMISC); | 6332 | np->flags &= ~(NIU_FLAGS_MCAST | NIU_FLAGS_PROMISC); |
6370 | if (dev->flags & IFF_PROMISC) | 6333 | if (dev->flags & IFF_PROMISC) |
6371 | np->flags |= NIU_FLAGS_PROMISC; | 6334 | np->flags |= NIU_FLAGS_PROMISC; |
6372 | if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0)) | 6335 | if ((dev->flags & IFF_ALLMULTI) || (!netdev_mc_empty(dev))) |
6373 | np->flags |= NIU_FLAGS_MCAST; | 6336 | np->flags |= NIU_FLAGS_MCAST; |
6374 | 6337 | ||
6375 | alt_cnt = dev->uc.count; | 6338 | alt_cnt = netdev_uc_count(dev); |
6376 | if (alt_cnt > niu_num_alt_addr(np)) { | 6339 | if (alt_cnt > niu_num_alt_addr(np)) { |
6377 | alt_cnt = 0; | 6340 | alt_cnt = 0; |
6378 | np->flags |= NIU_FLAGS_PROMISC; | 6341 | np->flags |= NIU_FLAGS_PROMISC; |
@@ -6381,17 +6344,15 @@ static void niu_set_rx_mode(struct net_device *dev) | |||
6381 | if (alt_cnt) { | 6344 | if (alt_cnt) { |
6382 | int index = 0; | 6345 | int index = 0; |
6383 | 6346 | ||
6384 | list_for_each_entry(ha, &dev->uc.list, list) { | 6347 | netdev_for_each_uc_addr(ha, dev) { |
6385 | err = niu_set_alt_mac(np, index, ha->addr); | 6348 | err = niu_set_alt_mac(np, index, ha->addr); |
6386 | if (err) | 6349 | if (err) |
6387 | printk(KERN_WARNING PFX "%s: Error %d " | 6350 | netdev_warn(dev, "Error %d adding alt mac %d\n", |
6388 | "adding alt mac %d\n", | 6351 | err, index); |
6389 | dev->name, err, index); | ||
6390 | err = niu_enable_alt_mac(np, index, 1); | 6352 | err = niu_enable_alt_mac(np, index, 1); |
6391 | if (err) | 6353 | if (err) |
6392 | printk(KERN_WARNING PFX "%s: Error %d " | 6354 | netdev_warn(dev, "Error %d enabling alt mac %d\n", |
6393 | "enabling alt mac %d\n", | 6355 | err, index); |
6394 | dev->name, err, index); | ||
6395 | 6356 | ||
6396 | index++; | 6357 | index++; |
6397 | } | 6358 | } |
@@ -6404,17 +6365,16 @@ static void niu_set_rx_mode(struct net_device *dev) | |||
6404 | for (i = alt_start; i < niu_num_alt_addr(np); i++) { | 6365 | for (i = alt_start; i < niu_num_alt_addr(np); i++) { |
6405 | err = niu_enable_alt_mac(np, i, 0); | 6366 | err = niu_enable_alt_mac(np, i, 0); |
6406 | if (err) | 6367 | if (err) |
6407 | printk(KERN_WARNING PFX "%s: Error %d " | 6368 | netdev_warn(dev, "Error %d disabling alt mac %d\n", |
6408 | "disabling alt mac %d\n", | 6369 | err, i); |
6409 | dev->name, err, i); | ||
6410 | } | 6370 | } |
6411 | } | 6371 | } |
6412 | if (dev->flags & IFF_ALLMULTI) { | 6372 | if (dev->flags & IFF_ALLMULTI) { |
6413 | for (i = 0; i < 16; i++) | 6373 | for (i = 0; i < 16; i++) |
6414 | hash[i] = 0xffff; | 6374 | hash[i] = 0xffff; |
6415 | } else if (dev->mc_count > 0) { | 6375 | } else if (!netdev_mc_empty(dev)) { |
6416 | for (addr = dev->mc_list; addr; addr = addr->next) { | 6376 | netdev_for_each_mc_addr(ha, dev) { |
6417 | u32 crc = ether_crc_le(ETH_ALEN, addr->da_addr); | 6377 | u32 crc = ether_crc_le(ETH_ALEN, ha->addr); |
6418 | 6378 | ||
6419 | crc >>= 24; | 6379 | crc >>= 24; |
6420 | hash[crc >> 4] |= (1 << (15 - (crc & 0xf))); | 6380 | hash[crc >> 4] |= (1 << (15 - (crc & 0xf))); |
@@ -6570,7 +6530,7 @@ static void niu_tx_timeout(struct net_device *dev) | |||
6570 | { | 6530 | { |
6571 | struct niu *np = netdev_priv(dev); | 6531 | struct niu *np = netdev_priv(dev); |
6572 | 6532 | ||
6573 | dev_err(np->device, PFX "%s: Transmit timed out, resetting\n", | 6533 | dev_err(np->device, "%s: Transmit timed out, resetting\n", |
6574 | dev->name); | 6534 | dev->name); |
6575 | 6535 | ||
6576 | schedule_work(&np->reset_task); | 6536 | schedule_work(&np->reset_task); |
@@ -6672,8 +6632,7 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb, | |||
6672 | 6632 | ||
6673 | if (niu_tx_avail(rp) <= (skb_shinfo(skb)->nr_frags + 1)) { | 6633 | if (niu_tx_avail(rp) <= (skb_shinfo(skb)->nr_frags + 1)) { |
6674 | netif_tx_stop_queue(txq); | 6634 | netif_tx_stop_queue(txq); |
6675 | dev_err(np->device, PFX "%s: BUG! Tx ring full when " | 6635 | 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++; | 6636 | rp->tx_errors++; |
6678 | return NETDEV_TX_BUSY; | 6637 | return NETDEV_TX_BUSY; |
6679 | } | 6638 | } |
@@ -7237,8 +7196,8 @@ static int niu_get_ethtool_tcam_entry(struct niu *np, | |||
7237 | 7196 | ||
7238 | tp = &parent->tcam[idx]; | 7197 | tp = &parent->tcam[idx]; |
7239 | if (!tp->valid) { | 7198 | if (!tp->valid) { |
7240 | pr_info(PFX "niu%d: %s entry [%d] invalid for idx[%d]\n", | 7199 | netdev_info(np->dev, "niu%d: entry [%d] invalid for idx[%d]\n", |
7241 | parent->index, np->dev->name, (u16)nfc->fs.location, idx); | 7200 | parent->index, (u16)nfc->fs.location, idx); |
7242 | return -EINVAL; | 7201 | return -EINVAL; |
7243 | } | 7202 | } |
7244 | 7203 | ||
@@ -7248,8 +7207,8 @@ static int niu_get_ethtool_tcam_entry(struct niu *np, | |||
7248 | ret = niu_class_to_ethflow(class, &fsp->flow_type); | 7207 | ret = niu_class_to_ethflow(class, &fsp->flow_type); |
7249 | 7208 | ||
7250 | if (ret < 0) { | 7209 | if (ret < 0) { |
7251 | pr_info(PFX "niu%d: %s niu_class_to_ethflow failed\n", | 7210 | netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n", |
7252 | parent->index, np->dev->name); | 7211 | parent->index); |
7253 | ret = -EINVAL; | 7212 | ret = -EINVAL; |
7254 | goto out; | 7213 | goto out; |
7255 | } | 7214 | } |
@@ -7332,9 +7291,8 @@ static int niu_get_ethtool_tcam_all(struct niu *np, | |||
7332 | 7291 | ||
7333 | if (n_entries != cnt) { | 7292 | if (n_entries != cnt) { |
7334 | /* print warning, this should not happen */ | 7293 | /* print warning, this should not happen */ |
7335 | pr_info(PFX "niu%d: %s In niu_get_ethtool_tcam_all, " | 7294 | netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n", |
7336 | "n_entries[%d] != cnt[%d]!!!\n\n", | 7295 | np->parent->index, __func__, n_entries, cnt); |
7337 | np->parent->index, np->dev->name, n_entries, cnt); | ||
7338 | } | 7296 | } |
7339 | 7297 | ||
7340 | return 0; | 7298 | return 0; |
@@ -7561,9 +7519,8 @@ static int niu_add_ethtool_tcam_entry(struct niu *np, | |||
7561 | } | 7519 | } |
7562 | } | 7520 | } |
7563 | if (!add_usr_cls) { | 7521 | if (!add_usr_cls) { |
7564 | pr_info(PFX "niu%d: %s niu_add_ethtool_tcam_entry: " | 7522 | 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", | 7523 | parent->index, __func__, uspec->proto); |
7566 | parent->index, np->dev->name, uspec->proto); | ||
7567 | ret = -EINVAL; | 7524 | ret = -EINVAL; |
7568 | goto out; | 7525 | goto out; |
7569 | } | 7526 | } |
@@ -7596,9 +7553,8 @@ static int niu_add_ethtool_tcam_entry(struct niu *np, | |||
7596 | case AH_V6_FLOW: | 7553 | case AH_V6_FLOW: |
7597 | case ESP_V6_FLOW: | 7554 | case ESP_V6_FLOW: |
7598 | /* Not yet implemented */ | 7555 | /* Not yet implemented */ |
7599 | pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " | 7556 | netdev_info(np->dev, "niu%d: In %s(): flow %d for IPv6 not implemented\n", |
7600 | "flow %d for IPv6 not implemented\n\n", | 7557 | parent->index, __func__, fsp->flow_type); |
7601 | parent->index, np->dev->name, fsp->flow_type); | ||
7602 | ret = -EINVAL; | 7558 | ret = -EINVAL; |
7603 | goto out; | 7559 | goto out; |
7604 | case IP_USER_FLOW: | 7560 | case IP_USER_FLOW: |
@@ -7607,17 +7563,15 @@ static int niu_add_ethtool_tcam_entry(struct niu *np, | |||
7607 | class); | 7563 | class); |
7608 | } else { | 7564 | } else { |
7609 | /* Not yet implemented */ | 7565 | /* Not yet implemented */ |
7610 | pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " | 7566 | netdev_info(np->dev, "niu%d: In %s(): usr flow for IPv6 not implemented\n", |
7611 | "usr flow for IPv6 not implemented\n\n", | 7567 | parent->index, __func__); |
7612 | parent->index, np->dev->name); | ||
7613 | ret = -EINVAL; | 7568 | ret = -EINVAL; |
7614 | goto out; | 7569 | goto out; |
7615 | } | 7570 | } |
7616 | break; | 7571 | break; |
7617 | default: | 7572 | default: |
7618 | pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " | 7573 | netdev_info(np->dev, "niu%d: In %s(): Unknown flow type %d\n", |
7619 | "Unknown flow type %d\n\n", | 7574 | parent->index, __func__, fsp->flow_type); |
7620 | parent->index, np->dev->name, fsp->flow_type); | ||
7621 | ret = -EINVAL; | 7575 | ret = -EINVAL; |
7622 | goto out; | 7576 | goto out; |
7623 | } | 7577 | } |
@@ -7627,10 +7581,9 @@ static int niu_add_ethtool_tcam_entry(struct niu *np, | |||
7627 | tp->assoc_data = TCAM_ASSOCDATA_DISC; | 7581 | tp->assoc_data = TCAM_ASSOCDATA_DISC; |
7628 | } else { | 7582 | } else { |
7629 | if (fsp->ring_cookie >= np->num_rx_rings) { | 7583 | if (fsp->ring_cookie >= np->num_rx_rings) { |
7630 | pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: " | 7584 | netdev_info(np->dev, "niu%d: In %s(): Invalid RX ring %lld\n", |
7631 | "Invalid RX ring %lld\n\n", | 7585 | parent->index, __func__, |
7632 | parent->index, np->dev->name, | 7586 | (long long)fsp->ring_cookie); |
7633 | (long long) fsp->ring_cookie); | ||
7634 | ret = -EINVAL; | 7587 | ret = -EINVAL; |
7635 | goto out; | 7588 | goto out; |
7636 | } | 7589 | } |
@@ -7699,10 +7652,9 @@ static int niu_del_ethtool_tcam_entry(struct niu *np, u32 loc) | |||
7699 | } | 7652 | } |
7700 | } | 7653 | } |
7701 | if (i == NIU_L3_PROG_CLS) { | 7654 | if (i == NIU_L3_PROG_CLS) { |
7702 | pr_info(PFX "niu%d: %s In niu_del_ethtool_tcam_entry," | 7655 | netdev_info(np->dev, "niu%d: In %s(): Usr class 0x%llx not found\n", |
7703 | "Usr class 0x%llx not found \n", | 7656 | parent->index, __func__, |
7704 | parent->index, np->dev->name, | 7657 | (unsigned long long)class); |
7705 | (unsigned long long) class); | ||
7706 | ret = -EINVAL; | 7658 | ret = -EINVAL; |
7707 | goto out; | 7659 | goto out; |
7708 | } | 7660 | } |
@@ -7966,6 +7918,18 @@ static int niu_phys_id(struct net_device *dev, u32 data) | |||
7966 | return 0; | 7918 | return 0; |
7967 | } | 7919 | } |
7968 | 7920 | ||
7921 | static int niu_set_flags(struct net_device *dev, u32 data) | ||
7922 | { | ||
7923 | if (data & (ETH_FLAG_LRO | ETH_FLAG_NTUPLE)) | ||
7924 | return -EOPNOTSUPP; | ||
7925 | |||
7926 | if (data & ETH_FLAG_RXHASH) | ||
7927 | dev->features |= NETIF_F_RXHASH; | ||
7928 | else | ||
7929 | dev->features &= ~NETIF_F_RXHASH; | ||
7930 | return 0; | ||
7931 | } | ||
7932 | |||
7969 | static const struct ethtool_ops niu_ethtool_ops = { | 7933 | static const struct ethtool_ops niu_ethtool_ops = { |
7970 | .get_drvinfo = niu_get_drvinfo, | 7934 | .get_drvinfo = niu_get_drvinfo, |
7971 | .get_link = ethtool_op_get_link, | 7935 | .get_link = ethtool_op_get_link, |
@@ -7982,6 +7946,8 @@ static const struct ethtool_ops niu_ethtool_ops = { | |||
7982 | .phys_id = niu_phys_id, | 7946 | .phys_id = niu_phys_id, |
7983 | .get_rxnfc = niu_get_nfc, | 7947 | .get_rxnfc = niu_get_nfc, |
7984 | .set_rxnfc = niu_set_nfc, | 7948 | .set_rxnfc = niu_set_nfc, |
7949 | .set_flags = niu_set_flags, | ||
7950 | .get_flags = ethtool_op_get_flags, | ||
7985 | }; | 7951 | }; |
7986 | 7952 | ||
7987 | static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent, | 7953 | static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent, |
@@ -8001,9 +7967,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. | 7967 | * won't get any interrupts and that's painful to debug. |
8002 | */ | 7968 | */ |
8003 | if (nr64(LDG_NUM(ldn)) != ldg) { | 7969 | if (nr64(LDG_NUM(ldn)) != ldg) { |
8004 | dev_err(np->device, PFX "Port %u, mis-matched " | 7970 | 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, | 7971 | np->port, ldn, ldg, |
8008 | (unsigned long long) nr64(LDG_NUM(ldn))); | 7972 | (unsigned long long) nr64(LDG_NUM(ldn))); |
8009 | return -EINVAL; | 7973 | return -EINVAL; |
@@ -8056,7 +8020,7 @@ static int __devinit niu_pci_eeprom_read(struct niu *np, u32 addr) | |||
8056 | break; | 8020 | break; |
8057 | } while (limit--); | 8021 | } while (limit--); |
8058 | if (!(frame & ESPC_PIO_STAT_READ_END)) { | 8022 | if (!(frame & ESPC_PIO_STAT_READ_END)) { |
8059 | dev_err(np->device, PFX "EEPROM read timeout frame[%llx]\n", | 8023 | dev_err(np->device, "EEPROM read timeout frame[%llx]\n", |
8060 | (unsigned long long) frame); | 8024 | (unsigned long long) frame); |
8061 | return -ENODEV; | 8025 | return -ENODEV; |
8062 | } | 8026 | } |
@@ -8071,7 +8035,7 @@ static int __devinit niu_pci_eeprom_read(struct niu *np, u32 addr) | |||
8071 | break; | 8035 | break; |
8072 | } while (limit--); | 8036 | } while (limit--); |
8073 | if (!(frame & ESPC_PIO_STAT_READ_END)) { | 8037 | if (!(frame & ESPC_PIO_STAT_READ_END)) { |
8074 | dev_err(np->device, PFX "EEPROM read timeout frame[%llx]\n", | 8038 | dev_err(np->device, "EEPROM read timeout frame[%llx]\n", |
8075 | (unsigned long long) frame); | 8039 | (unsigned long long) frame); |
8076 | return -ENODEV; | 8040 | return -ENODEV; |
8077 | } | 8041 | } |
@@ -8152,8 +8116,9 @@ static void __devinit niu_vpd_parse_version(struct niu *np) | |||
8152 | s += i + 5; | 8116 | s += i + 5; |
8153 | sscanf(s, "%d.%d", &vpd->fcode_major, &vpd->fcode_minor); | 8117 | sscanf(s, "%d.%d", &vpd->fcode_major, &vpd->fcode_minor); |
8154 | 8118 | ||
8155 | niudbg(PROBE, "VPD_SCAN: FCODE major(%d) minor(%d)\n", | 8119 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8156 | vpd->fcode_major, vpd->fcode_minor); | 8120 | "VPD_SCAN: FCODE major(%d) minor(%d)\n", |
8121 | vpd->fcode_major, vpd->fcode_minor); | ||
8157 | if (vpd->fcode_major > NIU_VPD_MIN_MAJOR || | 8122 | if (vpd->fcode_major > NIU_VPD_MIN_MAJOR || |
8158 | (vpd->fcode_major == NIU_VPD_MIN_MAJOR && | 8123 | (vpd->fcode_major == NIU_VPD_MIN_MAJOR && |
8159 | vpd->fcode_minor >= NIU_VPD_MIN_MINOR)) | 8124 | vpd->fcode_minor >= NIU_VPD_MIN_MINOR)) |
@@ -8173,8 +8138,8 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np, | |||
8173 | #define FOUND_MASK_PHY 0x00000020 | 8138 | #define FOUND_MASK_PHY 0x00000020 |
8174 | #define FOUND_MASK_ALL 0x0000003f | 8139 | #define FOUND_MASK_ALL 0x0000003f |
8175 | 8140 | ||
8176 | niudbg(PROBE, "VPD_SCAN: start[%x] end[%x]\n", | 8141 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8177 | start, end); | 8142 | "VPD_SCAN: start[%x] end[%x]\n", start, end); |
8178 | while (start < end) { | 8143 | while (start < end) { |
8179 | int len, err, instance, type, prop_len; | 8144 | int len, err, instance, type, prop_len; |
8180 | char namebuf[64]; | 8145 | char namebuf[64]; |
@@ -8228,8 +8193,7 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np, | |||
8228 | } | 8193 | } |
8229 | 8194 | ||
8230 | if (max_len && prop_len > max_len) { | 8195 | if (max_len && prop_len > max_len) { |
8231 | dev_err(np->device, PFX "Property '%s' length (%d) is " | 8196 | 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; | 8197 | return -EINVAL; |
8234 | } | 8198 | } |
8235 | 8199 | ||
@@ -8237,8 +8201,9 @@ static int __devinit niu_pci_vpd_scan_props(struct niu *np, | |||
8237 | u32 off = start + 5 + err; | 8201 | u32 off = start + 5 + err; |
8238 | int i; | 8202 | int i; |
8239 | 8203 | ||
8240 | niudbg(PROBE, "VPD_SCAN: Reading in property [%s] " | 8204 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8241 | "len[%d]\n", namebuf, prop_len); | 8205 | "VPD_SCAN: Reading in property [%s] len[%d]\n", |
8206 | namebuf, prop_len); | ||
8242 | for (i = 0; i < prop_len; i++) | 8207 | for (i = 0; i < prop_len; i++) |
8243 | *prop_buf++ = niu_pci_eeprom_read(np, off + i); | 8208 | *prop_buf++ = niu_pci_eeprom_read(np, off + i); |
8244 | } | 8209 | } |
@@ -8402,8 +8367,7 @@ static void __devinit niu_pci_vpd_validate(struct niu *np) | |||
8402 | u8 val8; | 8367 | u8 val8; |
8403 | 8368 | ||
8404 | if (!is_valid_ether_addr(&vpd->local_mac[0])) { | 8369 | if (!is_valid_ether_addr(&vpd->local_mac[0])) { |
8405 | dev_err(np->device, PFX "VPD MAC invalid, " | 8370 | dev_err(np->device, "VPD MAC invalid, falling back to SPROM\n"); |
8406 | "falling back to SPROM.\n"); | ||
8407 | 8371 | ||
8408 | np->flags &= ~NIU_FLAGS_VPD_VALID; | 8372 | np->flags &= ~NIU_FLAGS_VPD_VALID; |
8409 | return; | 8373 | return; |
@@ -8420,14 +8384,14 @@ static void __devinit niu_pci_vpd_validate(struct niu *np) | |||
8420 | np->flags &= ~NIU_FLAGS_10G; | 8384 | np->flags &= ~NIU_FLAGS_10G; |
8421 | } | 8385 | } |
8422 | if (np->flags & NIU_FLAGS_10G) | 8386 | if (np->flags & NIU_FLAGS_10G) |
8423 | np->mac_xcvr = MAC_XCVR_XPCS; | 8387 | np->mac_xcvr = MAC_XCVR_XPCS; |
8424 | } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { | 8388 | } else if (!strcmp(np->vpd.model, NIU_FOXXY_MDL_STR)) { |
8425 | np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | | 8389 | np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER | |
8426 | NIU_FLAGS_HOTPLUG_PHY); | 8390 | NIU_FLAGS_HOTPLUG_PHY); |
8427 | } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { | 8391 | } else if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { |
8428 | dev_err(np->device, PFX "Illegal phy string [%s].\n", | 8392 | dev_err(np->device, "Illegal phy string [%s]\n", |
8429 | np->vpd.phy_type); | 8393 | np->vpd.phy_type); |
8430 | dev_err(np->device, PFX "Falling back to SPROM.\n"); | 8394 | dev_err(np->device, "Falling back to SPROM\n"); |
8431 | np->flags &= ~NIU_FLAGS_VPD_VALID; | 8395 | np->flags &= ~NIU_FLAGS_VPD_VALID; |
8432 | return; | 8396 | return; |
8433 | } | 8397 | } |
@@ -8455,7 +8419,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np) | |||
8455 | 8419 | ||
8456 | np->eeprom_len = len; | 8420 | np->eeprom_len = len; |
8457 | 8421 | ||
8458 | niudbg(PROBE, "SPROM: Image size %llu\n", (unsigned long long) val); | 8422 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8423 | "SPROM: Image size %llu\n", (unsigned long long)val); | ||
8459 | 8424 | ||
8460 | sum = 0; | 8425 | sum = 0; |
8461 | for (i = 0; i < len; i++) { | 8426 | for (i = 0; i < len; i++) { |
@@ -8465,10 +8430,10 @@ static int __devinit niu_pci_probe_sprom(struct niu *np) | |||
8465 | sum += (val >> 16) & 0xff; | 8430 | sum += (val >> 16) & 0xff; |
8466 | sum += (val >> 24) & 0xff; | 8431 | sum += (val >> 24) & 0xff; |
8467 | } | 8432 | } |
8468 | niudbg(PROBE, "SPROM: Checksum %x\n", (int)(sum & 0xff)); | 8433 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8434 | "SPROM: Checksum %x\n", (int)(sum & 0xff)); | ||
8469 | if ((sum & 0xff) != 0xab) { | 8435 | if ((sum & 0xff) != 0xab) { |
8470 | dev_err(np->device, PFX "Bad SPROM checksum " | 8436 | 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; | 8437 | return -EINVAL; |
8473 | } | 8438 | } |
8474 | 8439 | ||
@@ -8491,11 +8456,12 @@ static int __devinit niu_pci_probe_sprom(struct niu *np) | |||
8491 | ESPC_PHY_TYPE_PORT3_SHIFT; | 8456 | ESPC_PHY_TYPE_PORT3_SHIFT; |
8492 | break; | 8457 | break; |
8493 | default: | 8458 | default: |
8494 | dev_err(np->device, PFX "Bogus port number %u\n", | 8459 | dev_err(np->device, "Bogus port number %u\n", |
8495 | np->port); | 8460 | np->port); |
8496 | return -EINVAL; | 8461 | return -EINVAL; |
8497 | } | 8462 | } |
8498 | niudbg(PROBE, "SPROM: PHY type %x\n", val8); | 8463 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8464 | "SPROM: PHY type %x\n", val8); | ||
8499 | 8465 | ||
8500 | switch (val8) { | 8466 | switch (val8) { |
8501 | case ESPC_PHY_TYPE_1G_COPPER: | 8467 | case ESPC_PHY_TYPE_1G_COPPER: |
@@ -8527,30 +8493,27 @@ static int __devinit niu_pci_probe_sprom(struct niu *np) | |||
8527 | break; | 8493 | break; |
8528 | 8494 | ||
8529 | default: | 8495 | default: |
8530 | dev_err(np->device, PFX "Bogus SPROM phy type %u\n", val8); | 8496 | dev_err(np->device, "Bogus SPROM phy type %u\n", val8); |
8531 | return -EINVAL; | 8497 | return -EINVAL; |
8532 | } | 8498 | } |
8533 | 8499 | ||
8534 | val = nr64(ESPC_MAC_ADDR0); | 8500 | val = nr64(ESPC_MAC_ADDR0); |
8535 | niudbg(PROBE, "SPROM: MAC_ADDR0[%08llx]\n", | 8501 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8536 | (unsigned long long) val); | 8502 | "SPROM: MAC_ADDR0[%08llx]\n", (unsigned long long)val); |
8537 | dev->perm_addr[0] = (val >> 0) & 0xff; | 8503 | dev->perm_addr[0] = (val >> 0) & 0xff; |
8538 | dev->perm_addr[1] = (val >> 8) & 0xff; | 8504 | dev->perm_addr[1] = (val >> 8) & 0xff; |
8539 | dev->perm_addr[2] = (val >> 16) & 0xff; | 8505 | dev->perm_addr[2] = (val >> 16) & 0xff; |
8540 | dev->perm_addr[3] = (val >> 24) & 0xff; | 8506 | dev->perm_addr[3] = (val >> 24) & 0xff; |
8541 | 8507 | ||
8542 | val = nr64(ESPC_MAC_ADDR1); | 8508 | val = nr64(ESPC_MAC_ADDR1); |
8543 | niudbg(PROBE, "SPROM: MAC_ADDR1[%08llx]\n", | 8509 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8544 | (unsigned long long) val); | 8510 | "SPROM: MAC_ADDR1[%08llx]\n", (unsigned long long)val); |
8545 | dev->perm_addr[4] = (val >> 0) & 0xff; | 8511 | dev->perm_addr[4] = (val >> 0) & 0xff; |
8546 | dev->perm_addr[5] = (val >> 8) & 0xff; | 8512 | dev->perm_addr[5] = (val >> 8) & 0xff; |
8547 | 8513 | ||
8548 | if (!is_valid_ether_addr(&dev->perm_addr[0])) { | 8514 | if (!is_valid_ether_addr(&dev->perm_addr[0])) { |
8549 | dev_err(np->device, PFX "SPROM MAC address invalid\n"); | 8515 | dev_err(np->device, "SPROM MAC address invalid [ %pM ]\n", |
8550 | dev_err(np->device, PFX "[ \n"); | 8516 | dev->perm_addr); |
8551 | for (i = 0; i < 6; i++) | ||
8552 | printk("%02x ", dev->perm_addr[i]); | ||
8553 | printk("]\n"); | ||
8554 | return -EINVAL; | 8517 | return -EINVAL; |
8555 | } | 8518 | } |
8556 | 8519 | ||
@@ -8562,8 +8525,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np) | |||
8562 | memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len); | 8525 | memcpy(dev->dev_addr, dev->perm_addr, dev->addr_len); |
8563 | 8526 | ||
8564 | val = nr64(ESPC_MOD_STR_LEN); | 8527 | val = nr64(ESPC_MOD_STR_LEN); |
8565 | niudbg(PROBE, "SPROM: MOD_STR_LEN[%llu]\n", | 8528 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8566 | (unsigned long long) val); | 8529 | "SPROM: MOD_STR_LEN[%llu]\n", (unsigned long long)val); |
8567 | if (val >= 8 * 4) | 8530 | if (val >= 8 * 4) |
8568 | return -EINVAL; | 8531 | return -EINVAL; |
8569 | 8532 | ||
@@ -8578,8 +8541,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np) | |||
8578 | np->vpd.model[val] = '\0'; | 8541 | np->vpd.model[val] = '\0'; |
8579 | 8542 | ||
8580 | val = nr64(ESPC_BD_MOD_STR_LEN); | 8543 | val = nr64(ESPC_BD_MOD_STR_LEN); |
8581 | niudbg(PROBE, "SPROM: BD_MOD_STR_LEN[%llu]\n", | 8544 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8582 | (unsigned long long) val); | 8545 | "SPROM: BD_MOD_STR_LEN[%llu]\n", (unsigned long long)val); |
8583 | if (val >= 4 * 4) | 8546 | if (val >= 4 * 4) |
8584 | return -EINVAL; | 8547 | return -EINVAL; |
8585 | 8548 | ||
@@ -8595,8 +8558,8 @@ static int __devinit niu_pci_probe_sprom(struct niu *np) | |||
8595 | 8558 | ||
8596 | np->vpd.mac_num = | 8559 | np->vpd.mac_num = |
8597 | nr64(ESPC_NUM_PORTS_MACS) & ESPC_NUM_PORTS_MACS_VAL; | 8560 | nr64(ESPC_NUM_PORTS_MACS) & ESPC_NUM_PORTS_MACS_VAL; |
8598 | niudbg(PROBE, "SPROM: NUM_PORTS_MACS[%d]\n", | 8561 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
8599 | np->vpd.mac_num); | 8562 | "SPROM: NUM_PORTS_MACS[%d]\n", np->vpd.mac_num); |
8600 | 8563 | ||
8601 | return 0; | 8564 | return 0; |
8602 | } | 8565 | } |
@@ -8629,8 +8592,6 @@ static int __devinit niu_get_and_validate_port(struct niu *np) | |||
8629 | } | 8592 | } |
8630 | } | 8593 | } |
8631 | 8594 | ||
8632 | niudbg(PROBE, "niu_get_and_validate_port: port[%d] num_ports[%d]\n", | ||
8633 | np->port, parent->num_ports); | ||
8634 | if (np->port >= parent->num_ports) | 8595 | if (np->port >= parent->num_ports) |
8635 | return -ENODEV; | 8596 | return -ENODEV; |
8636 | 8597 | ||
@@ -8659,14 +8620,12 @@ static int __devinit phy_record(struct niu_parent *parent, | |||
8659 | 8620 | ||
8660 | pr_info("niu%d: Found PHY %08x type %s at phy_port %u\n", | 8621 | pr_info("niu%d: Found PHY %08x type %s at phy_port %u\n", |
8661 | parent->index, id, | 8622 | parent->index, id, |
8662 | (type == PHY_TYPE_PMA_PMD ? | 8623 | type == PHY_TYPE_PMA_PMD ? "PMA/PMD" : |
8663 | "PMA/PMD" : | 8624 | type == PHY_TYPE_PCS ? "PCS" : "MII", |
8664 | (type == PHY_TYPE_PCS ? | ||
8665 | "PCS" : "MII")), | ||
8666 | phy_port); | 8625 | phy_port); |
8667 | 8626 | ||
8668 | if (p->cur[type] >= NIU_MAX_PORTS) { | 8627 | if (p->cur[type] >= NIU_MAX_PORTS) { |
8669 | printk(KERN_ERR PFX "Too many PHY ports.\n"); | 8628 | pr_err("Too many PHY ports\n"); |
8670 | return -EINVAL; | 8629 | return -EINVAL; |
8671 | } | 8630 | } |
8672 | idx = p->cur[type]; | 8631 | idx = p->cur[type]; |
@@ -8727,8 +8686,7 @@ static void __devinit niu_n2_divide_channels(struct niu_parent *parent) | |||
8727 | parent->rxchan_per_port[i] = (16 / num_ports); | 8686 | parent->rxchan_per_port[i] = (16 / num_ports); |
8728 | parent->txchan_per_port[i] = (16 / num_ports); | 8687 | parent->txchan_per_port[i] = (16 / num_ports); |
8729 | 8688 | ||
8730 | pr_info(PFX "niu%d: Port %u [%u RX chans] " | 8689 | pr_info("niu%d: Port %u [%u RX chans] [%u TX chans]\n", |
8731 | "[%u TX chans]\n", | ||
8732 | parent->index, i, | 8690 | parent->index, i, |
8733 | parent->rxchan_per_port[i], | 8691 | parent->rxchan_per_port[i], |
8734 | parent->txchan_per_port[i]); | 8692 | parent->txchan_per_port[i]); |
@@ -8771,8 +8729,7 @@ static void __devinit niu_divide_channels(struct niu_parent *parent, | |||
8771 | parent->rxchan_per_port[i] = rx_chans_per_1g; | 8729 | parent->rxchan_per_port[i] = rx_chans_per_1g; |
8772 | parent->txchan_per_port[i] = tx_chans_per_1g; | 8730 | parent->txchan_per_port[i] = tx_chans_per_1g; |
8773 | } | 8731 | } |
8774 | pr_info(PFX "niu%d: Port %u [%u RX chans] " | 8732 | pr_info("niu%d: Port %u [%u RX chans] [%u TX chans]\n", |
8775 | "[%u TX chans]\n", | ||
8776 | parent->index, i, | 8733 | parent->index, i, |
8777 | parent->rxchan_per_port[i], | 8734 | parent->rxchan_per_port[i], |
8778 | parent->txchan_per_port[i]); | 8735 | parent->txchan_per_port[i]); |
@@ -8781,23 +8738,20 @@ static void __devinit niu_divide_channels(struct niu_parent *parent, | |||
8781 | } | 8738 | } |
8782 | 8739 | ||
8783 | if (tot_rx > NIU_NUM_RXCHAN) { | 8740 | if (tot_rx > NIU_NUM_RXCHAN) { |
8784 | printk(KERN_ERR PFX "niu%d: Too many RX channels (%d), " | 8741 | 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); | 8742 | parent->index, tot_rx); |
8787 | for (i = 0; i < num_ports; i++) | 8743 | for (i = 0; i < num_ports; i++) |
8788 | parent->rxchan_per_port[i] = 1; | 8744 | parent->rxchan_per_port[i] = 1; |
8789 | } | 8745 | } |
8790 | if (tot_tx > NIU_NUM_TXCHAN) { | 8746 | if (tot_tx > NIU_NUM_TXCHAN) { |
8791 | printk(KERN_ERR PFX "niu%d: Too many TX channels (%d), " | 8747 | 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); | 8748 | parent->index, tot_tx); |
8794 | for (i = 0; i < num_ports; i++) | 8749 | for (i = 0; i < num_ports; i++) |
8795 | parent->txchan_per_port[i] = 1; | 8750 | parent->txchan_per_port[i] = 1; |
8796 | } | 8751 | } |
8797 | if (tot_rx < NIU_NUM_RXCHAN || tot_tx < NIU_NUM_TXCHAN) { | 8752 | if (tot_rx < NIU_NUM_RXCHAN || tot_tx < NIU_NUM_TXCHAN) { |
8798 | printk(KERN_WARNING PFX "niu%d: Driver bug, wasted channels, " | 8753 | pr_warning("niu%d: Driver bug, wasted channels, RX[%d] TX[%d]\n", |
8799 | "RX[%d] TX[%d]\n", | 8754 | parent->index, tot_rx, tot_tx); |
8800 | parent->index, tot_rx, tot_tx); | ||
8801 | } | 8755 | } |
8802 | } | 8756 | } |
8803 | 8757 | ||
@@ -8825,18 +8779,18 @@ static void __devinit niu_divide_rdc_groups(struct niu_parent *parent, | |||
8825 | struct rdc_table *rt = &tp->tables[grp]; | 8779 | struct rdc_table *rt = &tp->tables[grp]; |
8826 | int slot; | 8780 | int slot; |
8827 | 8781 | ||
8828 | pr_info(PFX "niu%d: Port %d RDC tbl(%d) [ ", | 8782 | pr_info("niu%d: Port %d RDC tbl(%d) [ ", |
8829 | parent->index, i, tp->first_table_num + grp); | 8783 | parent->index, i, tp->first_table_num + grp); |
8830 | for (slot = 0; slot < NIU_RDC_TABLE_SLOTS; slot++) { | 8784 | for (slot = 0; slot < NIU_RDC_TABLE_SLOTS; slot++) { |
8831 | rt->rxdma_channel[slot] = | 8785 | rt->rxdma_channel[slot] = |
8832 | rdc_channel_base + this_channel_offset; | 8786 | rdc_channel_base + this_channel_offset; |
8833 | 8787 | ||
8834 | printk("%d ", rt->rxdma_channel[slot]); | 8788 | pr_cont("%d ", rt->rxdma_channel[slot]); |
8835 | 8789 | ||
8836 | if (++this_channel_offset == num_channels) | 8790 | if (++this_channel_offset == num_channels) |
8837 | this_channel_offset = 0; | 8791 | this_channel_offset = 0; |
8838 | } | 8792 | } |
8839 | printk("]\n"); | 8793 | pr_cont("]\n"); |
8840 | } | 8794 | } |
8841 | 8795 | ||
8842 | parent->rdc_default[i] = rdc_channel_base; | 8796 | parent->rdc_default[i] = rdc_channel_base; |
@@ -8996,8 +8950,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) | |||
8996 | break; | 8950 | break; |
8997 | 8951 | ||
8998 | default: | 8952 | default: |
8999 | printk(KERN_ERR PFX "Unsupported port config " | 8953 | pr_err("Unsupported port config 10G[%d] 1G[%d]\n", |
9000 | "10G[%d] 1G[%d]\n", | ||
9001 | num_10g, num_1g); | 8954 | num_10g, num_1g); |
9002 | return -EINVAL; | 8955 | return -EINVAL; |
9003 | } | 8956 | } |
@@ -9015,8 +8968,7 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent) | |||
9015 | return 0; | 8968 | return 0; |
9016 | 8969 | ||
9017 | unknown_vg_1g_port: | 8970 | unknown_vg_1g_port: |
9018 | printk(KERN_ERR PFX "Cannot identify platform type, 1gport=%d\n", | 8971 | pr_err("Cannot identify platform type, 1gport=%d\n", lowest_1g); |
9019 | lowest_1g); | ||
9020 | return -EINVAL; | 8972 | return -EINVAL; |
9021 | } | 8973 | } |
9022 | 8974 | ||
@@ -9025,9 +8977,6 @@ static int __devinit niu_probe_ports(struct niu *np) | |||
9025 | struct niu_parent *parent = np->parent; | 8977 | struct niu_parent *parent = np->parent; |
9026 | int err, i; | 8978 | int err, i; |
9027 | 8979 | ||
9028 | niudbg(PROBE, "niu_probe_ports(): port_phy[%08x]\n", | ||
9029 | parent->port_phy); | ||
9030 | |||
9031 | if (parent->port_phy == PORT_PHY_UNKNOWN) { | 8980 | if (parent->port_phy == PORT_PHY_UNKNOWN) { |
9032 | err = walk_phys(np, parent); | 8981 | err = walk_phys(np, parent); |
9033 | if (err) | 8982 | if (err) |
@@ -9048,9 +8997,6 @@ static int __devinit niu_classifier_swstate_init(struct niu *np) | |||
9048 | { | 8997 | { |
9049 | struct niu_classifier *cp = &np->clas; | 8998 | struct niu_classifier *cp = &np->clas; |
9050 | 8999 | ||
9051 | niudbg(PROBE, "niu_classifier_swstate_init: num_tcam(%d)\n", | ||
9052 | np->parent->tcam_num_entries); | ||
9053 | |||
9054 | cp->tcam_top = (u16) np->port; | 9000 | cp->tcam_top = (u16) np->port; |
9055 | cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports; | 9001 | cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports; |
9056 | cp->h1_init = 0xffffffff; | 9002 | cp->h1_init = 0xffffffff; |
@@ -9116,8 +9062,7 @@ static int __devinit niu_init_mac_ipp_pcs_base(struct niu *np) | |||
9116 | break; | 9062 | break; |
9117 | 9063 | ||
9118 | default: | 9064 | default: |
9119 | dev_err(np->device, PFX "Port %u is invalid, cannot " | 9065 | 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; | 9066 | return -EINVAL; |
9122 | } | 9067 | } |
9123 | 9068 | ||
@@ -9170,7 +9115,7 @@ static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) | |||
9170 | const u32 *int_prop; | 9115 | const u32 *int_prop; |
9171 | int i; | 9116 | int i; |
9172 | 9117 | ||
9173 | int_prop = of_get_property(op->node, "interrupts", NULL); | 9118 | int_prop = of_get_property(op->dev.of_node, "interrupts", NULL); |
9174 | if (!int_prop) | 9119 | if (!int_prop) |
9175 | return -ENODEV; | 9120 | return -ENODEV; |
9176 | 9121 | ||
@@ -9321,15 +9266,14 @@ static int __devinit niu_get_of_props(struct niu *np) | |||
9321 | int prop_len; | 9266 | int prop_len; |
9322 | 9267 | ||
9323 | if (np->parent->plat_type == PLAT_TYPE_NIU) | 9268 | if (np->parent->plat_type == PLAT_TYPE_NIU) |
9324 | dp = np->op->node; | 9269 | dp = np->op->dev.of_node; |
9325 | else | 9270 | else |
9326 | dp = pci_device_to_OF_node(np->pdev); | 9271 | dp = pci_device_to_OF_node(np->pdev); |
9327 | 9272 | ||
9328 | phy_type = of_get_property(dp, "phy-type", &prop_len); | 9273 | phy_type = of_get_property(dp, "phy-type", &prop_len); |
9329 | if (!phy_type) { | 9274 | if (!phy_type) { |
9330 | dev_err(np->device, PFX "%s: OF node lacks " | 9275 | netdev_err(dev, "%s: OF node lacks phy-type property\n", |
9331 | "phy-type property\n", | 9276 | dp->full_name); |
9332 | dp->full_name); | ||
9333 | return -EINVAL; | 9277 | return -EINVAL; |
9334 | } | 9278 | } |
9335 | 9279 | ||
@@ -9339,34 +9283,26 @@ static int __devinit niu_get_of_props(struct niu *np) | |||
9339 | strcpy(np->vpd.phy_type, phy_type); | 9283 | strcpy(np->vpd.phy_type, phy_type); |
9340 | 9284 | ||
9341 | if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { | 9285 | if (niu_phy_type_prop_decode(np, np->vpd.phy_type)) { |
9342 | dev_err(np->device, PFX "%s: Illegal phy string [%s].\n", | 9286 | netdev_err(dev, "%s: Illegal phy string [%s]\n", |
9343 | dp->full_name, np->vpd.phy_type); | 9287 | dp->full_name, np->vpd.phy_type); |
9344 | return -EINVAL; | 9288 | return -EINVAL; |
9345 | } | 9289 | } |
9346 | 9290 | ||
9347 | mac_addr = of_get_property(dp, "local-mac-address", &prop_len); | 9291 | mac_addr = of_get_property(dp, "local-mac-address", &prop_len); |
9348 | if (!mac_addr) { | 9292 | if (!mac_addr) { |
9349 | dev_err(np->device, PFX "%s: OF node lacks " | 9293 | netdev_err(dev, "%s: OF node lacks local-mac-address property\n", |
9350 | "local-mac-address property\n", | 9294 | dp->full_name); |
9351 | dp->full_name); | ||
9352 | return -EINVAL; | 9295 | return -EINVAL; |
9353 | } | 9296 | } |
9354 | if (prop_len != dev->addr_len) { | 9297 | if (prop_len != dev->addr_len) { |
9355 | dev_err(np->device, PFX "%s: OF MAC address prop len (%d) " | 9298 | netdev_err(dev, "%s: OF MAC address prop len (%d) is wrong\n", |
9356 | "is wrong.\n", | 9299 | dp->full_name, prop_len); |
9357 | dp->full_name, prop_len); | ||
9358 | } | 9300 | } |
9359 | memcpy(dev->perm_addr, mac_addr, dev->addr_len); | 9301 | memcpy(dev->perm_addr, mac_addr, dev->addr_len); |
9360 | if (!is_valid_ether_addr(&dev->perm_addr[0])) { | 9302 | if (!is_valid_ether_addr(&dev->perm_addr[0])) { |
9361 | int i; | 9303 | netdev_err(dev, "%s: OF MAC address is invalid\n", |
9362 | 9304 | dp->full_name); | |
9363 | dev_err(np->device, PFX "%s: OF MAC address is invalid\n", | 9305 | 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; | 9306 | return -EINVAL; |
9371 | } | 9307 | } |
9372 | 9308 | ||
@@ -9414,8 +9350,8 @@ static int __devinit niu_get_invariants(struct niu *np) | |||
9414 | 9350 | ||
9415 | nw64(ESPC_PIO_EN, ESPC_PIO_EN_ENABLE); | 9351 | nw64(ESPC_PIO_EN, ESPC_PIO_EN_ENABLE); |
9416 | offset = niu_pci_vpd_offset(np); | 9352 | offset = niu_pci_vpd_offset(np); |
9417 | niudbg(PROBE, "niu_get_invariants: VPD offset [%08x]\n", | 9353 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
9418 | offset); | 9354 | "%s() VPD offset [%08x]\n", __func__, offset); |
9419 | if (offset) | 9355 | if (offset) |
9420 | niu_pci_vpd_fetch(np, offset); | 9356 | niu_pci_vpd_fetch(np, offset); |
9421 | nw64(ESPC_PIO_EN, 0); | 9357 | nw64(ESPC_PIO_EN, 0); |
@@ -9575,8 +9511,6 @@ static struct niu_parent * __devinit niu_new_parent(struct niu *np, | |||
9575 | struct niu_parent *p; | 9511 | struct niu_parent *p; |
9576 | int i; | 9512 | int i; |
9577 | 9513 | ||
9578 | niudbg(PROBE, "niu_new_parent: Creating new parent.\n"); | ||
9579 | |||
9580 | plat_dev = platform_device_register_simple("niu", niu_parent_index, | 9514 | plat_dev = platform_device_register_simple("niu", niu_parent_index, |
9581 | NULL, 0); | 9515 | NULL, 0); |
9582 | if (IS_ERR(plat_dev)) | 9516 | if (IS_ERR(plat_dev)) |
@@ -9641,9 +9575,6 @@ static struct niu_parent * __devinit niu_get_parent(struct niu *np, | |||
9641 | struct niu_parent *p, *tmp; | 9575 | struct niu_parent *p, *tmp; |
9642 | int port = np->port; | 9576 | int port = np->port; |
9643 | 9577 | ||
9644 | niudbg(PROBE, "niu_get_parent: platform_type[%u] port[%u]\n", | ||
9645 | ptype, port); | ||
9646 | |||
9647 | mutex_lock(&niu_parent_lock); | 9578 | mutex_lock(&niu_parent_lock); |
9648 | p = NULL; | 9579 | p = NULL; |
9649 | list_for_each_entry(tmp, &niu_parent_list, list) { | 9580 | list_for_each_entry(tmp, &niu_parent_list, list) { |
@@ -9681,7 +9612,8 @@ static void niu_put_parent(struct niu *np) | |||
9681 | 9612 | ||
9682 | BUG_ON(!p || p->ports[port] != np); | 9613 | BUG_ON(!p || p->ports[port] != np); |
9683 | 9614 | ||
9684 | niudbg(PROBE, "niu_put_parent: port[%u]\n", port); | 9615 | netif_printk(np, probe, KERN_DEBUG, np->dev, |
9616 | "%s() port[%u]\n", __func__, port); | ||
9685 | 9617 | ||
9686 | sprintf(port_name, "port%d", port); | 9618 | sprintf(port_name, "port%d", port); |
9687 | 9619 | ||
@@ -9772,7 +9704,7 @@ static struct net_device * __devinit niu_alloc_and_init( | |||
9772 | 9704 | ||
9773 | dev = alloc_etherdev_mq(sizeof(struct niu), NIU_NUM_TXCHAN); | 9705 | dev = alloc_etherdev_mq(sizeof(struct niu), NIU_NUM_TXCHAN); |
9774 | if (!dev) { | 9706 | if (!dev) { |
9775 | dev_err(gen_dev, PFX "Etherdev alloc failed, aborting.\n"); | 9707 | dev_err(gen_dev, "Etherdev alloc failed, aborting\n"); |
9776 | return NULL; | 9708 | return NULL; |
9777 | } | 9709 | } |
9778 | 9710 | ||
@@ -9844,6 +9776,12 @@ static void __devinit niu_device_announce(struct niu *np) | |||
9844 | } | 9776 | } |
9845 | } | 9777 | } |
9846 | 9778 | ||
9779 | static void __devinit niu_set_basic_features(struct net_device *dev) | ||
9780 | { | ||
9781 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM | | ||
9782 | NETIF_F_GRO | NETIF_F_RXHASH); | ||
9783 | } | ||
9784 | |||
9847 | static int __devinit niu_pci_init_one(struct pci_dev *pdev, | 9785 | static int __devinit niu_pci_init_one(struct pci_dev *pdev, |
9848 | const struct pci_device_id *ent) | 9786 | const struct pci_device_id *ent) |
9849 | { | 9787 | { |
@@ -9858,30 +9796,26 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9858 | 9796 | ||
9859 | err = pci_enable_device(pdev); | 9797 | err = pci_enable_device(pdev); |
9860 | if (err) { | 9798 | if (err) { |
9861 | dev_err(&pdev->dev, PFX "Cannot enable PCI device, " | 9799 | dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n"); |
9862 | "aborting.\n"); | ||
9863 | return err; | 9800 | return err; |
9864 | } | 9801 | } |
9865 | 9802 | ||
9866 | if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) || | 9803 | if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) || |
9867 | !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { | 9804 | !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { |
9868 | dev_err(&pdev->dev, PFX "Cannot find proper PCI device " | 9805 | dev_err(&pdev->dev, "Cannot find proper PCI device base addresses, aborting\n"); |
9869 | "base addresses, aborting.\n"); | ||
9870 | err = -ENODEV; | 9806 | err = -ENODEV; |
9871 | goto err_out_disable_pdev; | 9807 | goto err_out_disable_pdev; |
9872 | } | 9808 | } |
9873 | 9809 | ||
9874 | err = pci_request_regions(pdev, DRV_MODULE_NAME); | 9810 | err = pci_request_regions(pdev, DRV_MODULE_NAME); |
9875 | if (err) { | 9811 | if (err) { |
9876 | dev_err(&pdev->dev, PFX "Cannot obtain PCI resources, " | 9812 | dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n"); |
9877 | "aborting.\n"); | ||
9878 | goto err_out_disable_pdev; | 9813 | goto err_out_disable_pdev; |
9879 | } | 9814 | } |
9880 | 9815 | ||
9881 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 9816 | pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
9882 | if (pos <= 0) { | 9817 | if (pos <= 0) { |
9883 | dev_err(&pdev->dev, PFX "Cannot find PCI Express capability, " | 9818 | dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n"); |
9884 | "aborting.\n"); | ||
9885 | goto err_out_free_res; | 9819 | goto err_out_free_res; |
9886 | } | 9820 | } |
9887 | 9821 | ||
@@ -9920,27 +9854,23 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9920 | dev->features |= NETIF_F_HIGHDMA; | 9854 | dev->features |= NETIF_F_HIGHDMA; |
9921 | err = pci_set_consistent_dma_mask(pdev, dma_mask); | 9855 | err = pci_set_consistent_dma_mask(pdev, dma_mask); |
9922 | if (err) { | 9856 | if (err) { |
9923 | dev_err(&pdev->dev, PFX "Unable to obtain 44 bit " | 9857 | 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; | 9858 | goto err_out_release_parent; |
9927 | } | 9859 | } |
9928 | } | 9860 | } |
9929 | if (err || dma_mask == DMA_BIT_MASK(32)) { | 9861 | if (err || dma_mask == DMA_BIT_MASK(32)) { |
9930 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 9862 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
9931 | if (err) { | 9863 | if (err) { |
9932 | dev_err(&pdev->dev, PFX "No usable DMA configuration, " | 9864 | dev_err(&pdev->dev, "No usable DMA configuration, aborting\n"); |
9933 | "aborting.\n"); | ||
9934 | goto err_out_release_parent; | 9865 | goto err_out_release_parent; |
9935 | } | 9866 | } |
9936 | } | 9867 | } |
9937 | 9868 | ||
9938 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); | 9869 | niu_set_basic_features(dev); |
9939 | 9870 | ||
9940 | np->regs = pci_ioremap_bar(pdev, 0); | 9871 | np->regs = pci_ioremap_bar(pdev, 0); |
9941 | if (!np->regs) { | 9872 | if (!np->regs) { |
9942 | dev_err(&pdev->dev, PFX "Cannot map device registers, " | 9873 | dev_err(&pdev->dev, "Cannot map device registers, aborting\n"); |
9943 | "aborting.\n"); | ||
9944 | err = -ENOMEM; | 9874 | err = -ENOMEM; |
9945 | goto err_out_release_parent; | 9875 | goto err_out_release_parent; |
9946 | } | 9876 | } |
@@ -9955,15 +9885,13 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9955 | err = niu_get_invariants(np); | 9885 | err = niu_get_invariants(np); |
9956 | if (err) { | 9886 | if (err) { |
9957 | if (err != -ENODEV) | 9887 | if (err != -ENODEV) |
9958 | dev_err(&pdev->dev, PFX "Problem fetching invariants " | 9888 | dev_err(&pdev->dev, "Problem fetching invariants of chip, aborting\n"); |
9959 | "of chip, aborting.\n"); | ||
9960 | goto err_out_iounmap; | 9889 | goto err_out_iounmap; |
9961 | } | 9890 | } |
9962 | 9891 | ||
9963 | err = register_netdev(dev); | 9892 | err = register_netdev(dev); |
9964 | if (err) { | 9893 | if (err) { |
9965 | dev_err(&pdev->dev, PFX "Cannot register net device, " | 9894 | dev_err(&pdev->dev, "Cannot register net device, aborting\n"); |
9966 | "aborting.\n"); | ||
9967 | goto err_out_iounmap; | 9895 | goto err_out_iounmap; |
9968 | } | 9896 | } |
9969 | 9897 | ||
@@ -10155,10 +10083,10 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10155 | 10083 | ||
10156 | niu_driver_version(); | 10084 | niu_driver_version(); |
10157 | 10085 | ||
10158 | reg = of_get_property(op->node, "reg", NULL); | 10086 | reg = of_get_property(op->dev.of_node, "reg", NULL); |
10159 | if (!reg) { | 10087 | if (!reg) { |
10160 | dev_err(&op->dev, PFX "%s: No 'reg' property, aborting.\n", | 10088 | dev_err(&op->dev, "%s: No 'reg' property, aborting\n", |
10161 | op->node->full_name); | 10089 | op->dev.of_node->full_name); |
10162 | return -ENODEV; | 10090 | return -ENODEV; |
10163 | } | 10091 | } |
10164 | 10092 | ||
@@ -10171,7 +10099,7 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10171 | np = netdev_priv(dev); | 10099 | np = netdev_priv(dev); |
10172 | 10100 | ||
10173 | memset(&parent_id, 0, sizeof(parent_id)); | 10101 | memset(&parent_id, 0, sizeof(parent_id)); |
10174 | parent_id.of = of_get_parent(op->node); | 10102 | parent_id.of = of_get_parent(op->dev.of_node); |
10175 | 10103 | ||
10176 | np->parent = niu_get_parent(np, &parent_id, | 10104 | np->parent = niu_get_parent(np, &parent_id, |
10177 | PLAT_TYPE_NIU); | 10105 | PLAT_TYPE_NIU); |
@@ -10180,14 +10108,13 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10180 | goto err_out_free_dev; | 10108 | goto err_out_free_dev; |
10181 | } | 10109 | } |
10182 | 10110 | ||
10183 | dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); | 10111 | niu_set_basic_features(dev); |
10184 | 10112 | ||
10185 | np->regs = of_ioremap(&op->resource[1], 0, | 10113 | np->regs = of_ioremap(&op->resource[1], 0, |
10186 | resource_size(&op->resource[1]), | 10114 | resource_size(&op->resource[1]), |
10187 | "niu regs"); | 10115 | "niu regs"); |
10188 | if (!np->regs) { | 10116 | if (!np->regs) { |
10189 | dev_err(&op->dev, PFX "Cannot map device registers, " | 10117 | dev_err(&op->dev, "Cannot map device registers, aborting\n"); |
10190 | "aborting.\n"); | ||
10191 | err = -ENOMEM; | 10118 | err = -ENOMEM; |
10192 | goto err_out_release_parent; | 10119 | goto err_out_release_parent; |
10193 | } | 10120 | } |
@@ -10196,8 +10123,7 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10196 | resource_size(&op->resource[2]), | 10123 | resource_size(&op->resource[2]), |
10197 | "niu vregs-1"); | 10124 | "niu vregs-1"); |
10198 | if (!np->vir_regs_1) { | 10125 | if (!np->vir_regs_1) { |
10199 | dev_err(&op->dev, PFX "Cannot map device vir registers 1, " | 10126 | dev_err(&op->dev, "Cannot map device vir registers 1, aborting\n"); |
10200 | "aborting.\n"); | ||
10201 | err = -ENOMEM; | 10127 | err = -ENOMEM; |
10202 | goto err_out_iounmap; | 10128 | goto err_out_iounmap; |
10203 | } | 10129 | } |
@@ -10206,8 +10132,7 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10206 | resource_size(&op->resource[3]), | 10132 | resource_size(&op->resource[3]), |
10207 | "niu vregs-2"); | 10133 | "niu vregs-2"); |
10208 | if (!np->vir_regs_2) { | 10134 | if (!np->vir_regs_2) { |
10209 | dev_err(&op->dev, PFX "Cannot map device vir registers 2, " | 10135 | dev_err(&op->dev, "Cannot map device vir registers 2, aborting\n"); |
10210 | "aborting.\n"); | ||
10211 | err = -ENOMEM; | 10136 | err = -ENOMEM; |
10212 | goto err_out_iounmap; | 10137 | goto err_out_iounmap; |
10213 | } | 10138 | } |
@@ -10217,15 +10142,13 @@ static int __devinit niu_of_probe(struct of_device *op, | |||
10217 | err = niu_get_invariants(np); | 10142 | err = niu_get_invariants(np); |
10218 | if (err) { | 10143 | if (err) { |
10219 | if (err != -ENODEV) | 10144 | if (err != -ENODEV) |
10220 | dev_err(&op->dev, PFX "Problem fetching invariants " | 10145 | dev_err(&op->dev, "Problem fetching invariants of chip, aborting\n"); |
10221 | "of chip, aborting.\n"); | ||
10222 | goto err_out_iounmap; | 10146 | goto err_out_iounmap; |
10223 | } | 10147 | } |
10224 | 10148 | ||
10225 | err = register_netdev(dev); | 10149 | err = register_netdev(dev); |
10226 | if (err) { | 10150 | if (err) { |
10227 | dev_err(&op->dev, PFX "Cannot register net device, " | 10151 | dev_err(&op->dev, "Cannot register net device, aborting\n"); |
10228 | "aborting.\n"); | ||
10229 | goto err_out_iounmap; | 10152 | goto err_out_iounmap; |
10230 | } | 10153 | } |
10231 | 10154 | ||
@@ -10311,8 +10234,11 @@ static const struct of_device_id niu_match[] = { | |||
10311 | MODULE_DEVICE_TABLE(of, niu_match); | 10234 | MODULE_DEVICE_TABLE(of, niu_match); |
10312 | 10235 | ||
10313 | static struct of_platform_driver niu_of_driver = { | 10236 | static struct of_platform_driver niu_of_driver = { |
10314 | .name = "niu", | 10237 | .driver = { |
10315 | .match_table = niu_match, | 10238 | .name = "niu", |
10239 | .owner = THIS_MODULE, | ||
10240 | .of_match_table = niu_match, | ||
10241 | }, | ||
10316 | .probe = niu_of_probe, | 10242 | .probe = niu_of_probe, |
10317 | .remove = __devexit_p(niu_of_remove), | 10243 | .remove = __devexit_p(niu_of_remove), |
10318 | }; | 10244 | }; |