Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3660915pxu; Sun, 11 Oct 2020 19:12:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywO011mzvviA1MORAdPs62q3a3KmCJ3lJXssxnuwFmwMtYgXuLTI4BLVycCN2E4Aqv1CV3 X-Received: by 2002:a17:906:3e4e:: with SMTP id t14mr25401289eji.242.1602468769277; Sun, 11 Oct 2020 19:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602468769; cv=none; d=google.com; s=arc-20160816; b=mbusitNHzCOx+7vCSzTog/tpsyTPZOXPJj5zmlWW0G0lAB64Q1A/a2foARbHhkd2sf Le1fMW1Wewv46QGeXnKfoD2+GdcLtmYA9TIVtdxt4pMdB+5iDPieLUgYtg51PBrbXTLe vDcd0LXMEUQE+yyNjDBD4ghDsh2DJEOA4IkFKBiJmcVy9r6KwN9iIH0VU0zAjWunFsqd M2lVUXQYHMar4xrYBUpfAA1e02+5gdH2xNeh3zHWv8mh56s2h4f9cmuuy/nB3aW9MUUj zG+L8kKDDzvea0+lIi749k6vP3q18Y3Qsqq5xNxH1lxsQwH7ERzLwIymKA94cnIVOKyC +DOw== 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=K5p6PQe9PHlb+DeFu3qCLN+dyNKfD6AR/iCNZWeTJCc=; b=z7PZWQSUwCNg9YKUVHY2GxaGMuLBbbiaa8EO0U+Piltoyofw0Uvh6m8TFz8dU3lUjQ dNuNOIoZZQz9bNzB0pweu+7t1So4YrOyG5AvPZLlXDzQpKT0dFpBzpDI2x8UTsQHq8Ti DGNali8BhV9fC8gqdGRZGkxuwAVBrrD+3chuXSjTwP9TIduIPaF2O0RmQZMNNL7L1dmv QB3TiGndQPFfG6CVXA+iOq7s0TJDydUxqAL1hXdux8y+L1Ld7Snj9inJiZWr+HwUjXmg nWaNsJIcRT+KeDE5aQJh1lN7gzmPzuLxX88/6diW3eRQ40s1pTOW1TmstwlfJ7RSiK7f cukg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HbRt6adG; 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 bl3si11319617ejb.286.2020.10.11.19.12.25; Sun, 11 Oct 2020 19:12:49 -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=HbRt6adG; 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 S1726957AbgJKTok (ORCPT + 99 others); Sun, 11 Oct 2020 15:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbgJKToi (ORCPT ); Sun, 11 Oct 2020 15:44:38 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD1C3C0613CE; Sun, 11 Oct 2020 12:44:37 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id c22so20364610ejx.0; Sun, 11 Oct 2020 12:44:37 -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=K5p6PQe9PHlb+DeFu3qCLN+dyNKfD6AR/iCNZWeTJCc=; b=HbRt6adGAkstImkM+FvDPUdRIwYLplfIyHr6lQj8N62eXViV/hea+3jch0P7j1QSAB XH0QnWYdoc68vK6BV4c2a/MGZmQhESAuaiw3nH6jaKZRtxReSo7CS4db24I/dCvBpJgx oZlNuBNZ2nX9TCEHVyKXJ9X9aB05foRI21NPRbCNHx6TqX7JIcFFDRlwbdkxHn4/hjGD npHaKOYfY4UL/Z0mRqf4t4/RPQ0n/iSlqNOx8vAXXwj8WPWYA8hK8o9AmRlXbHEVnL2l 3QmDQzkyFXpVlEMSLnXneAVyxrUcvFdZJG4gNH/1j/i31cFkBdsNYAUwx5CGGew38com vupA== 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=K5p6PQe9PHlb+DeFu3qCLN+dyNKfD6AR/iCNZWeTJCc=; b=IHh3A0PBAG2CaHrN61XMjol4PZyY7VUaco8PgLEKBb9+EIXJRgNc4bkUfYZnawF1P7 mIOqvNlJHANkmoOOhbYquFwJO/07ofX35AK5hNPNFJZG7uVAC3l2uFxJAa3Moq8Vu86E Dov3B7oVXmu/DVw9PegGMQ9fC+pWr/+bNWVc7JBXRBo9zT5S3oac/W28F2nJcCAsp+/8 jVlM1vAmf3MiiqOKfOcJBOWSB8ZuF3IqqwKpq4QLUgWfayepHdqslAaBSVKehjaUGeXq gaQG9Edk7bRTwpsMTQECioQqXxAYIO+nMm26xSwMYa6g0crnNCcl+RsbI5M9OwUV3EqH IiPg== X-Gm-Message-State: AOAM531Tf35tPaDBa0SyZNU9okCcnLfTbD7HXLqRzrmMVyEcDjWWrhtC xSmetIaedYUoSbzk+rB0+mM= X-Received: by 2002:a17:906:1b15:: with SMTP id o21mr25308968ejg.19.1602445476379; Sun, 11 Oct 2020 12:44:36 -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 q27sm9766916ejd.74.2020.10.11.12.44.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Oct 2020 12:44:36 -0700 (PDT) Subject: [PATCH net-next 07/12] net: bridge: 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:40:50 +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 --- net/bridge/br_device.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 9a2fb4aa1..6f742fee8 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -206,27 +206,8 @@ static void br_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) { struct net_bridge *br = netdev_priv(dev); - struct pcpu_sw_netstats tmp, sum = { 0 }; - unsigned int cpu; - - for_each_possible_cpu(cpu) { - unsigned int start; - const struct pcpu_sw_netstats *bstats - = per_cpu_ptr(br->stats, cpu); - do { - start = u64_stats_fetch_begin_irq(&bstats->syncp); - memcpy(&tmp, bstats, sizeof(tmp)); - } while (u64_stats_fetch_retry_irq(&bstats->syncp, start)); - sum.tx_bytes += tmp.tx_bytes; - sum.tx_packets += tmp.tx_packets; - sum.rx_bytes += tmp.rx_bytes; - sum.rx_packets += tmp.rx_packets; - } - stats->tx_bytes = sum.tx_bytes; - stats->tx_packets = sum.tx_packets; - stats->rx_bytes = sum.rx_bytes; - stats->rx_packets = sum.rx_packets; + dev_fetch_sw_netstats(stats, br->stats); } static int br_change_mtu(struct net_device *dev, int new_mtu) -- 2.28.0