From patchwork Mon Oct 5 20:34:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 288972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 641ABC4363A for ; Mon, 5 Oct 2020 20:34:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A53C21582 for ; Mon, 5 Oct 2020 20:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729205AbgJEUeo (ORCPT ); Mon, 5 Oct 2020 16:34:44 -0400 Received: from mailrelay115.isp.belgacom.be ([195.238.20.142]:49326 "EHLO mailrelay115.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726935AbgJEUeo (ORCPT ); Mon, 5 Oct 2020 16:34:44 -0400 IronPort-SDR: 5UJJ2ztZuermn/HKPMlDXYbxr2onSa5jvZdSeaMTyvJObu/jdR6Qy1DVHAJYq3hsP1PhKZ8ip8 CCrf7XC41edcjdtwRN4VmG8Ya4kj5jkNA5lBqO3XTPp7vlnTIEZsTuXtepoUY+w8oQ2moc1rG2 0RA0R3FUUk9+kCrjTRs9PeAf7mra1mH4kr5U/qfM+FEkT/HOjarGe0L7uyId6ePBQGDqaH7o5Q /G8tQNIvZRQuPgpAplF1w221AkUaXmZx/IS3nuFENGWe8dbZD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wEBAQMCBQEBBgEBAQEBAQUEAYYPRYI3IoNHCwEjI4E/EoMmglgpqhczhBCFC4FCgTiIMoUagUE/hF+KNAS3TYJxgxOEa5JUDyKDDp4RLZJngXmgMIF6TSAYgyRQGQ2OKAMXjiZCMDcCBgoBAQMJVwE9AY0yAQE X-IPAS-Result: A2DgAgDggntf/xCltltgHAEBAQEBAQcBARIBAQQEAQFHgUiBHoJRX40/klaKWYctCwEBAQEBAQEBATUBAgQBAYRKgjsmOBMCAwEBAQMCBQEBBgEBAQEBAQUEAYYPRYI3IoNHCwEjI4E/EoMmglgpqhczhBCFC4FCgTiIMoUagUE/hF+KNAS3TYJxgxOEa5JUDyKDDp4RLZJngXmgMIF6TSAYgyRQGQ2OKAMXjiZCMDcCBgoBAQMJVwE9AY0yAQE Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 05 Oct 2020 22:34:41 +0200 From: Fabian Frederick To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: pablo@netfilter.org, laforge@gnumonks.org, steffen.klassert@secunet.com, herbert@gondor.apana.org.au, pshelar@ovn.org, dev@openvswitch.org, yoshfuji@linux-ipv6.org, kuznet@ms2.inr.ac.ru, Fabian Frederick Subject: [PATCH 1/9 net-next] net: netdevice.h: sw_netstats_rx_add helper Date: Mon, 5 Oct 2020 22:34:18 +0200 Message-Id: <20201005203418.55128-1-fabf@skynet.be> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org some drivers/network protocols update rx bytes/packets under u64_stats_update_begin/end sequence. Add a specific helper like dev_lstats_add() Signed-off-by: Fabian Frederick --- include/linux/netdevice.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 0c79d9e56a5e5..42b18e034adde 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2530,6 +2530,17 @@ struct pcpu_lstats { void dev_lstats_read(struct net_device *dev, u64 *packets, u64 *bytes); +static inline void dev_sw_netstats_rx_add(struct net_device *dev, unsigned int len) +{ + struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); + + u64_stats_update_begin(&tstats->syncp); + tstats->rx_bytes += len; + tstats->rx_packets++; + u64_stats_update_end(&tstats->syncp); + +} + static inline void dev_lstats_add(struct net_device *dev, unsigned int len) { struct pcpu_lstats *lstats = this_cpu_ptr(dev->lstats);