Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3807051pxu; Mon, 12 Oct 2020 01:22:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynviMSO5LNO28Kw6wvth/v856VxepiMt8YNAGsylk+o/6XXIQ40JRJ/jQ2NH9vmy3xNTX3 X-Received: by 2002:aa7:d488:: with SMTP id b8mr12479246edr.21.1602490979052; Mon, 12 Oct 2020 01:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602490979; cv=none; d=google.com; s=arc-20160816; b=FaEl7dN+n6sQnVvANHJZm1XUq06nrAHOlYecvTgkDugTA5SSEMlDLCQzS3n5eikyP/ gL8pz07J7ZZ658fzJPidP9sVtHQOTqmxJ1vDRyBiszSjsVDbykcDWHOaqJgOQW7Gnt0l Gr/MD0sRNWlnDFoUJLqtV1Ja/ZQKiezGIiU6gEeaXZSi1VCZXsOFONnC2d95hSae/vbx gquwmjlVai+B8e17ftgyua3WC3BdwrX2Ej5XeQwunfx/CQePG1g13kmdjoNwDiXGUiK0 SF+DBnUCrRHeFfd+rb32wTjbWCe0ErUInvdPKo051EBT3B7/hgNiOW8svKRcW7wUU+Im QWjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:dkim-signature; bh=pinXyNbLzNVPX/bjvrXpQvjJmZP5stTSjNwoOuOjf58=; b=nqU1G/klmSFkwsItFuosaVbGDUcL9CnGRyJ38j5tDqCeqRXBudXDGphd4EwYJ2bzI0 q7/wegCmmtQ0isIc5gMNztrkvzGLtv28Kng7EAI7AbX8WjkP9RUotjJkO3GqUZyS7cF0 rz/YNiuL1Ljs5R2bklqxrHY4V9+abjVKbgO+RwpSnjUn/L8/fZKGS/ybBjUsN+F9CHYn Pwmz23rklLFJ7BZPdTi9hvcZpGsT5FzW2nlc8ey6h/XfygWrXZfMBGKRTR5JI4iG2NO0 alpie8dc+NvGV69+rbBNSdGAISC0IWJFkpvJKO3p3aPP2TXCRS23TomVXyA6EuZ+RxR+ m/hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YIWmvaXj; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si800728eji.277.2020.10.12.01.22.34; Mon, 12 Oct 2020 01:22:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YIWmvaXj; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727452AbgJLIVy (ORCPT + 99 others); Mon, 12 Oct 2020 04:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727325AbgJLIVu (ORCPT ); Mon, 12 Oct 2020 04:21:50 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81021C0613CE; Mon, 12 Oct 2020 01:21:49 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id u21so22000520eja.2; Mon, 12 Oct 2020 01:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pinXyNbLzNVPX/bjvrXpQvjJmZP5stTSjNwoOuOjf58=; b=YIWmvaXj7toieBiR6u74axTiOYjNawVWVtnHUyzNWXykWBn89aGaVyvF2haYTaAskF jjgPJIg550NZ0VDgYrXna3lBgTWA8Z6sK/nB4o9vWcDFD/u02S1ilD8dorfma/JoyyYB mMYHDCKYtOpROJbMbPzz3JLo74hKj1Iy0uOE4Hcjp6O/K0iTauIgpVp6CQyCBwpJVjlY 0LHrbQIbAeJx7vxB9Oap2QLNBhXOyobXyaYc4zVE5ZbL1P+7UwIgIS/1P26x7gUndJng 3ENBnQVP+YMBJ9+uqKlnKlRD1E8LYrMZypcQp2lhUydsh1gi7Grpu3WO831Lx14+H3WH KB4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pinXyNbLzNVPX/bjvrXpQvjJmZP5stTSjNwoOuOjf58=; b=JAphHkob91B6DQE695/v2YEHY7+L5M8h4l/86tEhAo0TedkvZqHx+dHQ9gr0iJTO7p VHPnqaFVv4RkELS8npz9LMF3cuImD6LXvXpnCKkMIqoyy1lX8Eg3CHTWonMry/U3FSof 2mAjsOiquaDh2ac+Xn7lU6Xv+svAJbF0m3mmrHKoPw1Wbc+ki5Sc5XSyUN3BTtpYyPwe qmb8DAkUR9r0DenuMFBbE7twbR9TRJ10WulLZBABoqjWXvHkXra8fh7/hRC7MICQwmO5 cAxgMlxOOMCW4O1+EuNt/8tu5WYX1M++JiJVcYxQoh800uC+KKY04cjOK1zH/9p6Uf/h PnYg== X-Gm-Message-State: AOAM533Eq3Et9WpulZfv8RCEXDgjKjG/YlfYk4+E9VoPHffdSA9L8guW QpZ60JSVmvRGO4ISmOXi3+A= X-Received: by 2002:a17:906:8519:: with SMTP id i25mr26774698ejx.76.1602490908123; Mon, 12 Oct 2020 01:21:48 -0700 (PDT) Received: from ?IPv6:2003:ea:8f00:6a00:f90c:2907:849f:701c? (p200300ea8f006a00f90c2907849f701c.dip0.t-ipconnect.de. [2003:ea:8f00:6a00:f90c:2907:849f:701c]) by smtp.googlemail.com with ESMTPSA id h22sm10232665ejc.80.2020.10.12.01.21.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Oct 2020 01:21:47 -0700 (PDT) Subject: [PATCH net-next v2 05/12] net: usbnet: use new function dev_fetch_sw_netstats From: Heiner Kallweit To: David Miller , Jakub Kicinski , =?UTF-8?Q?Bj=c3=b8rn_Mork?= , Oliver Neukum , Igor Mitsyanko , Sergey Matyukevich , Kalle Valo , Roopa Prabhu , Nikolay Aleksandrov , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Alexey Kuznetsov , Hideaki YOSHIFUJI , Johannes Berg , Pravin B Shelar , Steffen Klassert , Herbert Xu Cc: "netdev@vger.kernel.org" , linux-rdma@vger.kernel.org, Linux USB Mailing List , linux-wireless , bridge@lists.linux-foundation.org References: Message-ID: <70ad3e33-8ea6-e12e-31de-5fec7a3c4f6e@gmail.com> Date: Mon, 12 Oct 2020 10:07:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Simplify the code by using new function dev_fetch_sw_netstats(). Signed-off-by: Heiner Kallweit --- drivers/net/usb/usbnet.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 963d260d1..6062dc278 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -983,31 +983,9 @@ EXPORT_SYMBOL_GPL(usbnet_set_link_ksettings); void usbnet_get_stats64(struct net_device *net, struct rtnl_link_stats64 *stats) { struct usbnet *dev = netdev_priv(net); - unsigned int start; - int cpu; netdev_stats_to_stats64(stats, &net->stats); - - for_each_possible_cpu(cpu) { - struct pcpu_sw_netstats *stats64; - u64 rx_packets, rx_bytes; - u64 tx_packets, tx_bytes; - - stats64 = per_cpu_ptr(dev->stats64, cpu); - - do { - start = u64_stats_fetch_begin_irq(&stats64->syncp); - rx_packets = stats64->rx_packets; - rx_bytes = stats64->rx_bytes; - tx_packets = stats64->tx_packets; - tx_bytes = stats64->tx_bytes; - } while (u64_stats_fetch_retry_irq(&stats64->syncp, start)); - - stats->rx_packets += rx_packets; - stats->rx_bytes += rx_bytes; - stats->tx_packets += tx_packets; - stats->tx_bytes += tx_bytes; - } + dev_fetch_sw_netstats(stats, dev->stats64); } EXPORT_SYMBOL_GPL(usbnet_get_stats64); -- 2.28.0