aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r--drivers/net/e100.c190
1 files changed, 101 insertions, 89 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 791080303db1..b194bad29ace 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -147,6 +147,8 @@
147 * - add clean lowlevel I/O emulation for cards with MII-lacking PHYs 147 * - add clean lowlevel I/O emulation for cards with MII-lacking PHYs
148 */ 148 */
149 149
150#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
151
150#include <linux/module.h> 152#include <linux/module.h>
151#include <linux/moduleparam.h> 153#include <linux/moduleparam.h>
152#include <linux/kernel.h> 154#include <linux/kernel.h>
@@ -175,7 +177,6 @@
175#define DRV_VERSION "3.5.24-k2"DRV_EXT 177#define DRV_VERSION "3.5.24-k2"DRV_EXT
176#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" 178#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver"
177#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" 179#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation"
178#define PFX DRV_NAME ": "
179 180
180#define E100_WATCHDOG_PERIOD (2 * HZ) 181#define E100_WATCHDOG_PERIOD (2 * HZ)
181#define E100_NAPI_WEIGHT 16 182#define E100_NAPI_WEIGHT 16
@@ -201,10 +202,6 @@ module_param(use_io, int, 0);
201MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); 202MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
202MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums"); 203MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums");
203MODULE_PARM_DESC(use_io, "Force use of i/o access mode"); 204MODULE_PARM_DESC(use_io, "Force use of i/o access mode");
204#define DPRINTK(nlevel, klevel, fmt, args...) \
205 (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \
206 printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \
207 __func__ , ## args))
208 205
209#define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\ 206#define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\
210 PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \ 207 PCI_VENDOR_ID_INTEL, device_id, PCI_ANY_ID, PCI_ANY_ID, \
@@ -690,12 +687,13 @@ static int e100_self_test(struct nic *nic)
690 687
691 /* Check results of self-test */ 688 /* Check results of self-test */
692 if (nic->mem->selftest.result != 0) { 689 if (nic->mem->selftest.result != 0) {
693 DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n", 690 netif_err(nic, hw, nic->netdev,
694 nic->mem->selftest.result); 691 "Self-test failed: result=0x%08X\n",
692 nic->mem->selftest.result);
695 return -ETIMEDOUT; 693 return -ETIMEDOUT;
696 } 694 }
697 if (nic->mem->selftest.signature == 0) { 695 if (nic->mem->selftest.signature == 0) {
698 DPRINTK(HW, ERR, "Self-test failed: timed out\n"); 696 netif_err(nic, hw, nic->netdev, "Self-test failed: timed out\n");
699 return -ETIMEDOUT; 697 return -ETIMEDOUT;
700 } 698 }
701 699
@@ -798,7 +796,7 @@ static int e100_eeprom_load(struct nic *nic)
798 /* The checksum, stored in the last word, is calculated such that 796 /* The checksum, stored in the last word, is calculated such that
799 * the sum of words should be 0xBABA */ 797 * the sum of words should be 0xBABA */
800 if (cpu_to_le16(0xBABA - checksum) != nic->eeprom[nic->eeprom_wc - 1]) { 798 if (cpu_to_le16(0xBABA - checksum) != nic->eeprom[nic->eeprom_wc - 1]) {
801 DPRINTK(PROBE, ERR, "EEPROM corrupted\n"); 799 netif_err(nic, probe, nic->netdev, "EEPROM corrupted\n");
802 if (!eeprom_bad_csum_allow) 800 if (!eeprom_bad_csum_allow)
803 return -EAGAIN; 801 return -EAGAIN;
804 } 802 }
@@ -954,8 +952,7 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
954 udelay(20); 952 udelay(20);
955 } 953 }
956 if (unlikely(!i)) { 954 if (unlikely(!i)) {
957 printk("e100.mdio_ctrl(%s) won't go Ready\n", 955 netdev_err(nic->netdev, "e100.mdio_ctrl won't go Ready\n");
958 nic->netdev->name );
959 spin_unlock_irqrestore(&nic->mdio_lock, flags); 956 spin_unlock_irqrestore(&nic->mdio_lock, flags);
960 return 0; /* No way to indicate timeout error */ 957 return 0; /* No way to indicate timeout error */
961 } 958 }
@@ -967,9 +964,10 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
967 break; 964 break;
968 } 965 }
969 spin_unlock_irqrestore(&nic->mdio_lock, flags); 966 spin_unlock_irqrestore(&nic->mdio_lock, flags);
970 DPRINTK(HW, DEBUG, 967 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
971 "%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n", 968 "%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n",
972 dir == mdi_read ? "READ" : "WRITE", addr, reg, data, data_out); 969 dir == mdi_read ? "READ" : "WRITE",
970 addr, reg, data, data_out);
973 return (u16)data_out; 971 return (u16)data_out;
974} 972}
975 973
@@ -1029,17 +1027,19 @@ static u16 mdio_ctrl_phy_mii_emulated(struct nic *nic,
1029 return ADVERTISE_10HALF | 1027 return ADVERTISE_10HALF |
1030 ADVERTISE_10FULL; 1028 ADVERTISE_10FULL;
1031 default: 1029 default:
1032 DPRINTK(HW, DEBUG, 1030 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1033 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n", 1031 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n",
1034 dir == mdi_read ? "READ" : "WRITE", addr, reg, data); 1032 dir == mdi_read ? "READ" : "WRITE",
1033 addr, reg, data);
1035 return 0xFFFF; 1034 return 0xFFFF;
1036 } 1035 }
1037 } else { 1036 } else {
1038 switch (reg) { 1037 switch (reg) {
1039 default: 1038 default:
1040 DPRINTK(HW, DEBUG, 1039 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1041 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n", 1040 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n",
1042 dir == mdi_read ? "READ" : "WRITE", addr, reg, data); 1041 dir == mdi_read ? "READ" : "WRITE",
1042 addr, reg, data);
1043 return 0xFFFF; 1043 return 0xFFFF;
1044 } 1044 }
1045 } 1045 }
@@ -1156,12 +1156,15 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
1156 } 1156 }
1157 } 1157 }
1158 1158
1159 DPRINTK(HW, DEBUG, "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", 1159 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1160 c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]); 1160 "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
1161 DPRINTK(HW, DEBUG, "[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", 1161 c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7]);
1162 c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]); 1162 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1163 DPRINTK(HW, DEBUG, "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", 1163 "[08-15]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
1164 c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); 1164 c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15]);
1165 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1166 "[16-23]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
1167 c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]);
1165} 1168}
1166 1169
1167/************************************************************************* 1170/*************************************************************************
@@ -1254,16 +1257,18 @@ static const struct firmware *e100_request_firmware(struct nic *nic)
1254 err = request_firmware(&fw, fw_name, &nic->pdev->dev); 1257 err = request_firmware(&fw, fw_name, &nic->pdev->dev);
1255 1258
1256 if (err) { 1259 if (err) {
1257 DPRINTK(PROBE, ERR, "Failed to load firmware \"%s\": %d\n", 1260 netif_err(nic, probe, nic->netdev,
1258 fw_name, err); 1261 "Failed to load firmware \"%s\": %d\n",
1262 fw_name, err);
1259 return ERR_PTR(err); 1263 return ERR_PTR(err);
1260 } 1264 }
1261 1265
1262 /* Firmware should be precisely UCODE_SIZE (words) plus three bytes 1266 /* Firmware should be precisely UCODE_SIZE (words) plus three bytes
1263 indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */ 1267 indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */
1264 if (fw->size != UCODE_SIZE * 4 + 3) { 1268 if (fw->size != UCODE_SIZE * 4 + 3) {
1265 DPRINTK(PROBE, ERR, "Firmware \"%s\" has wrong size %zu\n", 1269 netif_err(nic, probe, nic->netdev,
1266 fw_name, fw->size); 1270 "Firmware \"%s\" has wrong size %zu\n",
1271 fw_name, fw->size);
1267 release_firmware(fw); 1272 release_firmware(fw);
1268 return ERR_PTR(-EINVAL); 1273 return ERR_PTR(-EINVAL);
1269 } 1274 }
@@ -1275,9 +1280,9 @@ static const struct firmware *e100_request_firmware(struct nic *nic)
1275 1280
1276 if (timer >= UCODE_SIZE || bundle >= UCODE_SIZE || 1281 if (timer >= UCODE_SIZE || bundle >= UCODE_SIZE ||
1277 min_size >= UCODE_SIZE) { 1282 min_size >= UCODE_SIZE) {
1278 DPRINTK(PROBE, ERR, 1283 netif_err(nic, probe, nic->netdev,
1279 "\"%s\" has bogus offset values (0x%x,0x%x,0x%x)\n", 1284 "\"%s\" has bogus offset values (0x%x,0x%x,0x%x)\n",
1280 fw_name, timer, bundle, min_size); 1285 fw_name, timer, bundle, min_size);
1281 release_firmware(fw); 1286 release_firmware(fw);
1282 return ERR_PTR(-EINVAL); 1287 return ERR_PTR(-EINVAL);
1283 } 1288 }
@@ -1329,7 +1334,8 @@ static inline int e100_load_ucode_wait(struct nic *nic)
1329 return PTR_ERR(fw); 1334 return PTR_ERR(fw);
1330 1335
1331 if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode))) 1336 if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode)))
1332 DPRINTK(PROBE,ERR, "ucode cmd failed with error %d\n", err); 1337 netif_err(nic, probe, nic->netdev,
1338 "ucode cmd failed with error %d\n", err);
1333 1339
1334 /* must restart cuc */ 1340 /* must restart cuc */
1335 nic->cuc_cmd = cuc_start; 1341 nic->cuc_cmd = cuc_start;
@@ -1349,7 +1355,7 @@ static inline int e100_load_ucode_wait(struct nic *nic)
1349 1355
1350 /* if the command failed, or is not OK, notify and return */ 1356 /* if the command failed, or is not OK, notify and return */
1351 if (!counter || !(cb->status & cpu_to_le16(cb_ok))) { 1357 if (!counter || !(cb->status & cpu_to_le16(cb_ok))) {
1352 DPRINTK(PROBE,ERR, "ucode load failed\n"); 1358 netif_err(nic, probe, nic->netdev, "ucode load failed\n");
1353 err = -EPERM; 1359 err = -EPERM;
1354 } 1360 }
1355 1361
@@ -1387,8 +1393,8 @@ static int e100_phy_check_without_mii(struct nic *nic)
1387 * media is sensed automatically based on how the link partner 1393 * media is sensed automatically based on how the link partner
1388 * is configured. This is, in essence, manual configuration. 1394 * is configured. This is, in essence, manual configuration.
1389 */ 1395 */
1390 DPRINTK(PROBE, INFO, 1396 netif_info(nic, probe, nic->netdev,
1391 "found MII-less i82503 or 80c24 or other PHY\n"); 1397 "found MII-less i82503 or 80c24 or other PHY\n");
1392 1398
1393 nic->mdio_ctrl = mdio_ctrl_phy_mii_emulated; 1399 nic->mdio_ctrl = mdio_ctrl_phy_mii_emulated;
1394 nic->mii.phy_id = 0; /* is this ok for an MII-less PHY? */ 1400 nic->mii.phy_id = 0; /* is this ok for an MII-less PHY? */
@@ -1435,18 +1441,20 @@ static int e100_phy_init(struct nic *nic)
1435 return 0; /* simply return and hope for the best */ 1441 return 0; /* simply return and hope for the best */
1436 else { 1442 else {
1437 /* for unknown cases log a fatal error */ 1443 /* for unknown cases log a fatal error */
1438 DPRINTK(HW, ERR, 1444 netif_err(nic, hw, nic->netdev,
1439 "Failed to locate any known PHY, aborting.\n"); 1445 "Failed to locate any known PHY, aborting\n");
1440 return -EAGAIN; 1446 return -EAGAIN;
1441 } 1447 }
1442 } else 1448 } else
1443 DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id); 1449 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1450 "phy_addr = %d\n", nic->mii.phy_id);
1444 1451
1445 /* Get phy ID */ 1452 /* Get phy ID */
1446 id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1); 1453 id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1);
1447 id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2); 1454 id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2);
1448 nic->phy = (u32)id_hi << 16 | (u32)id_lo; 1455 nic->phy = (u32)id_hi << 16 | (u32)id_lo;
1449 DPRINTK(HW, DEBUG, "phy ID = 0x%08X\n", nic->phy); 1456 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1457 "phy ID = 0x%08X\n", nic->phy);
1450 1458
1451 /* Select the phy and isolate the rest */ 1459 /* Select the phy and isolate the rest */
1452 for (addr = 0; addr < 32; addr++) { 1460 for (addr = 0; addr < 32; addr++) {
@@ -1508,7 +1516,7 @@ static int e100_hw_init(struct nic *nic)
1508 1516
1509 e100_hw_reset(nic); 1517 e100_hw_reset(nic);
1510 1518
1511 DPRINTK(HW, ERR, "e100_hw_init\n"); 1519 netif_err(nic, hw, nic->netdev, "e100_hw_init\n");
1512 if (!in_interrupt() && (err = e100_self_test(nic))) 1520 if (!in_interrupt() && (err = e100_self_test(nic)))
1513 return err; 1521 return err;
1514 1522
@@ -1538,16 +1546,16 @@ static int e100_hw_init(struct nic *nic)
1538static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb) 1546static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb)
1539{ 1547{
1540 struct net_device *netdev = nic->netdev; 1548 struct net_device *netdev = nic->netdev;
1541 struct dev_mc_list *list; 1549 struct netdev_hw_addr *ha;
1542 u16 i, count = min(netdev_mc_count(netdev), E100_MAX_MULTICAST_ADDRS); 1550 u16 i, count = min(netdev_mc_count(netdev), E100_MAX_MULTICAST_ADDRS);
1543 1551
1544 cb->command = cpu_to_le16(cb_multi); 1552 cb->command = cpu_to_le16(cb_multi);
1545 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN); 1553 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN);
1546 i = 0; 1554 i = 0;
1547 netdev_for_each_mc_addr(list, netdev) { 1555 netdev_for_each_mc_addr(ha, netdev) {
1548 if (i == count) 1556 if (i == count)
1549 break; 1557 break;
1550 memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &list->dmi_addr, 1558 memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr,
1551 ETH_ALEN); 1559 ETH_ALEN);
1552 } 1560 }
1553} 1561}
@@ -1556,8 +1564,9 @@ static void e100_set_multicast_list(struct net_device *netdev)
1556{ 1564{
1557 struct nic *nic = netdev_priv(netdev); 1565 struct nic *nic = netdev_priv(netdev);
1558 1566
1559 DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n", 1567 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1560 netdev_mc_count(netdev), netdev->flags); 1568 "mc_count=%d, flags=0x%04X\n",
1569 netdev_mc_count(netdev), netdev->flags);
1561 1570
1562 if (netdev->flags & IFF_PROMISC) 1571 if (netdev->flags & IFF_PROMISC)
1563 nic->flags |= promiscuous; 1572 nic->flags |= promiscuous;
@@ -1630,7 +1639,8 @@ static void e100_update_stats(struct nic *nic)
1630 1639
1631 1640
1632 if (e100_exec_cmd(nic, cuc_dump_reset, 0)) 1641 if (e100_exec_cmd(nic, cuc_dump_reset, 0))
1633 DPRINTK(TX_ERR, DEBUG, "exec cuc_dump_reset failed\n"); 1642 netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
1643 "exec cuc_dump_reset failed\n");
1634} 1644}
1635 1645
1636static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex) 1646static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex)
@@ -1660,20 +1670,19 @@ static void e100_watchdog(unsigned long data)
1660 struct nic *nic = (struct nic *)data; 1670 struct nic *nic = (struct nic *)data;
1661 struct ethtool_cmd cmd; 1671 struct ethtool_cmd cmd;
1662 1672
1663 DPRINTK(TIMER, DEBUG, "right now = %ld\n", jiffies); 1673 netif_printk(nic, timer, KERN_DEBUG, nic->netdev,
1674 "right now = %ld\n", jiffies);
1664 1675
1665 /* mii library handles link maintenance tasks */ 1676 /* mii library handles link maintenance tasks */
1666 1677
1667 mii_ethtool_gset(&nic->mii, &cmd); 1678 mii_ethtool_gset(&nic->mii, &cmd);
1668 1679
1669 if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { 1680 if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) {
1670 printk(KERN_INFO "e100: %s NIC Link is Up %s Mbps %s Duplex\n", 1681 netdev_info(nic->netdev, "NIC Link is Up %u Mbps %s Duplex\n",
1671 nic->netdev->name, 1682 cmd.speed == SPEED_100 ? 100 : 10,
1672 cmd.speed == SPEED_100 ? "100" : "10", 1683 cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
1673 cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
1674 } else if (!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) { 1684 } else if (!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
1675 printk(KERN_INFO "e100: %s NIC Link is Down\n", 1685 netdev_info(nic->netdev, "NIC Link is Down\n");
1676 nic->netdev->name);
1677 } 1686 }
1678 1687
1679 mii_check_link(&nic->mii); 1688 mii_check_link(&nic->mii);
@@ -1733,7 +1742,8 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
1733 Issue a NOP command followed by a 1us delay before 1742 Issue a NOP command followed by a 1us delay before
1734 issuing the Tx command. */ 1743 issuing the Tx command. */
1735 if (e100_exec_cmd(nic, cuc_nop, 0)) 1744 if (e100_exec_cmd(nic, cuc_nop, 0))
1736 DPRINTK(TX_ERR, DEBUG, "exec cuc_nop failed\n"); 1745 netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
1746 "exec cuc_nop failed\n");
1737 udelay(1); 1747 udelay(1);
1738 } 1748 }
1739 1749
@@ -1742,17 +1752,18 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
1742 switch (err) { 1752 switch (err) {
1743 case -ENOSPC: 1753 case -ENOSPC:
1744 /* We queued the skb, but now we're out of space. */ 1754 /* We queued the skb, but now we're out of space. */
1745 DPRINTK(TX_ERR, DEBUG, "No space for CB\n"); 1755 netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
1756 "No space for CB\n");
1746 netif_stop_queue(netdev); 1757 netif_stop_queue(netdev);
1747 break; 1758 break;
1748 case -ENOMEM: 1759 case -ENOMEM:
1749 /* This is a hard error - log it. */ 1760 /* This is a hard error - log it. */
1750 DPRINTK(TX_ERR, DEBUG, "Out of Tx resources, returning skb\n"); 1761 netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
1762 "Out of Tx resources, returning skb\n");
1751 netif_stop_queue(netdev); 1763 netif_stop_queue(netdev);
1752 return NETDEV_TX_BUSY; 1764 return NETDEV_TX_BUSY;
1753 } 1765 }
1754 1766
1755 netdev->trans_start = jiffies;
1756 return NETDEV_TX_OK; 1767 return NETDEV_TX_OK;
1757} 1768}
1758 1769
@@ -1768,9 +1779,10 @@ static int e100_tx_clean(struct nic *nic)
1768 for (cb = nic->cb_to_clean; 1779 for (cb = nic->cb_to_clean;
1769 cb->status & cpu_to_le16(cb_complete); 1780 cb->status & cpu_to_le16(cb_complete);
1770 cb = nic->cb_to_clean = cb->next) { 1781 cb = nic->cb_to_clean = cb->next) {
1771 DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n", 1782 netif_printk(nic, tx_done, KERN_DEBUG, nic->netdev,
1772 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)), 1783 "cb[%d]->status = 0x%04X\n",
1773 cb->status); 1784 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
1785 cb->status);
1774 1786
1775 if (likely(cb->skb != NULL)) { 1787 if (likely(cb->skb != NULL)) {
1776 dev->stats.tx_packets++; 1788 dev->stats.tx_packets++;
@@ -1913,7 +1925,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1913 sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL); 1925 sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL);
1914 rfd_status = le16_to_cpu(rfd->status); 1926 rfd_status = le16_to_cpu(rfd->status);
1915 1927
1916 DPRINTK(RX_STATUS, DEBUG, "status=0x%04X\n", rfd_status); 1928 netif_printk(nic, rx_status, KERN_DEBUG, nic->netdev,
1929 "status=0x%04X\n", rfd_status);
1917 1930
1918 /* If data isn't ready, nothing to indicate */ 1931 /* If data isn't ready, nothing to indicate */
1919 if (unlikely(!(rfd_status & cb_complete))) { 1932 if (unlikely(!(rfd_status & cb_complete))) {
@@ -2124,7 +2137,8 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
2124 struct nic *nic = netdev_priv(netdev); 2137 struct nic *nic = netdev_priv(netdev);
2125 u8 stat_ack = ioread8(&nic->csr->scb.stat_ack); 2138 u8 stat_ack = ioread8(&nic->csr->scb.stat_ack);
2126 2139
2127 DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack); 2140 netif_printk(nic, intr, KERN_DEBUG, nic->netdev,
2141 "stat_ack = 0x%02X\n", stat_ack);
2128 2142
2129 if (stat_ack == stat_ack_not_ours || /* Not our interrupt */ 2143 if (stat_ack == stat_ack_not_ours || /* Not our interrupt */
2130 stat_ack == stat_ack_not_present) /* Hardware is ejected */ 2144 stat_ack == stat_ack_not_present) /* Hardware is ejected */
@@ -2264,8 +2278,8 @@ static void e100_tx_timeout_task(struct work_struct *work)
2264 struct nic *nic = container_of(work, struct nic, tx_timeout_task); 2278 struct nic *nic = container_of(work, struct nic, tx_timeout_task);
2265 struct net_device *netdev = nic->netdev; 2279 struct net_device *netdev = nic->netdev;
2266 2280
2267 DPRINTK(TX_ERR, DEBUG, "scb.status=0x%02X\n", 2281 netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
2268 ioread8(&nic->csr->scb.status)); 2282 "scb.status=0x%02X\n", ioread8(&nic->csr->scb.status));
2269 2283
2270 rtnl_lock(); 2284 rtnl_lock();
2271 if (netif_running(netdev)) { 2285 if (netif_running(netdev)) {
@@ -2532,8 +2546,8 @@ static int e100_set_ringparam(struct net_device *netdev,
2532 rfds->count = min(rfds->count, rfds->max); 2546 rfds->count = min(rfds->count, rfds->max);
2533 cbs->count = max(ring->tx_pending, cbs->min); 2547 cbs->count = max(ring->tx_pending, cbs->min);
2534 cbs->count = min(cbs->count, cbs->max); 2548 cbs->count = min(cbs->count, cbs->max);
2535 DPRINTK(DRV, INFO, "Ring Param settings: rx: %d, tx %d\n", 2549 netif_info(nic, drv, nic->netdev, "Ring Param settings: rx: %d, tx %d\n",
2536 rfds->count, cbs->count); 2550 rfds->count, cbs->count);
2537 if (netif_running(netdev)) 2551 if (netif_running(netdev))
2538 e100_up(nic); 2552 e100_up(nic);
2539 2553
@@ -2710,7 +2724,7 @@ static int e100_open(struct net_device *netdev)
2710 2724
2711 netif_carrier_off(netdev); 2725 netif_carrier_off(netdev);
2712 if ((err = e100_up(nic))) 2726 if ((err = e100_up(nic)))
2713 DPRINTK(IFUP, ERR, "Cannot open interface, aborting.\n"); 2727 netif_err(nic, ifup, nic->netdev, "Cannot open interface, aborting\n");
2714 return err; 2728 return err;
2715} 2729}
2716 2730
@@ -2744,7 +2758,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2744 2758
2745 if (!(netdev = alloc_etherdev(sizeof(struct nic)))) { 2759 if (!(netdev = alloc_etherdev(sizeof(struct nic)))) {
2746 if (((1 << debug) - 1) & NETIF_MSG_PROBE) 2760 if (((1 << debug) - 1) & NETIF_MSG_PROBE)
2747 printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n"); 2761 pr_err("Etherdev alloc failed, aborting\n");
2748 return -ENOMEM; 2762 return -ENOMEM;
2749 } 2763 }
2750 2764
@@ -2762,35 +2776,34 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2762 pci_set_drvdata(pdev, netdev); 2776 pci_set_drvdata(pdev, netdev);
2763 2777
2764 if ((err = pci_enable_device(pdev))) { 2778 if ((err = pci_enable_device(pdev))) {
2765 DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n"); 2779 netif_err(nic, probe, nic->netdev, "Cannot enable PCI device, aborting\n");
2766 goto err_out_free_dev; 2780 goto err_out_free_dev;
2767 } 2781 }
2768 2782
2769 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 2783 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
2770 DPRINTK(PROBE, ERR, "Cannot find proper PCI device " 2784 netif_err(nic, probe, nic->netdev, "Cannot find proper PCI device base address, aborting\n");
2771 "base address, aborting.\n");
2772 err = -ENODEV; 2785 err = -ENODEV;
2773 goto err_out_disable_pdev; 2786 goto err_out_disable_pdev;
2774 } 2787 }
2775 2788
2776 if ((err = pci_request_regions(pdev, DRV_NAME))) { 2789 if ((err = pci_request_regions(pdev, DRV_NAME))) {
2777 DPRINTK(PROBE, ERR, "Cannot obtain PCI resources, aborting.\n"); 2790 netif_err(nic, probe, nic->netdev, "Cannot obtain PCI resources, aborting\n");
2778 goto err_out_disable_pdev; 2791 goto err_out_disable_pdev;
2779 } 2792 }
2780 2793
2781 if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { 2794 if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
2782 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); 2795 netif_err(nic, probe, nic->netdev, "No usable DMA configuration, aborting\n");
2783 goto err_out_free_res; 2796 goto err_out_free_res;
2784 } 2797 }
2785 2798
2786 SET_NETDEV_DEV(netdev, &pdev->dev); 2799 SET_NETDEV_DEV(netdev, &pdev->dev);
2787 2800
2788 if (use_io) 2801 if (use_io)
2789 DPRINTK(PROBE, INFO, "using i/o access mode\n"); 2802 netif_info(nic, probe, nic->netdev, "using i/o access mode\n");
2790 2803
2791 nic->csr = pci_iomap(pdev, (use_io ? 1 : 0), sizeof(struct csr)); 2804 nic->csr = pci_iomap(pdev, (use_io ? 1 : 0), sizeof(struct csr));
2792 if (!nic->csr) { 2805 if (!nic->csr) {
2793 DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n"); 2806 netif_err(nic, probe, nic->netdev, "Cannot map device registers, aborting\n");
2794 err = -ENOMEM; 2807 err = -ENOMEM;
2795 goto err_out_free_res; 2808 goto err_out_free_res;
2796 } 2809 }
@@ -2824,7 +2837,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2824 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task); 2837 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task);
2825 2838
2826 if ((err = e100_alloc(nic))) { 2839 if ((err = e100_alloc(nic))) {
2827 DPRINTK(PROBE, ERR, "Cannot alloc driver memory, aborting.\n"); 2840 netif_err(nic, probe, nic->netdev, "Cannot alloc driver memory, aborting\n");
2828 goto err_out_iounmap; 2841 goto err_out_iounmap;
2829 } 2842 }
2830 2843
@@ -2837,13 +2850,11 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2837 memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN); 2850 memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN);
2838 if (!is_valid_ether_addr(netdev->perm_addr)) { 2851 if (!is_valid_ether_addr(netdev->perm_addr)) {
2839 if (!eeprom_bad_csum_allow) { 2852 if (!eeprom_bad_csum_allow) {
2840 DPRINTK(PROBE, ERR, "Invalid MAC address from " 2853 netif_err(nic, probe, nic->netdev, "Invalid MAC address from EEPROM, aborting\n");
2841 "EEPROM, aborting.\n");
2842 err = -EAGAIN; 2854 err = -EAGAIN;
2843 goto err_out_free; 2855 goto err_out_free;
2844 } else { 2856 } else {
2845 DPRINTK(PROBE, ERR, "Invalid MAC address from EEPROM, " 2857 netif_err(nic, probe, nic->netdev, "Invalid MAC address from EEPROM, you MUST configure one.\n");
2846 "you MUST configure one.\n");
2847 } 2858 }
2848 } 2859 }
2849 2860
@@ -2859,7 +2870,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2859 2870
2860 strcpy(netdev->name, "eth%d"); 2871 strcpy(netdev->name, "eth%d");
2861 if ((err = register_netdev(netdev))) { 2872 if ((err = register_netdev(netdev))) {
2862 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); 2873 netif_err(nic, probe, nic->netdev, "Cannot register net device, aborting\n");
2863 goto err_out_free; 2874 goto err_out_free;
2864 } 2875 }
2865 nic->cbs_pool = pci_pool_create(netdev->name, 2876 nic->cbs_pool = pci_pool_create(netdev->name,
@@ -2867,9 +2878,10 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2867 nic->params.cbs.max * sizeof(struct cb), 2878 nic->params.cbs.max * sizeof(struct cb),
2868 sizeof(u32), 2879 sizeof(u32),
2869 0); 2880 0);
2870 DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", 2881 netif_info(nic, probe, nic->netdev,
2871 (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), 2882 "addr 0x%llx, irq %d, MAC addr %pM\n",
2872 pdev->irq, netdev->dev_addr); 2883 (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
2884 pdev->irq, netdev->dev_addr);
2873 2885
2874 return 0; 2886 return 0;
2875 2887
@@ -3027,7 +3039,7 @@ static pci_ers_result_t e100_io_slot_reset(struct pci_dev *pdev)
3027 struct nic *nic = netdev_priv(netdev); 3039 struct nic *nic = netdev_priv(netdev);
3028 3040
3029 if (pci_enable_device(pdev)) { 3041 if (pci_enable_device(pdev)) {
3030 printk(KERN_ERR "e100: Cannot re-enable PCI device after reset.\n"); 3042 pr_err("Cannot re-enable PCI device after reset\n");
3031 return PCI_ERS_RESULT_DISCONNECT; 3043 return PCI_ERS_RESULT_DISCONNECT;
3032 } 3044 }
3033 pci_set_master(pdev); 3045 pci_set_master(pdev);
@@ -3086,8 +3098,8 @@ static struct pci_driver e100_driver = {
3086static int __init e100_init_module(void) 3098static int __init e100_init_module(void)
3087{ 3099{
3088 if (((1 << debug) - 1) & NETIF_MSG_DRV) { 3100 if (((1 << debug) - 1) & NETIF_MSG_DRV) {
3089 printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); 3101 pr_info("%s, %s\n", DRV_DESCRIPTION, DRV_VERSION);
3090 printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); 3102 pr_info("%s\n", DRV_COPYRIGHT);
3091 } 3103 }
3092 return pci_register_driver(&e100_driver); 3104 return pci_register_driver(&e100_driver);
3093} 3105}