aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e100.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-05-22 02:36:56 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-05-22 02:36:56 -0400
commitcf9b59e9d3e008591d1f54830f570982bb307a0d (patch)
tree113478ce8fd8c832ba726ffdf59b82cb46356476 /drivers/net/e100.c
parent44504b2bebf8b5823c59484e73096a7d6574471d (diff)
parentf4b87dee923342505e1ddba8d34ce9de33e75050 (diff)
Merge remote branch 'origin' into secretlab/next-devicetree
Merging in current state of Linus' tree to deal with merge conflicts and build failures in vio.c after merge. Conflicts: drivers/i2c/busses/i2c-cpm.c drivers/i2c/busses/i2c-mpc.c drivers/net/gianfar.c Also fixed up one line in arch/powerpc/kernel/vio.c to use the correct node pointer. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r--drivers/net/e100.c200
1 files changed, 109 insertions, 91 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index b997e578e58f..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>
@@ -166,6 +168,7 @@
166#include <linux/ethtool.h> 168#include <linux/ethtool.h>
167#include <linux/string.h> 169#include <linux/string.h>
168#include <linux/firmware.h> 170#include <linux/firmware.h>
171#include <linux/rtnetlink.h>
169#include <asm/unaligned.h> 172#include <asm/unaligned.h>
170 173
171 174
@@ -174,7 +177,6 @@
174#define DRV_VERSION "3.5.24-k2"DRV_EXT 177#define DRV_VERSION "3.5.24-k2"DRV_EXT
175#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" 178#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver"
176#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" 179#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation"
177#define PFX DRV_NAME ": "
178 180
179#define E100_WATCHDOG_PERIOD (2 * HZ) 181#define E100_WATCHDOG_PERIOD (2 * HZ)
180#define E100_NAPI_WEIGHT 16 182#define E100_NAPI_WEIGHT 16
@@ -200,10 +202,6 @@ module_param(use_io, int, 0);
200MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); 202MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
201MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums"); 203MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums");
202MODULE_PARM_DESC(use_io, "Force use of i/o access mode"); 204MODULE_PARM_DESC(use_io, "Force use of i/o access mode");
203#define DPRINTK(nlevel, klevel, fmt, args...) \
204 (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \
205 printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \
206 __func__ , ## args))
207 205
208#define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\ 206#define INTEL_8255X_ETHERNET_DEVICE(device_id, ich) {\
209 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, \
@@ -689,12 +687,13 @@ static int e100_self_test(struct nic *nic)
689 687
690 /* Check results of self-test */ 688 /* Check results of self-test */
691 if (nic->mem->selftest.result != 0) { 689 if (nic->mem->selftest.result != 0) {
692 DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n", 690 netif_err(nic, hw, nic->netdev,
693 nic->mem->selftest.result); 691 "Self-test failed: result=0x%08X\n",
692 nic->mem->selftest.result);
694 return -ETIMEDOUT; 693 return -ETIMEDOUT;
695 } 694 }
696 if (nic->mem->selftest.signature == 0) { 695 if (nic->mem->selftest.signature == 0) {
697 DPRINTK(HW, ERR, "Self-test failed: timed out\n"); 696 netif_err(nic, hw, nic->netdev, "Self-test failed: timed out\n");
698 return -ETIMEDOUT; 697 return -ETIMEDOUT;
699 } 698 }
700 699
@@ -797,7 +796,7 @@ static int e100_eeprom_load(struct nic *nic)
797 /* The checksum, stored in the last word, is calculated such that 796 /* The checksum, stored in the last word, is calculated such that
798 * the sum of words should be 0xBABA */ 797 * the sum of words should be 0xBABA */
799 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]) {
800 DPRINTK(PROBE, ERR, "EEPROM corrupted\n"); 799 netif_err(nic, probe, nic->netdev, "EEPROM corrupted\n");
801 if (!eeprom_bad_csum_allow) 800 if (!eeprom_bad_csum_allow)
802 return -EAGAIN; 801 return -EAGAIN;
803 } 802 }
@@ -953,8 +952,7 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
953 udelay(20); 952 udelay(20);
954 } 953 }
955 if (unlikely(!i)) { 954 if (unlikely(!i)) {
956 printk("e100.mdio_ctrl(%s) won't go Ready\n", 955 netdev_err(nic->netdev, "e100.mdio_ctrl won't go Ready\n");
957 nic->netdev->name );
958 spin_unlock_irqrestore(&nic->mdio_lock, flags); 956 spin_unlock_irqrestore(&nic->mdio_lock, flags);
959 return 0; /* No way to indicate timeout error */ 957 return 0; /* No way to indicate timeout error */
960 } 958 }
@@ -966,9 +964,10 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
966 break; 964 break;
967 } 965 }
968 spin_unlock_irqrestore(&nic->mdio_lock, flags); 966 spin_unlock_irqrestore(&nic->mdio_lock, flags);
969 DPRINTK(HW, DEBUG, 967 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
970 "%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",
971 dir == mdi_read ? "READ" : "WRITE", addr, reg, data, data_out); 969 dir == mdi_read ? "READ" : "WRITE",
970 addr, reg, data, data_out);
972 return (u16)data_out; 971 return (u16)data_out;
973} 972}
974 973
@@ -1028,17 +1027,19 @@ static u16 mdio_ctrl_phy_mii_emulated(struct nic *nic,
1028 return ADVERTISE_10HALF | 1027 return ADVERTISE_10HALF |
1029 ADVERTISE_10FULL; 1028 ADVERTISE_10FULL;
1030 default: 1029 default:
1031 DPRINTK(HW, DEBUG, 1030 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1032 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n", 1031 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n",
1033 dir == mdi_read ? "READ" : "WRITE", addr, reg, data); 1032 dir == mdi_read ? "READ" : "WRITE",
1033 addr, reg, data);
1034 return 0xFFFF; 1034 return 0xFFFF;
1035 } 1035 }
1036 } else { 1036 } else {
1037 switch (reg) { 1037 switch (reg) {
1038 default: 1038 default:
1039 DPRINTK(HW, DEBUG, 1039 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1040 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n", 1040 "%s:addr=%d, reg=%d, data=0x%04X: unimplemented emulation!\n",
1041 dir == mdi_read ? "READ" : "WRITE", addr, reg, data); 1041 dir == mdi_read ? "READ" : "WRITE",
1042 addr, reg, data);
1042 return 0xFFFF; 1043 return 0xFFFF;
1043 } 1044 }
1044 } 1045 }
@@ -1155,12 +1156,15 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
1155 } 1156 }
1156 } 1157 }
1157 1158
1158 DPRINTK(HW, DEBUG, "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", 1159 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1159 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",
1160 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]);
1161 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,
1162 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",
1163 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]);
1164} 1168}
1165 1169
1166/************************************************************************* 1170/*************************************************************************
@@ -1253,16 +1257,18 @@ static const struct firmware *e100_request_firmware(struct nic *nic)
1253 err = request_firmware(&fw, fw_name, &nic->pdev->dev); 1257 err = request_firmware(&fw, fw_name, &nic->pdev->dev);
1254 1258
1255 if (err) { 1259 if (err) {
1256 DPRINTK(PROBE, ERR, "Failed to load firmware \"%s\": %d\n", 1260 netif_err(nic, probe, nic->netdev,
1257 fw_name, err); 1261 "Failed to load firmware \"%s\": %d\n",
1262 fw_name, err);
1258 return ERR_PTR(err); 1263 return ERR_PTR(err);
1259 } 1264 }
1260 1265
1261 /* Firmware should be precisely UCODE_SIZE (words) plus three bytes 1266 /* Firmware should be precisely UCODE_SIZE (words) plus three bytes
1262 indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */ 1267 indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */
1263 if (fw->size != UCODE_SIZE * 4 + 3) { 1268 if (fw->size != UCODE_SIZE * 4 + 3) {
1264 DPRINTK(PROBE, ERR, "Firmware \"%s\" has wrong size %zu\n", 1269 netif_err(nic, probe, nic->netdev,
1265 fw_name, fw->size); 1270 "Firmware \"%s\" has wrong size %zu\n",
1271 fw_name, fw->size);
1266 release_firmware(fw); 1272 release_firmware(fw);
1267 return ERR_PTR(-EINVAL); 1273 return ERR_PTR(-EINVAL);
1268 } 1274 }
@@ -1274,9 +1280,9 @@ static const struct firmware *e100_request_firmware(struct nic *nic)
1274 1280
1275 if (timer >= UCODE_SIZE || bundle >= UCODE_SIZE || 1281 if (timer >= UCODE_SIZE || bundle >= UCODE_SIZE ||
1276 min_size >= UCODE_SIZE) { 1282 min_size >= UCODE_SIZE) {
1277 DPRINTK(PROBE, ERR, 1283 netif_err(nic, probe, nic->netdev,
1278 "\"%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",
1279 fw_name, timer, bundle, min_size); 1285 fw_name, timer, bundle, min_size);
1280 release_firmware(fw); 1286 release_firmware(fw);
1281 return ERR_PTR(-EINVAL); 1287 return ERR_PTR(-EINVAL);
1282 } 1288 }
@@ -1328,7 +1334,8 @@ static inline int e100_load_ucode_wait(struct nic *nic)
1328 return PTR_ERR(fw); 1334 return PTR_ERR(fw);
1329 1335
1330 if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode))) 1336 if ((err = e100_exec_cb(nic, (void *)fw, e100_setup_ucode)))
1331 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);
1332 1339
1333 /* must restart cuc */ 1340 /* must restart cuc */
1334 nic->cuc_cmd = cuc_start; 1341 nic->cuc_cmd = cuc_start;
@@ -1348,7 +1355,7 @@ static inline int e100_load_ucode_wait(struct nic *nic)
1348 1355
1349 /* if the command failed, or is not OK, notify and return */ 1356 /* if the command failed, or is not OK, notify and return */
1350 if (!counter || !(cb->status & cpu_to_le16(cb_ok))) { 1357 if (!counter || !(cb->status & cpu_to_le16(cb_ok))) {
1351 DPRINTK(PROBE,ERR, "ucode load failed\n"); 1358 netif_err(nic, probe, nic->netdev, "ucode load failed\n");
1352 err = -EPERM; 1359 err = -EPERM;
1353 } 1360 }
1354 1361
@@ -1386,8 +1393,8 @@ static int e100_phy_check_without_mii(struct nic *nic)
1386 * media is sensed automatically based on how the link partner 1393 * media is sensed automatically based on how the link partner
1387 * is configured. This is, in essence, manual configuration. 1394 * is configured. This is, in essence, manual configuration.
1388 */ 1395 */
1389 DPRINTK(PROBE, INFO, 1396 netif_info(nic, probe, nic->netdev,
1390 "found MII-less i82503 or 80c24 or other PHY\n"); 1397 "found MII-less i82503 or 80c24 or other PHY\n");
1391 1398
1392 nic->mdio_ctrl = mdio_ctrl_phy_mii_emulated; 1399 nic->mdio_ctrl = mdio_ctrl_phy_mii_emulated;
1393 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? */
@@ -1434,18 +1441,20 @@ static int e100_phy_init(struct nic *nic)
1434 return 0; /* simply return and hope for the best */ 1441 return 0; /* simply return and hope for the best */
1435 else { 1442 else {
1436 /* for unknown cases log a fatal error */ 1443 /* for unknown cases log a fatal error */
1437 DPRINTK(HW, ERR, 1444 netif_err(nic, hw, nic->netdev,
1438 "Failed to locate any known PHY, aborting.\n"); 1445 "Failed to locate any known PHY, aborting\n");
1439 return -EAGAIN; 1446 return -EAGAIN;
1440 } 1447 }
1441 } else 1448 } else
1442 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);
1443 1451
1444 /* Get phy ID */ 1452 /* Get phy ID */
1445 id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1); 1453 id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1);
1446 id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2); 1454 id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2);
1447 nic->phy = (u32)id_hi << 16 | (u32)id_lo; 1455 nic->phy = (u32)id_hi << 16 | (u32)id_lo;
1448 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);
1449 1458
1450 /* Select the phy and isolate the rest */ 1459 /* Select the phy and isolate the rest */
1451 for (addr = 0; addr < 32; addr++) { 1460 for (addr = 0; addr < 32; addr++) {
@@ -1507,7 +1516,7 @@ static int e100_hw_init(struct nic *nic)
1507 1516
1508 e100_hw_reset(nic); 1517 e100_hw_reset(nic);
1509 1518
1510 DPRINTK(HW, ERR, "e100_hw_init\n"); 1519 netif_err(nic, hw, nic->netdev, "e100_hw_init\n");
1511 if (!in_interrupt() && (err = e100_self_test(nic))) 1520 if (!in_interrupt() && (err = e100_self_test(nic)))
1512 return err; 1521 return err;
1513 1522
@@ -1537,16 +1546,16 @@ static int e100_hw_init(struct nic *nic)
1537static 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)
1538{ 1547{
1539 struct net_device *netdev = nic->netdev; 1548 struct net_device *netdev = nic->netdev;
1540 struct dev_mc_list *list; 1549 struct netdev_hw_addr *ha;
1541 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);
1542 1551
1543 cb->command = cpu_to_le16(cb_multi); 1552 cb->command = cpu_to_le16(cb_multi);
1544 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN); 1553 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN);
1545 i = 0; 1554 i = 0;
1546 netdev_for_each_mc_addr(list, netdev) { 1555 netdev_for_each_mc_addr(ha, netdev) {
1547 if (i == count) 1556 if (i == count)
1548 break; 1557 break;
1549 memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &list->dmi_addr, 1558 memcpy(&cb->u.multi.addr[i++ * ETH_ALEN], &ha->addr,
1550 ETH_ALEN); 1559 ETH_ALEN);
1551 } 1560 }
1552} 1561}
@@ -1555,8 +1564,9 @@ static void e100_set_multicast_list(struct net_device *netdev)
1555{ 1564{
1556 struct nic *nic = netdev_priv(netdev); 1565 struct nic *nic = netdev_priv(netdev);
1557 1566
1558 DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n", 1567 netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
1559 netdev_mc_count(netdev), netdev->flags); 1568 "mc_count=%d, flags=0x%04X\n",
1569 netdev_mc_count(netdev), netdev->flags);
1560 1570
1561 if (netdev->flags & IFF_PROMISC) 1571 if (netdev->flags & IFF_PROMISC)
1562 nic->flags |= promiscuous; 1572 nic->flags |= promiscuous;
@@ -1629,7 +1639,8 @@ static void e100_update_stats(struct nic *nic)
1629 1639
1630 1640
1631 if (e100_exec_cmd(nic, cuc_dump_reset, 0)) 1641 if (e100_exec_cmd(nic, cuc_dump_reset, 0))
1632 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");
1633} 1644}
1634 1645
1635static 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)
@@ -1659,20 +1670,19 @@ static void e100_watchdog(unsigned long data)
1659 struct nic *nic = (struct nic *)data; 1670 struct nic *nic = (struct nic *)data;
1660 struct ethtool_cmd cmd; 1671 struct ethtool_cmd cmd;
1661 1672
1662 DPRINTK(TIMER, DEBUG, "right now = %ld\n", jiffies); 1673 netif_printk(nic, timer, KERN_DEBUG, nic->netdev,
1674 "right now = %ld\n", jiffies);
1663 1675
1664 /* mii library handles link maintenance tasks */ 1676 /* mii library handles link maintenance tasks */
1665 1677
1666 mii_ethtool_gset(&nic->mii, &cmd); 1678 mii_ethtool_gset(&nic->mii, &cmd);
1667 1679
1668 if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { 1680 if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) {
1669 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",
1670 nic->netdev->name, 1682 cmd.speed == SPEED_100 ? 100 : 10,
1671 cmd.speed == SPEED_100 ? "100" : "10", 1683 cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
1672 cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
1673 } 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)) {
1674 printk(KERN_INFO "e100: %s NIC Link is Down\n", 1685 netdev_info(nic->netdev, "NIC Link is Down\n");
1675 nic->netdev->name);
1676 } 1686 }
1677 1687
1678 mii_check_link(&nic->mii); 1688 mii_check_link(&nic->mii);
@@ -1732,7 +1742,8 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
1732 Issue a NOP command followed by a 1us delay before 1742 Issue a NOP command followed by a 1us delay before
1733 issuing the Tx command. */ 1743 issuing the Tx command. */
1734 if (e100_exec_cmd(nic, cuc_nop, 0)) 1744 if (e100_exec_cmd(nic, cuc_nop, 0))
1735 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");
1736 udelay(1); 1747 udelay(1);
1737 } 1748 }
1738 1749
@@ -1741,17 +1752,18 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
1741 switch (err) { 1752 switch (err) {
1742 case -ENOSPC: 1753 case -ENOSPC:
1743 /* We queued the skb, but now we're out of space. */ 1754 /* We queued the skb, but now we're out of space. */
1744 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");
1745 netif_stop_queue(netdev); 1757 netif_stop_queue(netdev);
1746 break; 1758 break;
1747 case -ENOMEM: 1759 case -ENOMEM:
1748 /* This is a hard error - log it. */ 1760 /* This is a hard error - log it. */
1749 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");
1750 netif_stop_queue(netdev); 1763 netif_stop_queue(netdev);
1751 return NETDEV_TX_BUSY; 1764 return NETDEV_TX_BUSY;
1752 } 1765 }
1753 1766
1754 netdev->trans_start = jiffies;
1755 return NETDEV_TX_OK; 1767 return NETDEV_TX_OK;
1756} 1768}
1757 1769
@@ -1767,9 +1779,10 @@ static int e100_tx_clean(struct nic *nic)
1767 for (cb = nic->cb_to_clean; 1779 for (cb = nic->cb_to_clean;
1768 cb->status & cpu_to_le16(cb_complete); 1780 cb->status & cpu_to_le16(cb_complete);
1769 cb = nic->cb_to_clean = cb->next) { 1781 cb = nic->cb_to_clean = cb->next) {
1770 DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n", 1782 netif_printk(nic, tx_done, KERN_DEBUG, nic->netdev,
1771 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)), 1783 "cb[%d]->status = 0x%04X\n",
1772 cb->status); 1784 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
1785 cb->status);
1773 1786
1774 if (likely(cb->skb != NULL)) { 1787 if (likely(cb->skb != NULL)) {
1775 dev->stats.tx_packets++; 1788 dev->stats.tx_packets++;
@@ -1912,7 +1925,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1912 sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL); 1925 sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL);
1913 rfd_status = le16_to_cpu(rfd->status); 1926 rfd_status = le16_to_cpu(rfd->status);
1914 1927
1915 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);
1916 1930
1917 /* If data isn't ready, nothing to indicate */ 1931 /* If data isn't ready, nothing to indicate */
1918 if (unlikely(!(rfd_status & cb_complete))) { 1932 if (unlikely(!(rfd_status & cb_complete))) {
@@ -2123,7 +2137,8 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
2123 struct nic *nic = netdev_priv(netdev); 2137 struct nic *nic = netdev_priv(netdev);
2124 u8 stat_ack = ioread8(&nic->csr->scb.stat_ack); 2138 u8 stat_ack = ioread8(&nic->csr->scb.stat_ack);
2125 2139
2126 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);
2127 2142
2128 if (stat_ack == stat_ack_not_ours || /* Not our interrupt */ 2143 if (stat_ack == stat_ack_not_ours || /* Not our interrupt */
2129 stat_ack == stat_ack_not_present) /* Hardware is ejected */ 2144 stat_ack == stat_ack_not_present) /* Hardware is ejected */
@@ -2263,10 +2278,15 @@ static void e100_tx_timeout_task(struct work_struct *work)
2263 struct nic *nic = container_of(work, struct nic, tx_timeout_task); 2278 struct nic *nic = container_of(work, struct nic, tx_timeout_task);
2264 struct net_device *netdev = nic->netdev; 2279 struct net_device *netdev = nic->netdev;
2265 2280
2266 DPRINTK(TX_ERR, DEBUG, "scb.status=0x%02X\n", 2281 netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
2267 ioread8(&nic->csr->scb.status)); 2282 "scb.status=0x%02X\n", ioread8(&nic->csr->scb.status));
2268 e100_down(netdev_priv(netdev)); 2283
2269 e100_up(netdev_priv(netdev)); 2284 rtnl_lock();
2285 if (netif_running(netdev)) {
2286 e100_down(netdev_priv(netdev));
2287 e100_up(netdev_priv(netdev));
2288 }
2289 rtnl_unlock();
2270} 2290}
2271 2291
2272static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode) 2292static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
@@ -2526,8 +2546,8 @@ static int e100_set_ringparam(struct net_device *netdev,
2526 rfds->count = min(rfds->count, rfds->max); 2546 rfds->count = min(rfds->count, rfds->max);
2527 cbs->count = max(ring->tx_pending, cbs->min); 2547 cbs->count = max(ring->tx_pending, cbs->min);
2528 cbs->count = min(cbs->count, cbs->max); 2548 cbs->count = min(cbs->count, cbs->max);
2529 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",
2530 rfds->count, cbs->count); 2550 rfds->count, cbs->count);
2531 if (netif_running(netdev)) 2551 if (netif_running(netdev))
2532 e100_up(nic); 2552 e100_up(nic);
2533 2553
@@ -2704,7 +2724,7 @@ static int e100_open(struct net_device *netdev)
2704 2724
2705 netif_carrier_off(netdev); 2725 netif_carrier_off(netdev);
2706 if ((err = e100_up(nic))) 2726 if ((err = e100_up(nic)))
2707 DPRINTK(IFUP, ERR, "Cannot open interface, aborting.\n"); 2727 netif_err(nic, ifup, nic->netdev, "Cannot open interface, aborting\n");
2708 return err; 2728 return err;
2709} 2729}
2710 2730
@@ -2738,7 +2758,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2738 2758
2739 if (!(netdev = alloc_etherdev(sizeof(struct nic)))) { 2759 if (!(netdev = alloc_etherdev(sizeof(struct nic)))) {
2740 if (((1 << debug) - 1) & NETIF_MSG_PROBE) 2760 if (((1 << debug) - 1) & NETIF_MSG_PROBE)
2741 printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n"); 2761 pr_err("Etherdev alloc failed, aborting\n");
2742 return -ENOMEM; 2762 return -ENOMEM;
2743 } 2763 }
2744 2764
@@ -2756,35 +2776,34 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2756 pci_set_drvdata(pdev, netdev); 2776 pci_set_drvdata(pdev, netdev);
2757 2777
2758 if ((err = pci_enable_device(pdev))) { 2778 if ((err = pci_enable_device(pdev))) {
2759 DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n"); 2779 netif_err(nic, probe, nic->netdev, "Cannot enable PCI device, aborting\n");
2760 goto err_out_free_dev; 2780 goto err_out_free_dev;
2761 } 2781 }
2762 2782
2763 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 2783 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
2764 DPRINTK(PROBE, ERR, "Cannot find proper PCI device " 2784 netif_err(nic, probe, nic->netdev, "Cannot find proper PCI device base address, aborting\n");
2765 "base address, aborting.\n");
2766 err = -ENODEV; 2785 err = -ENODEV;
2767 goto err_out_disable_pdev; 2786 goto err_out_disable_pdev;
2768 } 2787 }
2769 2788
2770 if ((err = pci_request_regions(pdev, DRV_NAME))) { 2789 if ((err = pci_request_regions(pdev, DRV_NAME))) {
2771 DPRINTK(PROBE, ERR, "Cannot obtain PCI resources, aborting.\n"); 2790 netif_err(nic, probe, nic->netdev, "Cannot obtain PCI resources, aborting\n");
2772 goto err_out_disable_pdev; 2791 goto err_out_disable_pdev;
2773 } 2792 }
2774 2793
2775 if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { 2794 if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) {
2776 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); 2795 netif_err(nic, probe, nic->netdev, "No usable DMA configuration, aborting\n");
2777 goto err_out_free_res; 2796 goto err_out_free_res;
2778 } 2797 }
2779 2798
2780 SET_NETDEV_DEV(netdev, &pdev->dev); 2799 SET_NETDEV_DEV(netdev, &pdev->dev);
2781 2800
2782 if (use_io) 2801 if (use_io)
2783 DPRINTK(PROBE, INFO, "using i/o access mode\n"); 2802 netif_info(nic, probe, nic->netdev, "using i/o access mode\n");
2784 2803
2785 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));
2786 if (!nic->csr) { 2805 if (!nic->csr) {
2787 DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n"); 2806 netif_err(nic, probe, nic->netdev, "Cannot map device registers, aborting\n");
2788 err = -ENOMEM; 2807 err = -ENOMEM;
2789 goto err_out_free_res; 2808 goto err_out_free_res;
2790 } 2809 }
@@ -2818,7 +2837,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2818 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task); 2837 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task);
2819 2838
2820 if ((err = e100_alloc(nic))) { 2839 if ((err = e100_alloc(nic))) {
2821 DPRINTK(PROBE, ERR, "Cannot alloc driver memory, aborting.\n"); 2840 netif_err(nic, probe, nic->netdev, "Cannot alloc driver memory, aborting\n");
2822 goto err_out_iounmap; 2841 goto err_out_iounmap;
2823 } 2842 }
2824 2843
@@ -2831,13 +2850,11 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2831 memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN); 2850 memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN);
2832 if (!is_valid_ether_addr(netdev->perm_addr)) { 2851 if (!is_valid_ether_addr(netdev->perm_addr)) {
2833 if (!eeprom_bad_csum_allow) { 2852 if (!eeprom_bad_csum_allow) {
2834 DPRINTK(PROBE, ERR, "Invalid MAC address from " 2853 netif_err(nic, probe, nic->netdev, "Invalid MAC address from EEPROM, aborting\n");
2835 "EEPROM, aborting.\n");
2836 err = -EAGAIN; 2854 err = -EAGAIN;
2837 goto err_out_free; 2855 goto err_out_free;
2838 } else { 2856 } else {
2839 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");
2840 "you MUST configure one.\n");
2841 } 2858 }
2842 } 2859 }
2843 2860
@@ -2853,7 +2870,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2853 2870
2854 strcpy(netdev->name, "eth%d"); 2871 strcpy(netdev->name, "eth%d");
2855 if ((err = register_netdev(netdev))) { 2872 if ((err = register_netdev(netdev))) {
2856 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); 2873 netif_err(nic, probe, nic->netdev, "Cannot register net device, aborting\n");
2857 goto err_out_free; 2874 goto err_out_free;
2858 } 2875 }
2859 nic->cbs_pool = pci_pool_create(netdev->name, 2876 nic->cbs_pool = pci_pool_create(netdev->name,
@@ -2861,9 +2878,10 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2861 nic->params.cbs.max * sizeof(struct cb), 2878 nic->params.cbs.max * sizeof(struct cb),
2862 sizeof(u32), 2879 sizeof(u32),
2863 0); 2880 0);
2864 DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", 2881 netif_info(nic, probe, nic->netdev,
2865 (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), 2882 "addr 0x%llx, irq %d, MAC addr %pM\n",
2866 pdev->irq, netdev->dev_addr); 2883 (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
2884 pdev->irq, netdev->dev_addr);
2867 2885
2868 return 0; 2886 return 0;
2869 2887
@@ -3021,7 +3039,7 @@ static pci_ers_result_t e100_io_slot_reset(struct pci_dev *pdev)
3021 struct nic *nic = netdev_priv(netdev); 3039 struct nic *nic = netdev_priv(netdev);
3022 3040
3023 if (pci_enable_device(pdev)) { 3041 if (pci_enable_device(pdev)) {
3024 printk(KERN_ERR "e100: Cannot re-enable PCI device after reset.\n"); 3042 pr_err("Cannot re-enable PCI device after reset\n");
3025 return PCI_ERS_RESULT_DISCONNECT; 3043 return PCI_ERS_RESULT_DISCONNECT;
3026 } 3044 }
3027 pci_set_master(pdev); 3045 pci_set_master(pdev);
@@ -3080,8 +3098,8 @@ static struct pci_driver e100_driver = {
3080static int __init e100_init_module(void) 3098static int __init e100_init_module(void)
3081{ 3099{
3082 if (((1 << debug) - 1) & NETIF_MSG_DRV) { 3100 if (((1 << debug) - 1) & NETIF_MSG_DRV) {
3083 printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); 3101 pr_info("%s, %s\n", DRV_DESCRIPTION, DRV_VERSION);
3084 printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); 3102 pr_info("%s\n", DRV_COPYRIGHT);
3085 } 3103 }
3086 return pci_register_driver(&e100_driver); 3104 return pci_register_driver(&e100_driver);
3087} 3105}