diff options
-rw-r--r-- | drivers/net/r8169.c | 191 |
1 files changed, 135 insertions, 56 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 6f3b1383788f..d795b31649f3 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -91,6 +91,10 @@ VERSION 2.2LK <2005/01/25> | |||
91 | #define dprintk(fmt, args...) do {} while (0) | 91 | #define dprintk(fmt, args...) do {} while (0) |
92 | #endif /* RTL8169_DEBUG */ | 92 | #endif /* RTL8169_DEBUG */ |
93 | 93 | ||
94 | #define R8169_MSG_DEFAULT \ | ||
95 | (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | NETIF_MSG_IFUP | \ | ||
96 | NETIF_MSG_IFDOWN) | ||
97 | |||
94 | #define TX_BUFFS_AVAIL(tp) \ | 98 | #define TX_BUFFS_AVAIL(tp) \ |
95 | (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) | 99 | (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) |
96 | 100 | ||
@@ -190,6 +194,9 @@ MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); | |||
190 | 194 | ||
191 | static int rx_copybreak = 200; | 195 | static int rx_copybreak = 200; |
192 | static int use_dac; | 196 | static int use_dac; |
197 | static struct { | ||
198 | u32 msg_enable; | ||
199 | } debug = { -1 }; | ||
193 | 200 | ||
194 | enum RTL8169_registers { | 201 | enum RTL8169_registers { |
195 | MAC0 = 0, /* Ethernet hardware address. */ | 202 | MAC0 = 0, /* Ethernet hardware address. */ |
@@ -392,6 +399,7 @@ struct rtl8169_private { | |||
392 | struct pci_dev *pci_dev; /* Index of PCI device */ | 399 | struct pci_dev *pci_dev; /* Index of PCI device */ |
393 | struct net_device_stats stats; /* statistics of net device */ | 400 | struct net_device_stats stats; /* statistics of net device */ |
394 | spinlock_t lock; /* spin lock flag */ | 401 | spinlock_t lock; /* spin lock flag */ |
402 | u32 msg_enable; | ||
395 | int chipset; | 403 | int chipset; |
396 | int mac_version; | 404 | int mac_version; |
397 | int phy_version; | 405 | int phy_version; |
@@ -430,6 +438,8 @@ module_param(rx_copybreak, int, 0); | |||
430 | MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); | 438 | MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); |
431 | module_param(use_dac, int, 0); | 439 | module_param(use_dac, int, 0); |
432 | MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); | 440 | MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); |
441 | module_param_named(debug, debug.msg_enable, int, 0); | ||
442 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); | ||
433 | MODULE_LICENSE("GPL"); | 443 | MODULE_LICENSE("GPL"); |
434 | MODULE_VERSION(RTL8169_VERSION); | 444 | MODULE_VERSION(RTL8169_VERSION); |
435 | 445 | ||
@@ -552,9 +562,13 @@ static void rtl8169_check_link_status(struct net_device *dev, | |||
552 | spin_lock_irqsave(&tp->lock, flags); | 562 | spin_lock_irqsave(&tp->lock, flags); |
553 | if (tp->link_ok(ioaddr)) { | 563 | if (tp->link_ok(ioaddr)) { |
554 | netif_carrier_on(dev); | 564 | netif_carrier_on(dev); |
555 | printk(KERN_INFO PFX "%s: link up\n", dev->name); | 565 | if (netif_msg_ifup(tp)) |
556 | } else | 566 | printk(KERN_INFO PFX "%s: link up\n", dev->name); |
567 | } else { | ||
568 | if (netif_msg_ifdown(tp)) | ||
569 | printk(KERN_INFO PFX "%s: link down\n", dev->name); | ||
557 | netif_carrier_off(dev); | 570 | netif_carrier_off(dev); |
571 | } | ||
558 | spin_unlock_irqrestore(&tp->lock, flags); | 572 | spin_unlock_irqrestore(&tp->lock, flags); |
559 | } | 573 | } |
560 | 574 | ||
@@ -578,7 +592,7 @@ static void rtl8169_link_option(int idx, u8 *autoneg, u16 *speed, u8 *duplex) | |||
578 | 592 | ||
579 | option = ((idx < MAX_UNITS) && (idx >= 0)) ? media[idx] : 0xff; | 593 | option = ((idx < MAX_UNITS) && (idx >= 0)) ? media[idx] : 0xff; |
580 | 594 | ||
581 | if ((option != 0xff) && !idx) | 595 | if ((option != 0xff) && !idx && netif_msg_drv(&debug)) |
582 | printk(KERN_WARNING PFX "media option is deprecated.\n"); | 596 | printk(KERN_WARNING PFX "media option is deprecated.\n"); |
583 | 597 | ||
584 | for (p = link_settings; p->media != 0xff; p++) { | 598 | for (p = link_settings; p->media != 0xff; p++) { |
@@ -620,9 +634,11 @@ static int rtl8169_set_speed_tbi(struct net_device *dev, | |||
620 | } else if (autoneg == AUTONEG_ENABLE) | 634 | } else if (autoneg == AUTONEG_ENABLE) |
621 | RTL_W32(TBICSR, reg | TBINwEnable | TBINwRestart); | 635 | RTL_W32(TBICSR, reg | TBINwEnable | TBINwRestart); |
622 | else { | 636 | else { |
623 | printk(KERN_WARNING PFX | 637 | if (netif_msg_link(tp)) { |
624 | "%s: incorrect speed setting refused in TBI mode\n", | 638 | printk(KERN_WARNING "%s: " |
625 | dev->name); | 639 | "incorrect speed setting refused in TBI mode\n", |
640 | dev->name); | ||
641 | } | ||
626 | ret = -EOPNOTSUPP; | 642 | ret = -EOPNOTSUPP; |
627 | } | 643 | } |
628 | 644 | ||
@@ -880,12 +896,28 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
880 | spin_unlock_irqrestore(&tp->lock, flags); | 896 | spin_unlock_irqrestore(&tp->lock, flags); |
881 | } | 897 | } |
882 | 898 | ||
899 | static u32 rtl8169_get_msglevel(struct net_device *dev) | ||
900 | { | ||
901 | struct rtl8169_private *tp = netdev_priv(dev); | ||
902 | |||
903 | return tp->msg_enable; | ||
904 | } | ||
905 | |||
906 | static void rtl8169_set_msglevel(struct net_device *dev, u32 value) | ||
907 | { | ||
908 | struct rtl8169_private *tp = netdev_priv(dev); | ||
909 | |||
910 | tp->msg_enable = value; | ||
911 | } | ||
912 | |||
883 | static struct ethtool_ops rtl8169_ethtool_ops = { | 913 | static struct ethtool_ops rtl8169_ethtool_ops = { |
884 | .get_drvinfo = rtl8169_get_drvinfo, | 914 | .get_drvinfo = rtl8169_get_drvinfo, |
885 | .get_regs_len = rtl8169_get_regs_len, | 915 | .get_regs_len = rtl8169_get_regs_len, |
886 | .get_link = ethtool_op_get_link, | 916 | .get_link = ethtool_op_get_link, |
887 | .get_settings = rtl8169_get_settings, | 917 | .get_settings = rtl8169_get_settings, |
888 | .set_settings = rtl8169_set_settings, | 918 | .set_settings = rtl8169_set_settings, |
919 | .get_msglevel = rtl8169_get_msglevel, | ||
920 | .set_msglevel = rtl8169_set_msglevel, | ||
889 | .get_rx_csum = rtl8169_get_rx_csum, | 921 | .get_rx_csum = rtl8169_get_rx_csum, |
890 | .set_rx_csum = rtl8169_set_rx_csum, | 922 | .set_rx_csum = rtl8169_set_rx_csum, |
891 | .get_tx_csum = ethtool_op_get_tx_csum, | 923 | .get_tx_csum = ethtool_op_get_tx_csum, |
@@ -1100,7 +1132,8 @@ static void rtl8169_phy_timer(unsigned long __opaque) | |||
1100 | if (tp->link_ok(ioaddr)) | 1132 | if (tp->link_ok(ioaddr)) |
1101 | goto out_unlock; | 1133 | goto out_unlock; |
1102 | 1134 | ||
1103 | printk(KERN_WARNING PFX "%s: PHY reset until link up\n", dev->name); | 1135 | if (netif_msg_link(tp)) |
1136 | printk(KERN_WARNING "%s: PHY reset until link up\n", dev->name); | ||
1104 | 1137 | ||
1105 | tp->phy_reset_enable(ioaddr); | 1138 | tp->phy_reset_enable(ioaddr); |
1106 | 1139 | ||
@@ -1178,18 +1211,23 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, | |||
1178 | /* dev zeroed in alloc_etherdev */ | 1211 | /* dev zeroed in alloc_etherdev */ |
1179 | dev = alloc_etherdev(sizeof (*tp)); | 1212 | dev = alloc_etherdev(sizeof (*tp)); |
1180 | if (dev == NULL) { | 1213 | if (dev == NULL) { |
1181 | printk(KERN_ERR PFX "unable to alloc new ethernet\n"); | 1214 | if (netif_msg_drv(&debug)) |
1215 | printk(KERN_ERR PFX "unable to alloc new ethernet\n"); | ||
1182 | goto err_out; | 1216 | goto err_out; |
1183 | } | 1217 | } |
1184 | 1218 | ||
1185 | SET_MODULE_OWNER(dev); | 1219 | SET_MODULE_OWNER(dev); |
1186 | SET_NETDEV_DEV(dev, &pdev->dev); | 1220 | SET_NETDEV_DEV(dev, &pdev->dev); |
1187 | tp = netdev_priv(dev); | 1221 | tp = netdev_priv(dev); |
1222 | tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); | ||
1188 | 1223 | ||
1189 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ | 1224 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ |
1190 | rc = pci_enable_device(pdev); | 1225 | rc = pci_enable_device(pdev); |
1191 | if (rc) { | 1226 | if (rc < 0) { |
1192 | printk(KERN_ERR PFX "%s: enable failure\n", pci_name(pdev)); | 1227 | if (netif_msg_probe(tp)) { |
1228 | printk(KERN_ERR PFX "%s: enable failure\n", | ||
1229 | pci_name(pdev)); | ||
1230 | } | ||
1193 | goto err_out_free_dev; | 1231 | goto err_out_free_dev; |
1194 | } | 1232 | } |
1195 | 1233 | ||
@@ -1205,29 +1243,39 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, | |||
1205 | pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command); | 1243 | pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command); |
1206 | acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK; | 1244 | acpi_idle_state = pwr_command & PCI_PM_CTRL_STATE_MASK; |
1207 | } else { | 1245 | } else { |
1208 | printk(KERN_ERR PFX | 1246 | if (netif_msg_probe(tp)) { |
1209 | "Cannot find PowerManagement capability, aborting.\n"); | 1247 | printk(KERN_ERR PFX |
1248 | "Cannot find PowerManagement capability. " | ||
1249 | "Aborting.\n"); | ||
1250 | } | ||
1210 | goto err_out_mwi; | 1251 | goto err_out_mwi; |
1211 | } | 1252 | } |
1212 | 1253 | ||
1213 | /* make sure PCI base addr 1 is MMIO */ | 1254 | /* make sure PCI base addr 1 is MMIO */ |
1214 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | 1255 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { |
1215 | printk(KERN_ERR PFX | 1256 | if (netif_msg_probe(tp)) { |
1216 | "region #1 not an MMIO resource, aborting\n"); | 1257 | printk(KERN_ERR PFX |
1258 | "region #1 not an MMIO resource, aborting\n"); | ||
1259 | } | ||
1217 | rc = -ENODEV; | 1260 | rc = -ENODEV; |
1218 | goto err_out_mwi; | 1261 | goto err_out_mwi; |
1219 | } | 1262 | } |
1220 | /* check for weird/broken PCI region reporting */ | 1263 | /* check for weird/broken PCI region reporting */ |
1221 | if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) { | 1264 | if (pci_resource_len(pdev, 1) < R8169_REGS_SIZE) { |
1222 | printk(KERN_ERR PFX "Invalid PCI region size(s), aborting\n"); | 1265 | if (netif_msg_probe(tp)) { |
1266 | printk(KERN_ERR PFX | ||
1267 | "Invalid PCI region size(s), aborting\n"); | ||
1268 | } | ||
1223 | rc = -ENODEV; | 1269 | rc = -ENODEV; |
1224 | goto err_out_mwi; | 1270 | goto err_out_mwi; |
1225 | } | 1271 | } |
1226 | 1272 | ||
1227 | rc = pci_request_regions(pdev, MODULENAME); | 1273 | rc = pci_request_regions(pdev, MODULENAME); |
1228 | if (rc) { | 1274 | if (rc < 0) { |
1229 | printk(KERN_ERR PFX "%s: could not request regions.\n", | 1275 | if (netif_msg_probe(tp)) { |
1230 | pci_name(pdev)); | 1276 | printk(KERN_ERR PFX "%s: could not request regions.\n", |
1277 | pci_name(pdev)); | ||
1278 | } | ||
1231 | goto err_out_mwi; | 1279 | goto err_out_mwi; |
1232 | } | 1280 | } |
1233 | 1281 | ||
@@ -1240,7 +1288,10 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, | |||
1240 | } else { | 1288 | } else { |
1241 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 1289 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
1242 | if (rc < 0) { | 1290 | if (rc < 0) { |
1243 | printk(KERN_ERR PFX "DMA configuration failed.\n"); | 1291 | if (netif_msg_probe(tp)) { |
1292 | printk(KERN_ERR PFX | ||
1293 | "DMA configuration failed.\n"); | ||
1294 | } | ||
1244 | goto err_out_free_res; | 1295 | goto err_out_free_res; |
1245 | } | 1296 | } |
1246 | } | 1297 | } |
@@ -1250,7 +1301,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, | |||
1250 | /* ioremap MMIO region */ | 1301 | /* ioremap MMIO region */ |
1251 | ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE); | 1302 | ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE); |
1252 | if (ioaddr == NULL) { | 1303 | if (ioaddr == NULL) { |
1253 | printk(KERN_ERR PFX "cannot remap MMIO, aborting\n"); | 1304 | if (netif_msg_probe(tp)) |
1305 | printk(KERN_ERR PFX "cannot remap MMIO, aborting\n"); | ||
1254 | rc = -EIO; | 1306 | rc = -EIO; |
1255 | goto err_out_free_res; | 1307 | goto err_out_free_res; |
1256 | } | 1308 | } |
@@ -1281,9 +1333,11 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, | |||
1281 | } | 1333 | } |
1282 | if (i < 0) { | 1334 | if (i < 0) { |
1283 | /* Unknown chip: assume array element #0, original RTL-8169 */ | 1335 | /* Unknown chip: assume array element #0, original RTL-8169 */ |
1284 | printk(KERN_DEBUG PFX | 1336 | if (netif_msg_probe(tp)) { |
1285 | "PCI device %s: unknown chip version, assuming %s\n", | 1337 | printk(KERN_DEBUG PFX "PCI device %s: " |
1286 | pci_name(pdev), rtl_chip_info[0].name); | 1338 | "unknown chip version, assuming %s\n", |
1339 | pci_name(pdev), rtl_chip_info[0].name); | ||
1340 | } | ||
1287 | i++; | 1341 | i++; |
1288 | } | 1342 | } |
1289 | tp->chipset = i; | 1343 | tp->chipset = i; |
@@ -1317,7 +1371,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1317 | struct rtl8169_private *tp; | 1371 | struct rtl8169_private *tp; |
1318 | void __iomem *ioaddr = NULL; | 1372 | void __iomem *ioaddr = NULL; |
1319 | static int board_idx = -1; | 1373 | static int board_idx = -1; |
1320 | static int printed_version = 0; | ||
1321 | u8 autoneg, duplex; | 1374 | u8 autoneg, duplex; |
1322 | u16 speed; | 1375 | u16 speed; |
1323 | int i, rc; | 1376 | int i, rc; |
@@ -1327,10 +1380,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1327 | 1380 | ||
1328 | board_idx++; | 1381 | board_idx++; |
1329 | 1382 | ||
1330 | if (!printed_version) { | 1383 | if (netif_msg_drv(&debug)) { |
1331 | printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", | 1384 | printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n", |
1332 | MODULENAME, RTL8169_VERSION); | 1385 | MODULENAME, RTL8169_VERSION); |
1333 | printed_version = 1; | ||
1334 | } | 1386 | } |
1335 | 1387 | ||
1336 | rc = rtl8169_init_board(pdev, &dev, &ioaddr); | 1388 | rc = rtl8169_init_board(pdev, &dev, &ioaddr); |
@@ -1399,20 +1451,24 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1399 | return rc; | 1451 | return rc; |
1400 | } | 1452 | } |
1401 | 1453 | ||
1402 | printk(KERN_DEBUG "%s: Identified chip type is '%s'.\n", dev->name, | 1454 | if (netif_msg_probe(tp)) { |
1403 | rtl_chip_info[tp->chipset].name); | 1455 | printk(KERN_DEBUG "%s: Identified chip type is '%s'.\n", |
1456 | dev->name, rtl_chip_info[tp->chipset].name); | ||
1457 | } | ||
1404 | 1458 | ||
1405 | pci_set_drvdata(pdev, dev); | 1459 | pci_set_drvdata(pdev, dev); |
1406 | 1460 | ||
1407 | printk(KERN_INFO "%s: %s at 0x%lx, " | 1461 | if (netif_msg_probe(tp)) { |
1408 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, " | 1462 | printk(KERN_INFO "%s: %s at 0x%lx, " |
1409 | "IRQ %d\n", | 1463 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x, " |
1410 | dev->name, | 1464 | "IRQ %d\n", |
1411 | rtl_chip_info[ent->driver_data].name, | 1465 | dev->name, |
1412 | dev->base_addr, | 1466 | rtl_chip_info[ent->driver_data].name, |
1413 | dev->dev_addr[0], dev->dev_addr[1], | 1467 | dev->base_addr, |
1414 | dev->dev_addr[2], dev->dev_addr[3], | 1468 | dev->dev_addr[0], dev->dev_addr[1], |
1415 | dev->dev_addr[4], dev->dev_addr[5], dev->irq); | 1469 | dev->dev_addr[2], dev->dev_addr[3], |
1470 | dev->dev_addr[4], dev->dev_addr[5], dev->irq); | ||
1471 | } | ||
1416 | 1472 | ||
1417 | rtl8169_hw_phy_config(dev); | 1473 | rtl8169_hw_phy_config(dev); |
1418 | 1474 | ||
@@ -1435,7 +1491,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1435 | 1491 | ||
1436 | rtl8169_set_speed(dev, autoneg, speed, duplex); | 1492 | rtl8169_set_speed(dev, autoneg, speed, duplex); |
1437 | 1493 | ||
1438 | if (RTL_R8(PHYstatus) & TBI_Enable) | 1494 | if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp)) |
1439 | printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name); | 1495 | printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name); |
1440 | 1496 | ||
1441 | return 0; | 1497 | return 0; |
@@ -1868,8 +1924,13 @@ static void rtl8169_reinit_task(void *_data) | |||
1868 | ret = rtl8169_open(dev); | 1924 | ret = rtl8169_open(dev); |
1869 | if (unlikely(ret < 0)) { | 1925 | if (unlikely(ret < 0)) { |
1870 | if (net_ratelimit()) { | 1926 | if (net_ratelimit()) { |
1871 | printk(PFX KERN_ERR "%s: reinit failure (status = %d)." | 1927 | struct rtl8169_private *tp = netdev_priv(dev); |
1872 | " Rescheduling.\n", dev->name, ret); | 1928 | |
1929 | if (netif_msg_drv(tp)) { | ||
1930 | printk(PFX KERN_ERR | ||
1931 | "%s: reinit failure (status = %d)." | ||
1932 | " Rescheduling.\n", dev->name, ret); | ||
1933 | } | ||
1873 | } | 1934 | } |
1874 | rtl8169_schedule_work(dev, rtl8169_reinit_task); | 1935 | rtl8169_schedule_work(dev, rtl8169_reinit_task); |
1875 | } | 1936 | } |
@@ -1894,8 +1955,12 @@ static void rtl8169_reset_task(void *_data) | |||
1894 | netif_wake_queue(dev); | 1955 | netif_wake_queue(dev); |
1895 | } else { | 1956 | } else { |
1896 | if (net_ratelimit()) { | 1957 | if (net_ratelimit()) { |
1897 | printk(PFX KERN_EMERG "%s: Rx buffers shortage\n", | 1958 | struct rtl8169_private *tp = netdev_priv(dev); |
1898 | dev->name); | 1959 | |
1960 | if (netif_msg_intr(tp)) { | ||
1961 | printk(PFX KERN_EMERG | ||
1962 | "%s: Rx buffers shortage\n", dev->name); | ||
1963 | } | ||
1899 | } | 1964 | } |
1900 | rtl8169_schedule_work(dev, rtl8169_reset_task); | 1965 | rtl8169_schedule_work(dev, rtl8169_reset_task); |
1901 | } | 1966 | } |
@@ -1981,8 +2046,11 @@ static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1981 | int ret = 0; | 2046 | int ret = 0; |
1982 | 2047 | ||
1983 | if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) { | 2048 | if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) { |
1984 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", | 2049 | if (netif_msg_drv(tp)) { |
1985 | dev->name); | 2050 | printk(KERN_ERR |
2051 | "%s: BUG! Tx Ring full when queue awake!\n", | ||
2052 | dev->name); | ||
2053 | } | ||
1986 | goto err_stop; | 2054 | goto err_stop; |
1987 | } | 2055 | } |
1988 | 2056 | ||
@@ -2057,8 +2125,11 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) | |||
2057 | pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); | 2125 | pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd); |
2058 | pci_read_config_word(pdev, PCI_STATUS, &pci_status); | 2126 | pci_read_config_word(pdev, PCI_STATUS, &pci_status); |
2059 | 2127 | ||
2060 | printk(KERN_ERR PFX "%s: PCI error (cmd = 0x%04x, status = 0x%04x).\n", | 2128 | if (netif_msg_intr(tp)) { |
2061 | dev->name, pci_cmd, pci_status); | 2129 | printk(KERN_ERR |
2130 | "%s: PCI error (cmd = 0x%04x, status = 0x%04x).\n", | ||
2131 | dev->name, pci_cmd, pci_status); | ||
2132 | } | ||
2062 | 2133 | ||
2063 | /* | 2134 | /* |
2064 | * The recovery sequence below admits a very elaborated explanation: | 2135 | * The recovery sequence below admits a very elaborated explanation: |
@@ -2077,7 +2148,8 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) | |||
2077 | 2148 | ||
2078 | /* The infamous DAC f*ckup only happens at boot time */ | 2149 | /* The infamous DAC f*ckup only happens at boot time */ |
2079 | if ((tp->cp_cmd & PCIDAC) && !tp->dirty_rx && !tp->cur_rx) { | 2150 | if ((tp->cp_cmd & PCIDAC) && !tp->dirty_rx && !tp->cur_rx) { |
2080 | printk(KERN_INFO PFX "%s: disabling PCI DAC.\n", dev->name); | 2151 | if (netif_msg_intr(tp)) |
2152 | printk(KERN_INFO "%s: disabling PCI DAC.\n", dev->name); | ||
2081 | tp->cp_cmd &= ~PCIDAC; | 2153 | tp->cp_cmd &= ~PCIDAC; |
2082 | RTL_W16(CPlusCmd, tp->cp_cmd); | 2154 | RTL_W16(CPlusCmd, tp->cp_cmd); |
2083 | dev->features &= ~NETIF_F_HIGHDMA; | 2155 | dev->features &= ~NETIF_F_HIGHDMA; |
@@ -2199,8 +2271,11 @@ rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp, | |||
2199 | if (status & DescOwn) | 2271 | if (status & DescOwn) |
2200 | break; | 2272 | break; |
2201 | if (status & RxRES) { | 2273 | if (status & RxRES) { |
2202 | printk(KERN_INFO "%s: Rx ERROR. status = %08x\n", | 2274 | if (netif_msg_rx_err(tp)) { |
2203 | dev->name, status); | 2275 | printk(KERN_INFO |
2276 | "%s: Rx ERROR. status = %08x\n", | ||
2277 | dev->name, status); | ||
2278 | } | ||
2204 | tp->stats.rx_errors++; | 2279 | tp->stats.rx_errors++; |
2205 | if (status & (RxRWT | RxRUNT)) | 2280 | if (status & (RxRWT | RxRUNT)) |
2206 | tp->stats.rx_length_errors++; | 2281 | tp->stats.rx_length_errors++; |
@@ -2260,7 +2335,7 @@ move_on: | |||
2260 | tp->cur_rx = cur_rx; | 2335 | tp->cur_rx = cur_rx; |
2261 | 2336 | ||
2262 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); | 2337 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); |
2263 | if (!delta && count) | 2338 | if (!delta && count && netif_msg_intr(tp)) |
2264 | printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); | 2339 | printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); |
2265 | tp->dirty_rx += delta; | 2340 | tp->dirty_rx += delta; |
2266 | 2341 | ||
@@ -2271,7 +2346,7 @@ move_on: | |||
2271 | * after refill ? | 2346 | * after refill ? |
2272 | * - how do others driver handle this condition (Uh oh...). | 2347 | * - how do others driver handle this condition (Uh oh...). |
2273 | */ | 2348 | */ |
2274 | if (tp->dirty_rx + NUM_RX_DESC == tp->cur_rx) | 2349 | if ((tp->dirty_rx + NUM_RX_DESC == tp->cur_rx) && netif_msg_intr(tp)) |
2275 | printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name); | 2350 | printk(KERN_EMERG "%s: Rx buffers exhausted\n", dev->name); |
2276 | 2351 | ||
2277 | return count; | 2352 | return count; |
@@ -2323,7 +2398,7 @@ rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) | |||
2323 | 2398 | ||
2324 | if (likely(netif_rx_schedule_prep(dev))) | 2399 | if (likely(netif_rx_schedule_prep(dev))) |
2325 | __netif_rx_schedule(dev); | 2400 | __netif_rx_schedule(dev); |
2326 | else { | 2401 | else if (netif_msg_intr(tp)) { |
2327 | printk(KERN_INFO "%s: interrupt %04x taken in poll\n", | 2402 | printk(KERN_INFO "%s: interrupt %04x taken in poll\n", |
2328 | dev->name, status); | 2403 | dev->name, status); |
2329 | } | 2404 | } |
@@ -2342,8 +2417,10 @@ rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) | |||
2342 | } while (boguscnt > 0); | 2417 | } while (boguscnt > 0); |
2343 | 2418 | ||
2344 | if (boguscnt <= 0) { | 2419 | if (boguscnt <= 0) { |
2345 | printk(KERN_WARNING "%s: Too much work at interrupt!\n", | 2420 | if (net_ratelimit() && netif_msg_intr(tp)) { |
2346 | dev->name); | 2421 | printk(KERN_WARNING |
2422 | "%s: Too much work at interrupt!\n", dev->name); | ||
2423 | } | ||
2347 | /* Clear all interrupt sources. */ | 2424 | /* Clear all interrupt sources. */ |
2348 | RTL_W16(IntrStatus, 0xffff); | 2425 | RTL_W16(IntrStatus, 0xffff); |
2349 | } | 2426 | } |
@@ -2466,8 +2543,10 @@ rtl8169_set_rx_mode(struct net_device *dev) | |||
2466 | 2543 | ||
2467 | if (dev->flags & IFF_PROMISC) { | 2544 | if (dev->flags & IFF_PROMISC) { |
2468 | /* Unconditionally log net taps. */ | 2545 | /* Unconditionally log net taps. */ |
2469 | printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", | 2546 | if (netif_msg_link(tp)) { |
2470 | dev->name); | 2547 | printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", |
2548 | dev->name); | ||
2549 | } | ||
2471 | rx_mode = | 2550 | rx_mode = |
2472 | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | | 2551 | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | |
2473 | AcceptAllPhys; | 2552 | AcceptAllPhys; |