Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3807608pxu; Mon, 12 Oct 2020 01:24:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/D1GiJVcSDDVOK7FAp+zMPDqSxTaDfTBg7t9BSelaQ4+9HCcTXi68ipxDR6azzxwhKd+x X-Received: by 2002:a05:6402:195:: with SMTP id r21mr9416406edv.164.1602491049698; Mon, 12 Oct 2020 01:24:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602491049; cv=none; d=google.com; s=arc-20160816; b=ux8UwGkuFNfGva/ImVmE2i5m9ZYlL473Lct5M653wvJRgs9c0/2JSddVQiBCmhniT4 5IU8yzJJ9SggQGEDAh9NTqX+Js7+hzyYqaVQz8Ac9yImO2C0yNRHck3wwhqP/AV7J567 IC/MFCGuTBZbzr9F6NMM4EeUrAAwdHHLThqNI/i+C4NsOkA+OH/YgX1Jgmw04M2r7xfm BaPEBn9HeB5LHT8u/+YcfCB45OB8TURbLX0lJJqpcZfvm0bzD2hiE9IsggFCMK4B92tX +UN+TzTAh2EhwMx5x5lLSFTdHf0OcWc4fkZTFnETsdUR68lLp29dIRcWqW5S0hVXTmgm C7cw== 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=kQY13u/J7Fp4HN8JNyMiTiNVGyBR7+vKMY2CDxSIOpA=; b=JnnMh07WKKH2LPH89d5vvmkAeV2/w3Y7Ioy7KwuocCwXc38t2GFymLDUSkfLb5+m9W GJDR2JYIlUOrkKIY9xF/7O+4vIBflvF8iRcA0mabVSu5G41xBsL5iTQ7xI+mgOcH++UF HwLOJhTNFTdmWtg3T3IIBmLtvrNjHUC+SjVBUXDg5ICHsXNwkRYZIVQLD/k4kOgaw57r FXCp26S1mF7SN5vbX+Tg4ZyUVeQd+L/k6wXLFknZiFlXh4RtXX96uby0yfI51YTFeDAO vCGCxyUwRUP6AG2Yq8D8JepWn8/TYxVRjmIMHscSCyg/r60tC4g+clRWW87nY3MbL/1Y cy7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LoWNdkgQ; 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 cq6si11378952edb.454.2020.10.12.01.23.44; Mon, 12 Oct 2020 01:24:09 -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=LoWNdkgQ; 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 S1728830AbgJLIWV (ORCPT + 99 others); Mon, 12 Oct 2020 04:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727584AbgJLIVy (ORCPT ); Mon, 12 Oct 2020 04:21:54 -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 5354CC0613D1; Mon, 12 Oct 2020 01:21:54 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id lw21so21988225ejb.6; Mon, 12 Oct 2020 01:21:54 -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=kQY13u/J7Fp4HN8JNyMiTiNVGyBR7+vKMY2CDxSIOpA=; b=LoWNdkgQEg6j2t7jglG4pZY5cy520+KElxP+XTQdibuLKMJQ17qaQKrgNKcZWMBhwd fh4tfgP9JMDppbFJLafJC7AKRl2W9Pmnrke1fkqaKB5xIOTDxiQLFWJXbIPBgnyW0byC b8zTIxJwYdtYF/lEL0uGz/AVe1CufR7arN5LYOBTY4JbKxwlmSu+tekilqKbSCodZKrZ ojSi1s6kcnwT0o91vuspcWEklTsDCI3HXvTwhb4qSDKLIf2Pjhw0XtgMyBzOSQiTDZHv ZyTjpn1tXvfeOALJnWiNgDYpht2jRdGu5C1L+qfeMJFU+ChxAf27lipacYpUWzI45E3X pPWQ== 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=kQY13u/J7Fp4HN8JNyMiTiNVGyBR7+vKMY2CDxSIOpA=; b=Xyf2oRqBnADMje0NC258LBWrwNrzLqns3nsIKN4ypzhT66iK0MWAyoBW4+3fNNckH8 LORC2KUPvgPVRaz2pwZnbhyHlcffX0bGvVmspSbsYrfudt7Iz7qV3v1czvqXEJscNfSd 4h3yA48aJfh2TJolLFvIMmV/2KYcATfhPA+QetYdGH3QGzu3SuyYCsm7zdt6M0OC9Yrx jJFyx6UijanH+9opTzYEJauFMMlMEnBNa4//TTZKbXZM217jOeM5oM29hJOg1/JlyBUg aWac+pT0rtlkejX8soTRtPCWnMgE+uAScTlzcJ3pHaZsejDX6Dv0Qbe/iX0r5ZbkF/7K Kw+w== X-Gm-Message-State: AOAM533epL3GlP1fWQj8IdZn+4pUws8Ht9GXvDq9RQN+AtoUtmNIaiHz ZPW71umKgGi2es9QUDVv6h4= X-Received: by 2002:a17:906:f8ca:: with SMTP id lh10mr5845312ejb.528.1602490912970; Mon, 12 Oct 2020 01:21:52 -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 k9sm9480801ejv.113.2020.10.12.01.21.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Oct 2020 01:21:52 -0700 (PDT) Subject: [PATCH net-next v2 08/12] net: dsa: 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:16:18 +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 Tested-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- net/dsa/slave.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index e7c1d62fd..3bc5ca40c 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1221,28 +1221,9 @@ static void dsa_slave_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) { struct dsa_slave_priv *p = netdev_priv(dev); - struct pcpu_sw_netstats *s; - unsigned int start; - int i; netdev_stats_to_stats64(stats, &dev->stats); - for_each_possible_cpu(i) { - u64 tx_packets, tx_bytes, rx_packets, rx_bytes; - - s = per_cpu_ptr(p->stats64, i); - do { - start = u64_stats_fetch_begin_irq(&s->syncp); - tx_packets = s->tx_packets; - tx_bytes = s->tx_bytes; - rx_packets = s->rx_packets; - rx_bytes = s->rx_bytes; - } while (u64_stats_fetch_retry_irq(&s->syncp, start)); - - stats->tx_packets += tx_packets; - stats->tx_bytes += tx_bytes; - stats->rx_packets += rx_packets; - stats->rx_bytes += rx_bytes; - } + dev_fetch_sw_netstats(stats, p->stats64); } static int dsa_slave_get_rxnfc(struct net_device *dev, -- 2.28.0