From patchwork Sun Oct 11 19:38:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11831083 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16A98109B for ; Sun, 11 Oct 2020 19:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE3EC2145D for ; Sun, 11 Oct 2020 19:44:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ak9qyYGU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726769AbgJKTof (ORCPT ); Sun, 11 Oct 2020 15:44:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726661AbgJKTod (ORCPT ); Sun, 11 Oct 2020 15:44:33 -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 2D9D3C0613D1; Sun, 11 Oct 2020 12:44:33 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id lw21so20328975ejb.6; Sun, 11 Oct 2020 12:44:33 -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=GOIK3Hq+WKcGwLhTgVcjjfr06Gc4T0D1ld9TN3UCVLk=; b=ak9qyYGUS/U3E7+fqKubKrZLUjAKvhb5C7ccuV+XENvdJ6qznvZ2FmEuZsE04zT+Bb pgBBsU8+QXgI9zw+6dsTfR75KDCqVtJ2MvmuKgSpfqiX0nbQ+bRrtJiPhhwkKtzSybdY wcNaUW5gH5oQ84Jhoynwt0AwviYe/rMjqcytLiAPOJxWrH6wYYUIsM1Rfu/taPd1XF7h TbJbIjw8Z68xZLGS2UMDeCLXLamJ1VM2Earj8w6IyiwrZLdut+ATAyuT5b1o7Bujm4SK y5nPoaZLubDDb3DBoa+bkCTReCWgmr38aSNg7Y3PXXcBjvcNlqgn4aTnDgYoSJ19F2S4 hwtg== 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=GOIK3Hq+WKcGwLhTgVcjjfr06Gc4T0D1ld9TN3UCVLk=; b=hg5QOnenK3p5QqTC3HFs506VdEe8bMMaAnc37RaIV1N9tTQgkuasfsV0tB8WwF5gO3 FpcEuSfxNSJm6TsB98HGliXnqrF9Z33HLgG5G5bsgGdsvmWoN24AOFecU7ewNIHOh1no 7CQdRSR92tW5POSEDFq0B9P37aYwATz7ke4Ca+i5D06bfwJoJVNiB3MedRbYdCl7B7GG B+dfx7oX7eDGtEECNStNNqL4BIzuRENEiNfDe/9o6RinY13pDKGQLDHD3K4KW0xdECsl yTrEOIOSMaD1pHez1raV6uaJEbiuGmvbHoJ5YRYRVJlPf04kyC7502qq09B2tTooLxBw 5PXw== X-Gm-Message-State: AOAM532J7s5KEFVnQO6Vuy90UsGANSu4C67peGn/erLp/ueh/xikDbAx v1fQWX2GUTnoAXPqaUCK5os= X-Google-Smtp-Source: ABdhPJyAzc9Sk1A8caGl+hCGaIAJ01fKrSLPSH3KAJAeZ/TISr185eyHMYYLC4sIDCTQCQp5NYVRNA== X-Received: by 2002:a17:906:cd14:: with SMTP id oz20mr7328506ejb.7.1602445471848; Sun, 11 Oct 2020 12:44:31 -0700 (PDT) Received: from ?IPv6:2003:ea:8f00:6a00:51b7:bf4f:604:7d3d? (p200300ea8f006a0051b7bf4f06047d3d.dip0.t-ipconnect.de. [2003:ea:8f00:6a00:51b7:bf4f:604:7d3d]) by smtp.googlemail.com with ESMTPSA id e4sm9728173edk.38.2020.10.11.12.44.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Oct 2020 12:44:31 -0700 (PDT) Subject: [PATCH net-next 04/12] net: usb: qmi_wwan: 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: <9cde03fe-d032-521d-2d34-34429d6d1a1c@gmail.com> Date: Sun, 11 Oct 2020 21:38:44 +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-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Simplify the code by using new function dev_fetch_sw_netstats(). Signed-off-by: Heiner Kallweit Acked-by: Bjørn Mork --- drivers/net/usb/qmi_wwan.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 5ca1356b8..a322f5187 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -126,31 +126,9 @@ static void qmimux_get_stats64(struct net_device *net, struct rtnl_link_stats64 *stats) { struct qmimux_priv *priv = 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(priv->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, priv->stats64); } static const struct net_device_ops qmimux_netdev_ops = {