Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3807126pxu; Mon, 12 Oct 2020 01:23:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJythnfMAWQACKQtWjmLr0eYqNW5ydbWMLRbFOlblwOwqV/1pTMz6XOnRGgIm06rkaAFg2gX X-Received: by 2002:a17:907:2076:: with SMTP id qp22mr26546391ejb.358.1602490987412; Mon, 12 Oct 2020 01:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602490987; cv=none; d=google.com; s=arc-20160816; b=cCLGjVH3KX6YxMyOOaCQV8BnkzQhI7maVwLhNuNypYg0ZclGM57pz4R5Krf5Tan3Ah Ss94XjIUshKKs+TJhuXC4xqcek6ql/O1vzOOQEQ6JQwy9h8XCrtTKU0l4S09GzQaMFIn scsu8fyBVTBdTjdJHEV/LTObBY+Vtkj4QICE+V8Rp70I1oBfAvpY2U/DEee7+9eJvhX9 GSV53dgGk6ABnQF87z6bfBgPWPzhWSu1PrEsnsV+dVYyRQVixB2SoOpw+jhD5RPw4OvB BOF+libEEjUnauTJN3wDnkoWNdEvOqeWqYL4952ojUmp4JH8YFOiMAKzPq6h9QnIhmeK MClA== 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=EaLXgIQrEDNvTsXSSoH7bFY7SwGHVgit7+s+Oebz8kdNtg5hGFeqsagFKsnTrCDPwH V7dxWDnd1GZxI5vMgXfHGa/1qXUnbqWUFqYQRCyfo9augXfDs3scLq4zDownJ4Ly8C+8 bycoASUzsK1v1jhhqHUUKhsFgcbv+9am2PlGmxDpOhWg4Zy5bEXM2l6bP7NZlaz3bV2r xZ4eG9RE1XLSzRap8QdzRzVQK2k+UbKLRoxNuB9Ls+Pvu6STQW8QlD7cGvyn1Y56QeYv OWYRoi1vkwMFi6XjbtIiJp8OGUUeslr31aE29bXBvneF/UywSrJwOjYg8xKHgBjrlnqo 4zGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u6vzQZjp; 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 d25si11376808ejc.621.2020.10.12.01.22.43; Mon, 12 Oct 2020 01:23:07 -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=u6vzQZjp; 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 S1728252AbgJLIWE (ORCPT + 99 others); Mon, 12 Oct 2020 04:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727425AbgJLIVx (ORCPT ); Mon, 12 Oct 2020 04:21:53 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0AC2C0613CE; Mon, 12 Oct 2020 01:21:52 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id c22so22023367ejx.0; Mon, 12 Oct 2020 01:21:52 -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=u6vzQZjpjUwAoxgsdIvqGoW2wscsD+27fYStwCH0/DAdwWm40pGzmqma6NZfzR2nY4 FraHh5xiK/XNO/MGkH2q10HSSExTebIq4cBbJ5G0a+fA1d5/0R0JL0xHn2iWHdC4cXjh 3zcrCQJXT974X8B2at1b6ft2C7z6Wni/rrcSNWwAS16OOfclGUAxh3qlA5QQYpmDMr5+ SBfTMY55MMCVP6q9lIzHYl9Lf8zxTCzI/ADBY5mYJYrF0q9NQxICntDL6447ROzmLpbJ ccZIbeOlF2Vt9eZEOvuJCUrmFAhAZZYOBEGA6EH4/cDWprQdM7QP/i/4RE/eeApna4oe wlwA== 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=a+CpWMryDOscdStr5eHe0d4DCeR1BoG9ICCxBEVVGSSVqVlm4Gb+HvVRuAM9W8Pzc1 csvb/3X+caN624L9Lxg/ICIW4f7kQyb3LcqsoktbXxisbGpdXNjyu4scFFSVPsHE1/Up VZOzrlcp26zjl+T2pm0vuF97LPE0/KAWInI5/a/UDXvX4Qy1K4EwknCv8rPJL697ojLT PZKhPrc98NrvIW1p9BdNQEx6IRP2VVR8OflQfrpPnbh642wctnTu4LxfRhQLh/UNEi95 3xYZc53RBEHUWL15K9MrgRur4f0hj34VVdFEGsZsfebQu4OAeqzRmoheKlFqz8lPbLKg lQ+w== X-Gm-Message-State: AOAM530w87t82TOBZIVbltJIlvE+WnCRPXaHn4Gnzd8CNZ//pD2cNlm2 p2WGsjtnBg7+g0uh+xO3sysqmedW9y5B8g== X-Received: by 2002:a17:906:ae48:: with SMTP id lf8mr15228828ejb.345.1602490911396; Mon, 12 Oct 2020 01:21:51 -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 q27sm10354699ejd.74.2020.10.12.01.21.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Oct 2020 01:21:51 -0700 (PDT) Subject: [PATCH net-next v2 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: Mon, 12 Oct 2020 10:15:22 +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