c155b11431f87c2e41bbb9a3523293d57bf9165f
[openwrt/staging/blocktrron.git] /
1 From 400909df6e6543cb5cce3db9bbcd413d59125327 Mon Sep 17 00:00:00 2001
2 From: Heiner Kallweit <hkallweit1@gmail.com>
3 Date: Sat, 10 Feb 2024 17:58:29 +0100
4 Subject: [PATCH] r8169: simplify code by using core-provided pcpu stats
5 allocation
6
7 Use core-provided pcpu stats allocation instead of open-coding it in
8 the driver.
9
10 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
11 Link: https://lore.kernel.org/r/03f5bb3b-d7f4-48be-ae8a-54862ec4566c@gmail.com
12 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
13 ---
14 drivers/net/ethernet/realtek/r8169_main.c | 7 ++-----
15 1 file changed, 2 insertions(+), 5 deletions(-)
16
17 --- a/drivers/net/ethernet/realtek/r8169_main.c
18 +++ b/drivers/net/ethernet/realtek/r8169_main.c
19 @@ -5290,11 +5290,6 @@ static int rtl_init_one(struct pci_dev *
20 raw_spin_lock_init(&tp->mac_ocp_lock);
21 mutex_init(&tp->led_lock);
22
23 - dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev,
24 - struct pcpu_sw_netstats);
25 - if (!dev->tstats)
26 - return -ENOMEM;
27 -
28 /* Get the *optional* external "ether_clk" used on some boards */
29 tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk");
30 if (IS_ERR(tp->clk))
31 @@ -5409,6 +5404,8 @@ static int rtl_init_one(struct pci_dev *
32 dev->hw_features |= NETIF_F_RXALL;
33 dev->hw_features |= NETIF_F_RXFCS;
34
35 + dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
36 +
37 netdev_sw_irq_coalesce_default_on(dev);
38
39 /* configure chip for default features */