From patchwork Sun Oct 11 19:39:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11831097 X-Patchwork-Delegate: johannes@sipsolutions.net 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 E3B681580 for ; Sun, 11 Oct 2020 19:44:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6491215A4 for ; Sun, 11 Oct 2020 19:44:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MdJ4QWv6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbgJKToj (ORCPT ); Sun, 11 Oct 2020 15:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbgJKTof (ORCPT ); Sun, 11 Oct 2020 15:44:35 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45202C0613CE; Sun, 11 Oct 2020 12:44:35 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id o18so14743100edq.4; Sun, 11 Oct 2020 12:44:35 -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=MdJ4QWv6yJuL/l2OhB7xzWNVy+zRUUOc2Zmq2r6kz69YmC7edeD8SQOWY5BcoLeUzX ogwkOVKYgX4+0aXYCsA21Yq8sFWFV/uZizHm5EdW4jeYb3EGjA0DJzLY8lOlwC6uHMW8 htjV2C56x49koAQuXCDOYq5rteaudtGE/1A/EkXqsS3IZrZbvCKo5Ss1J92v1uV2inRv 2eAuq2Lnzb2cMyumzcVEu0HNZYarGbEWVHwpeNgc14/xQ3jR2dp9sHRdackkJhiaKvji vyxU1eXFLdpm3OBVokdaXHoxQAitkX2aUINFS4qr3ukUQ1AQ3+VtjoOJhb5DgxspDs43 vYkg== 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=QFpxx/4SHt9483cCgw9ryjN5ADif/DaRBuWlJfrbfjYoJyGUaX6h4Vy460pHx8ZymO B0v7CtYLkYdTm87MRpLnSC6QeEFz4g0fP2mpEo8D5Q+SJ4BSqCKXyR9/hyVreSGYfR+v nvDdLMVg8UngU8mMc7fhG81QKdvHQEM2IX8Cw8/pf31IRpX/NM6ggTG0DKo2Y263EMbk gLgMEMonYJ475QWTxE6N00PmA0llFeKpkl4BVeik3AbiG3zhy2xK/Agx11kAfvgCUQa3 vhDdOI64Yt20Q3Fr5rmXJbNk0qrEBPzWUyKBIZWozKbJQI252POyk9UpCPvcwmGQRiNo 0ZPg== X-Gm-Message-State: AOAM532q2w6oyjm2ZkFZr/ljY0gxmoLVXbUd8gUl928AML22sl39+q3V 7jKVGz92/BAPVeGyzsXiCb4= X-Google-Smtp-Source: ABdhPJxFHfj/MBXeetj477kxdURdC3Dlcz5g257iXuawEKZFoVAzZWuyj+HwYtf/AqICeqid3bPHBw== X-Received: by 2002:a05:6402:b0e:: with SMTP id bm14mr10989272edb.259.1602445473344; Sun, 11 Oct 2020 12:44:33 -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 a22sm9549717ejs.25.2020.10.11.12.44.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Oct 2020 12:44:32 -0700 (PDT) Subject: [PATCH net-next 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: Date: Sun, 11 Oct 2020 21:39:28 +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-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);