|
59 | 59 | #define FIRMWARE_8107E_2 "rtl_nic/rtl8107e-2.fw" |
60 | 60 | #define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" |
61 | 61 |
|
62 | | -#define R8169_MSG_DEFAULT \ |
63 | | - (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) |
64 | | - |
65 | 62 | /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). |
66 | 63 | The RTL chips use a 64 element hash table based on the Ethernet CRC. */ |
67 | 64 | #define MC_FILTER_LIMIT 32 |
@@ -179,10 +176,6 @@ static const struct pci_device_id rtl8169_pci_tbl[] = { |
179 | 176 |
|
180 | 177 | MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); |
181 | 178 |
|
182 | | -static struct { |
183 | | - u32 msg_enable; |
184 | | -} debug = { -1 }; |
185 | | - |
186 | 179 | enum rtl_registers { |
187 | 180 | MAC0 = 0, /* Ethernet hardware address. */ |
188 | 181 | MAC4 = 4, |
@@ -604,7 +597,6 @@ struct rtl8169_private { |
604 | 597 | struct net_device *dev; |
605 | 598 | struct phy_device *phydev; |
606 | 599 | struct napi_struct napi; |
607 | | - u32 msg_enable; |
608 | 600 | enum mac_version mac_version; |
609 | 601 | u32 cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */ |
610 | 602 | u32 cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */ |
@@ -646,8 +638,6 @@ typedef void (*rtl_generic_fct)(struct rtl8169_private *tp); |
646 | 638 |
|
647 | 639 | MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); |
648 | 640 | MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver"); |
649 | | -module_param_named(debug, debug.msg_enable, int, 0); |
650 | | -MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); |
651 | 641 | MODULE_SOFTDEP("pre: realtek"); |
652 | 642 | MODULE_LICENSE("GPL"); |
653 | 643 | MODULE_FIRMWARE(FIRMWARE_8168D_1); |
@@ -751,8 +741,10 @@ static bool rtl_loop_wait(struct rtl8169_private *tp, const struct rtl_cond *c, |
751 | 741 | return true; |
752 | 742 | delay(d); |
753 | 743 | } |
754 | | - netif_err(tp, drv, tp->dev, "%s == %d (loop: %d, delay: %d).\n", |
755 | | - c->msg, !high, n, d); |
| 744 | + |
| 745 | + if (net_ratelimit()) |
| 746 | + netdev_err(tp->dev, "%s == %d (loop: %d, delay: %d).\n", |
| 747 | + c->msg, !high, n, d); |
756 | 748 | return false; |
757 | 749 | } |
758 | 750 |
|
@@ -797,7 +789,8 @@ static bool name ## _check(struct rtl8169_private *tp) |
797 | 789 | static bool rtl_ocp_reg_failure(struct rtl8169_private *tp, u32 reg) |
798 | 790 | { |
799 | 791 | if (reg & 0xffff0001) { |
800 | | - netif_err(tp, drv, tp->dev, "Invalid ocp reg %x!\n", reg); |
| 792 | + if (net_ratelimit()) |
| 793 | + netdev_err(tp->dev, "Invalid ocp reg %x!\n", reg); |
801 | 794 | return true; |
802 | 795 | } |
803 | 796 | return false; |
@@ -1580,20 +1573,6 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
1580 | 1573 | rtl_unlock_work(tp); |
1581 | 1574 | } |
1582 | 1575 |
|
1583 | | -static u32 rtl8169_get_msglevel(struct net_device *dev) |
1584 | | -{ |
1585 | | - struct rtl8169_private *tp = netdev_priv(dev); |
1586 | | - |
1587 | | - return tp->msg_enable; |
1588 | | -} |
1589 | | - |
1590 | | -static void rtl8169_set_msglevel(struct net_device *dev, u32 value) |
1591 | | -{ |
1592 | | - struct rtl8169_private *tp = netdev_priv(dev); |
1593 | | - |
1594 | | - tp->msg_enable = value; |
1595 | | -} |
1596 | | - |
1597 | 1576 | static const char rtl8169_gstrings[][ETH_GSTRING_LEN] = { |
1598 | 1577 | "tx_packets", |
1599 | 1578 | "rx_packets", |
@@ -1985,8 +1964,6 @@ static const struct ethtool_ops rtl8169_ethtool_ops = { |
1985 | 1964 | .get_link = ethtool_op_get_link, |
1986 | 1965 | .get_coalesce = rtl_get_coalesce, |
1987 | 1966 | .set_coalesce = rtl_set_coalesce, |
1988 | | - .get_msglevel = rtl8169_get_msglevel, |
1989 | | - .set_msglevel = rtl8169_set_msglevel, |
1990 | 1967 | .get_regs = rtl8169_get_regs, |
1991 | 1968 | .get_wol = rtl8169_get_wol, |
1992 | 1969 | .set_wol = rtl8169_set_wol, |
@@ -3868,8 +3845,7 @@ static struct page *rtl8169_alloc_rx_data(struct rtl8169_private *tp, |
3868 | 3845 |
|
3869 | 3846 | mapping = dma_map_page(d, data, 0, R8169_RX_BUF_SIZE, DMA_FROM_DEVICE); |
3870 | 3847 | if (unlikely(dma_mapping_error(d, mapping))) { |
3871 | | - if (net_ratelimit()) |
3872 | | - netif_err(tp, drv, tp->dev, "Failed to map RX DMA!\n"); |
| 3848 | + netdev_err(tp->dev, "Failed to map RX DMA!\n"); |
3873 | 3849 | __free_pages(data, get_order(R8169_RX_BUF_SIZE)); |
3874 | 3850 | return NULL; |
3875 | 3851 | } |
@@ -4006,7 +3982,7 @@ static int rtl8169_tx_map(struct rtl8169_private *tp, const u32 *opts, u32 len, |
4006 | 3982 | ret = dma_mapping_error(d, mapping); |
4007 | 3983 | if (unlikely(ret)) { |
4008 | 3984 | if (net_ratelimit()) |
4009 | | - netif_err(tp, drv, tp->dev, "Failed to map TX data!\n"); |
| 3985 | + netdev_err(tp->dev, "Failed to map TX data!\n"); |
4010 | 3986 | return ret; |
4011 | 3987 | } |
4012 | 3988 |
|
@@ -4172,7 +4148,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, |
4172 | 4148 | txd_first = tp->TxDescArray + entry; |
4173 | 4149 |
|
4174 | 4150 | if (unlikely(!rtl_tx_slots_avail(tp, frags))) { |
4175 | | - netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); |
| 4151 | + if (net_ratelimit()) |
| 4152 | + netdev_err(dev, "BUG! Tx Ring full when queue awake!\n"); |
4176 | 4153 | goto err_stop_0; |
4177 | 4154 | } |
4178 | 4155 |
|
@@ -4334,9 +4311,9 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) |
4334 | 4311 |
|
4335 | 4312 | pci_status_errs = pci_status_get_and_clear_errors(pdev); |
4336 | 4313 |
|
4337 | | - netif_err(tp, intr, dev, "PCI error (cmd = 0x%04x, status_errs = 0x%04x)\n", |
4338 | | - pci_cmd, pci_status_errs); |
4339 | | - |
| 4314 | + if (net_ratelimit()) |
| 4315 | + netdev_err(dev, "PCI error (cmd = 0x%04x, status_errs = 0x%04x)\n", |
| 4316 | + pci_cmd, pci_status_errs); |
4340 | 4317 | /* |
4341 | 4318 | * The recovery sequence below admits a very elaborated explanation: |
4342 | 4319 | * - it seems to work; |
@@ -4454,8 +4431,9 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget |
4454 | 4431 | dma_rmb(); |
4455 | 4432 |
|
4456 | 4433 | if (unlikely(status & RxRES)) { |
4457 | | - netif_info(tp, rx_err, dev, "Rx ERROR. status = %08x\n", |
4458 | | - status); |
| 4434 | + if (net_ratelimit()) |
| 4435 | + netdev_warn(dev, "Rx ERROR. status = %08x\n", |
| 4436 | + status); |
4459 | 4437 | dev->stats.rx_errors++; |
4460 | 4438 | if (status & (RxRWT | RxRUNT)) |
4461 | 4439 | dev->stats.rx_length_errors++; |
@@ -5326,7 +5304,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
5326 | 5304 | tp = netdev_priv(dev); |
5327 | 5305 | tp->dev = dev; |
5328 | 5306 | tp->pci_dev = pdev; |
5329 | | - tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); |
5330 | 5307 | tp->supports_gmii = ent->driver_data == RTL_CFG_NO_GBIT ? 0 : 1; |
5331 | 5308 | tp->eee_adv = -1; |
5332 | 5309 | tp->ocp_base = OCP_STD_PHY_BASE; |
@@ -5484,15 +5461,14 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
5484 | 5461 | if (rc) |
5485 | 5462 | return rc; |
5486 | 5463 |
|
5487 | | - netif_info(tp, probe, dev, "%s, %pM, XID %03x, IRQ %d\n", |
5488 | | - rtl_chip_infos[chipset].name, dev->dev_addr, xid, |
5489 | | - pci_irq_vector(pdev, 0)); |
| 5464 | + netdev_info(dev, "%s, %pM, XID %03x, IRQ %d\n", |
| 5465 | + rtl_chip_infos[chipset].name, dev->dev_addr, xid, |
| 5466 | + pci_irq_vector(pdev, 0)); |
5490 | 5467 |
|
5491 | 5468 | if (jumbo_max) |
5492 | | - netif_info(tp, probe, dev, |
5493 | | - "jumbo features [frames: %d bytes, tx checksumming: %s]\n", |
5494 | | - jumbo_max, tp->mac_version <= RTL_GIGA_MAC_VER_06 ? |
5495 | | - "ok" : "ko"); |
| 5469 | + netdev_info(dev, "jumbo features [frames: %d bytes, tx checksumming: %s]\n", |
| 5470 | + jumbo_max, tp->mac_version <= RTL_GIGA_MAC_VER_06 ? |
| 5471 | + "ok" : "ko"); |
5496 | 5472 |
|
5497 | 5473 | if (r8168_check_dash(tp)) |
5498 | 5474 | rtl8168_driver_start(tp); |
|
0 commit comments