From patchwork Wed Nov 4 14:24:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880787 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 B7659C2D0A3 for ; Wed, 4 Nov 2020 14:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4325020735 for ; Wed, 4 Nov 2020 14:31:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QrI9H99C" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbgKDObf (ORCPT ); Wed, 4 Nov 2020 09:31:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726706AbgKDObe (ORCPT ); Wed, 4 Nov 2020 09:31:34 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97722C0613D3 for ; Wed, 4 Nov 2020 06:31:34 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id y12so22262865wrp.6 for ; Wed, 04 Nov 2020 06:31:34 -0800 (PST) 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=aw1qKrJDVTVGc9+faF8YMpoPIqDGI/C6NZGeaxcJruY=; b=QrI9H99CnOXLE9YZ52vL/jd7vSPJ7YbbQ+/GEz94K8jHJym6M/yW6n7dju4xj5lqvL 5hPJigkMUPqI6te9DzILj1mVuLFH+niifOTv0c2T6V0eTSsbPZcuiNSsCl3/ijjcClQu bUR/gdg03fgrzruEuihWf7Wk8TATNkMygT5n3WM59gUq7r1Z2t7apZLRn+WRi61CSFi8 5AjFr42vhN7BZhd53pz0xL5hkjD31ut3FEyPiTAD0EL9NukVbMfUQ0fxqExCPQwen50y iFVw20oY6bErmKuFp2yv1UG6O77jPSu5fgQ4+O73BmrronAtNcS3LCyis5A2LI2s62Zw C89Q== 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=aw1qKrJDVTVGc9+faF8YMpoPIqDGI/C6NZGeaxcJruY=; b=VXe68nvY6WJz1eRw5DV4xA5METCVMCKmQ8HG4+zgEXUu1TbTqRxIZjh2irGZd4RtsF U9oa9v/LuJ15McI8jM9TnmdAdzP1LnhWrN1fDEkSMjlQGeNsfUhMfkem5VH/ap8SKW3r lIiveUQvyjssHyAkPedIgIruBvYvYbnVLg44SCw8g1U1x+eHg05tNwzSfyDTr//byGs0 5iEqe9J/dcMfSwUgAUGUdKZvctq8qHskvdM8Z87FE1icAVKOyABpWVJNmT507DzRaHim lxDamc2t2vYI4HVgWpxj8O7c7KzTW9FTtCyARpiFkXhiiSfPLVBL/0/Ww7oUhL+t1XII GaDA== X-Gm-Message-State: AOAM533QqzOXc5+ctqbczAYyfizRsiIqc3Npa9acwNqAOn5M2GxeVG5R Z+EGVn9tB04W6KCMiu67Pbk= X-Google-Smtp-Source: ABdhPJz307ULmxdDn5V8kkb2G/YjE3mN/nyh2Kax26+h4TOoNX1k539hzKbqFhhOjkZL0yu4Tvw5cQ== X-Received: by 2002:adf:fe48:: with SMTP id m8mr32046522wrs.127.1604500293328; Wed, 04 Nov 2020 06:31:33 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id g17sm2849624wrw.37.2020.11.04.06.31.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:32 -0800 (PST) Subject: [PATCH net-next v2 01/10] net: core: add dev_get_tstats64 as a ndo_get_stats64 implementation From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: <91133597-bd18-20ab-2a98-fd061ff90fed@gmail.com> Date: Wed, 4 Nov 2020 15:24:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It's a frequent pattern to use netdev->stats for the less frequently accessed counters and per-cpu counters for the frequently accessed counters (rx/tx bytes/packets). Add a default ndo_get_stats64() implementation for this use case. Reviewed-by: Florian Fainelli Signed-off-by: Heiner Kallweit --- include/linux/netdevice.h | 1 + net/core/dev.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a53ed2d1e..7ce648a56 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -4527,6 +4527,7 @@ void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, const struct net_device_stats *netdev_stats); void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s, const struct pcpu_sw_netstats __percpu *netstats); +void dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s); extern int netdev_max_backlog; extern int netdev_tstamp_prequeue; diff --git a/net/core/dev.c b/net/core/dev.c index 9e7f071b8..88acc03fa 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10366,6 +10366,21 @@ void dev_fetch_sw_netstats(struct rtnl_link_stats64 *s, } EXPORT_SYMBOL_GPL(dev_fetch_sw_netstats); +/** + * dev_get_tstats64 - ndo_get_stats64 implementation + * @dev: device to get statistics from + * @s: place to store stats + * + * Populate @s from dev->stats and dev->tstats. Can be used as + * ndo_get_stats64() callback. + */ +void dev_get_tstats64(struct net_device *dev, struct rtnl_link_stats64 *s) +{ + netdev_stats_to_stats64(s, &dev->stats); + dev_fetch_sw_netstats(s, dev->tstats); +} +EXPORT_SYMBOL_GPL(dev_get_tstats64); + struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) { struct netdev_queue *queue = dev_ingress_queue(dev); From patchwork Wed Nov 4 14:24:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880785 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 07747C2D0A3 for ; Wed, 4 Nov 2020 14:31:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9984F21527 for ; Wed, 4 Nov 2020 14:31:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HXJtzNm3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729630AbgKDObh (ORCPT ); Wed, 4 Nov 2020 09:31:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726706AbgKDObg (ORCPT ); Wed, 4 Nov 2020 09:31:36 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33146C0613D3 for ; Wed, 4 Nov 2020 06:31:36 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id k18so2504331wmj.5 for ; Wed, 04 Nov 2020 06:31:36 -0800 (PST) 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=6SiUt2m0lyov7szAdtT9DtunKlYj5/LtzG9e5wM0UUk=; b=HXJtzNm3maEgUV7AjpCtg/3m9wFUBj/qdeBM1FhksyqUBXXAFaYv/dHA6ZtiYyVuLw NN4nM1HGCjjju3OnsHLxBjsQB7jcmzGQSgwSTGk3wjbDcRa/jNouyERNfW2dEhUmkOmA YA54Il53zb7yDYUUQgZKyt+3tJZZvU8h0E3NwQwtPt8GIkQf1weEf7oG/dS3xiyTa6jN dJQ+jL/zYD/YLjxquoQZRbkBjdEVA3f11ePY8LqsSPaNFCIjoU0jGiIjKKhZ0qz4qCEk KfwLTUQ6yIQzGrXCrD3fx7UTgUFwSpt64XeOSE3aLHIpkMzvM+CFKUSO59kW+HcT5F0b n4zQ== 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=6SiUt2m0lyov7szAdtT9DtunKlYj5/LtzG9e5wM0UUk=; b=XpuVDF6VV+Zg422fX+890R65rTuuTxTpBievSLtFINiYr0LbrIf24oeHWP0hRohKyU UiaSdm98cYeOoJ+UHgh7+ItN9FTNTQK2/VMURuKW7t9wpHtYAZK3cshIiu+a51tjwPrR Kg1R54OfrEGJwnivTYUBk5nwtsCj0HHFglNcHvRcOSMHXennnO6J6KvVf/4SPm4UOeKv spsb6ak+EPbbgAP6C7UpMHGQx9a6UoyDTWStKgjGuAv8fzP3iOTrkNBjQI9PI4orklb6 cMJ3msd4gmYY+lNdtPpM45MFuXtF7bRJB/2Pv5WwIkGeUM3L/TOiMpHKQIqzGDNADfFp QRKA== X-Gm-Message-State: AOAM532UTKwaE+ri9fpwgFzoTki+Csup9J54K7ay7ICzCoBlMcWbKj3u GpamoCtlH2kvkUxxolJzXa0kL63qqyPQhw== X-Google-Smtp-Source: ABdhPJzsIQUXJ7REVV6XSlEVzNeDfhOLFDiPRW/zne857Ilzz1neAPJ3PVdT8KcbvYdiu/7wz8usYA== X-Received: by 2002:a1c:4b0c:: with SMTP id y12mr5212893wma.91.1604500294880; Wed, 04 Nov 2020 06:31:34 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id 130sm2695433wmd.18.2020.11.04.06.31.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:34 -0800 (PST) Subject: [PATCH net-next v2 02/10] net: dsa: use net core stats64 handling From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: <9c091e28-8585-c082-9587-d73ac5e4680d@gmail.com> Date: Wed, 4 Nov 2020 15:24:46 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use netdev->tstats instead of a member of dsa_slave_priv for storing a pointer to the per-cpu counters. This allows us to use core functionality for statistics handling. Reviewed-by: Florian Fainelli Tested-by: Vladimir Oltean Signed-off-by: Heiner Kallweit --- net/dsa/dsa.c | 7 +------ net/dsa/dsa_priv.h | 2 -- net/dsa/slave.c | 29 +++++++---------------------- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 2131bf2b3..a1b1dc8a4 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -201,7 +201,6 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, { struct dsa_port *cpu_dp = dev->dsa_ptr; struct sk_buff *nskb = NULL; - struct pcpu_sw_netstats *s; struct dsa_slave_priv *p; if (unlikely(!cpu_dp)) { @@ -234,11 +233,7 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, skb = nskb; } - s = this_cpu_ptr(p->stats64); - u64_stats_update_begin(&s->syncp); - s->rx_packets++; - s->rx_bytes += skb->len; - u64_stats_update_end(&s->syncp); + dev_sw_netstats_rx_add(skb->dev, skb->len); if (dsa_skb_defer_rx_timestamp(p, skb)) return 0; diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 12998bf04..7c96aae90 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -78,8 +78,6 @@ struct dsa_slave_priv { struct sk_buff * (*xmit)(struct sk_buff *skb, struct net_device *dev); - struct pcpu_sw_netstats __percpu *stats64; - struct gro_cells gcells; /* DSA port data, such as switch, port index, etc. */ diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 3bc5ca40c..c6a797d75 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -551,14 +551,9 @@ EXPORT_SYMBOL_GPL(dsa_enqueue_skb); static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_slave_priv *p = netdev_priv(dev); - struct pcpu_sw_netstats *s; struct sk_buff *nskb; - s = this_cpu_ptr(p->stats64); - u64_stats_update_begin(&s->syncp); - s->tx_packets++; - s->tx_bytes += skb->len; - u64_stats_update_end(&s->syncp); + dev_sw_netstats_tx_add(dev, 1, skb->len); DSA_SKB_CB(skb)->clone = NULL; @@ -679,7 +674,6 @@ static void dsa_slave_get_ethtool_stats(struct net_device *dev, uint64_t *data) { struct dsa_port *dp = dsa_slave_to_port(dev); - struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_switch *ds = dp->ds; struct pcpu_sw_netstats *s; unsigned int start; @@ -688,7 +682,7 @@ static void dsa_slave_get_ethtool_stats(struct net_device *dev, for_each_possible_cpu(i) { u64 tx_packets, tx_bytes, rx_packets, rx_bytes; - s = per_cpu_ptr(p->stats64, i); + s = per_cpu_ptr(dev->tstats, i); do { start = u64_stats_fetch_begin_irq(&s->syncp); tx_packets = s->tx_packets; @@ -1217,15 +1211,6 @@ static int dsa_slave_setup_tc(struct net_device *dev, enum tc_setup_type type, return ds->ops->port_setup_tc(ds, dp->index, type, type_data); } -static void dsa_slave_get_stats64(struct net_device *dev, - struct rtnl_link_stats64 *stats) -{ - struct dsa_slave_priv *p = netdev_priv(dev); - - netdev_stats_to_stats64(stats, &dev->stats); - dev_fetch_sw_netstats(stats, p->stats64); -} - static int dsa_slave_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *nfc, u32 *rule_locs) { @@ -1601,7 +1586,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = { #endif .ndo_get_phys_port_name = dsa_slave_get_phys_port_name, .ndo_setup_tc = dsa_slave_setup_tc, - .ndo_get_stats64 = dsa_slave_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_port_parent_id = dsa_slave_get_port_parent_id, .ndo_vlan_rx_add_vid = dsa_slave_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid, @@ -1801,8 +1786,8 @@ int dsa_slave_create(struct dsa_port *port) slave_dev->vlan_features = master->vlan_features; p = netdev_priv(slave_dev); - p->stats64 = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); - if (!p->stats64) { + slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); + if (!slave_dev->tstats) { free_netdev(slave_dev); return -ENOMEM; } @@ -1864,7 +1849,7 @@ int dsa_slave_create(struct dsa_port *port) out_gcells: gro_cells_destroy(&p->gcells); out_free: - free_percpu(p->stats64); + free_percpu(slave_dev->tstats); free_netdev(slave_dev); port->slave = NULL; return ret; @@ -1886,7 +1871,7 @@ void dsa_slave_destroy(struct net_device *slave_dev) dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER); phylink_destroy(dp->pl); gro_cells_destroy(&p->gcells); - free_percpu(p->stats64); + free_percpu(slave_dev->tstats); free_netdev(slave_dev); } From patchwork Wed Nov 4 14:25:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880801 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 019BFC2D0A3 for ; Wed, 4 Nov 2020 14:31:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85C5420735 for ; Wed, 4 Nov 2020 14:31:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PUcJQtI+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729980AbgKDObn (ORCPT ); Wed, 4 Nov 2020 09:31:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729718AbgKDObj (ORCPT ); Wed, 4 Nov 2020 09:31:39 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9137C0613D3 for ; Wed, 4 Nov 2020 06:31:37 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id c17so2907376wrc.11 for ; Wed, 04 Nov 2020 06:31:37 -0800 (PST) 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=HsLl/dvlpOEe2HirwRDBJ/wm3sQ0ERvQpQRUSaiMGUI=; b=PUcJQtI+g63BrPtz9nsXypXErI3jBVT5qtO2uO/VNKXy/L/987C89VW4AKs8s2L1af 9nVXoRNzMby6p2D8RxKffQAXps538Gl+YfnB+4SzLsIbj0SHchnEaNoayDMtEwAlc2Zk 89K73XKdPvHhJtS5yfOrcoDDj18E8wFuwDnNs9mSoBjCM7Kj36Bn+YZy8XW86yWPhHO/ v3ycEMWBIvF+9KIapybgQ6/vHLt5WqwnNqCNRWvFMkRTB9JsyeSv5Vhg54TQJram5OQ7 sWO+phTWIX//76UezIzDiZtmjVtiNfTs289DoIjU00kSeZiWLAMd0893KUWvx0TM9xxl ZNdg== 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=HsLl/dvlpOEe2HirwRDBJ/wm3sQ0ERvQpQRUSaiMGUI=; b=tM7mdk4ZJNGMHSp0QNTs139LYWKfxMMXvaiSELoTWOs6vh9yAhrh6phwWLDsrn6CtB Ss+s0dK14s5xwKttdDhOKdViqeXZJknuaxdWMibE3YIGhlQ2zFuTde8j7X4evB9EQyA1 Lcl0JIfeC0jIaoWYwbqunhv9YuFEIOe9eD5/hXWzFbUtVxi3XF1BNoxlCCxqsVymF/0T Fyj5BgBiY2HuXc5oVq/XbmAfje08NrGnOQQKZjN1/BKXb9MZSgDGIGs7eAtB0Oo0EsnC +XBH3MTX9ewNCeHGp+TALVJx+Y3UtLNe4xF6oPW1hVuOlTtYKgzzOTp5/+pjrrE5ONqp PquQ== X-Gm-Message-State: AOAM532Xwez/pQWK2hYcl5uNqLKTMUz+uDi+JAUGaxmtlUeQXy5h24XL Dpt/uDl/cyRgPQyLiIp2TNo= X-Google-Smtp-Source: ABdhPJxNz2pEzbqj0dB6k1+ASbnWgahpKHwas3qn+kaNHiIMOUYJDQcAjQAk+2TG/t068VkCPel2pQ== X-Received: by 2002:adf:ef83:: with SMTP id d3mr32916694wro.393.1604500296647; Wed, 04 Nov 2020 06:31:36 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id o186sm2550808wmb.12.2020.11.04.06.31.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:36 -0800 (PST) Subject: [PATCH net-next v2 03/10] tun: switch to net core provided statistics counters From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: <30fd49be-f467-95f5-9586-fec9fbde8e48@gmail.com> Date: Wed, 4 Nov 2020 15:25:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Switch tun to the standard statistics pattern: - use netdev->stats for the less frequently accessed counters - use netdev->tstats for the frequently accessed per-cpu counters Signed-off-by: Heiner Kallweit --- drivers/net/tun.c | 127 +++++++++++----------------------------------- 1 file changed, 31 insertions(+), 96 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index be69d2720..504bdf501 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -107,17 +107,6 @@ struct tap_filter { #define TUN_FLOW_EXPIRE (3 * HZ) -struct tun_pcpu_stats { - u64_stats_t rx_packets; - u64_stats_t rx_bytes; - u64_stats_t tx_packets; - u64_stats_t tx_bytes; - struct u64_stats_sync syncp; - u32 rx_dropped; - u32 tx_dropped; - u32 rx_frame_errors; -}; - /* A tun_file connects an open character device to a tuntap netdevice. It * also contains all socket related structures (except sock_fprog and tap_filter) * to serve as one transmit queue for tuntap device. The sock_fprog and @@ -207,7 +196,6 @@ struct tun_struct { void *security; u32 flow_count; u32 rx_batched; - struct tun_pcpu_stats __percpu *pcpu_stats; struct bpf_prog __rcu *xdp_prog; struct tun_prog __rcu *steering_prog; struct tun_prog __rcu *filter_prog; @@ -1066,7 +1054,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; drop: - this_cpu_inc(tun->pcpu_stats->tx_dropped); + dev->stats.tx_dropped++; skb_tx_error(skb); kfree_skb(skb); rcu_read_unlock(); @@ -1100,42 +1088,6 @@ static void tun_set_headroom(struct net_device *dev, int new_hr) tun->align = new_hr; } -static void -tun_net_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) -{ - u32 rx_dropped = 0, tx_dropped = 0, rx_frame_errors = 0; - struct tun_struct *tun = netdev_priv(dev); - struct tun_pcpu_stats *p; - int i; - - for_each_possible_cpu(i) { - u64 rxpackets, rxbytes, txpackets, txbytes; - unsigned int start; - - p = per_cpu_ptr(tun->pcpu_stats, i); - do { - start = u64_stats_fetch_begin(&p->syncp); - rxpackets = u64_stats_read(&p->rx_packets); - rxbytes = u64_stats_read(&p->rx_bytes); - txpackets = u64_stats_read(&p->tx_packets); - txbytes = u64_stats_read(&p->tx_bytes); - } while (u64_stats_fetch_retry(&p->syncp, start)); - - stats->rx_packets += rxpackets; - stats->rx_bytes += rxbytes; - stats->tx_packets += txpackets; - stats->tx_bytes += txbytes; - - /* u32 counters */ - rx_dropped += p->rx_dropped; - rx_frame_errors += p->rx_frame_errors; - tx_dropped += p->tx_dropped; - } - stats->rx_dropped = rx_dropped; - stats->rx_frame_errors = rx_frame_errors; - stats->tx_dropped = tx_dropped; -} - static int tun_xdp_set(struct net_device *dev, struct bpf_prog *prog, struct netlink_ext_ack *extack) { @@ -1199,7 +1151,7 @@ static const struct net_device_ops tun_netdev_ops = { .ndo_fix_features = tun_net_fix_features, .ndo_select_queue = tun_select_queue, .ndo_set_rx_headroom = tun_set_headroom, - .ndo_get_stats64 = tun_net_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_change_carrier = tun_net_change_carrier, }; @@ -1247,7 +1199,7 @@ static int tun_xdp_xmit(struct net_device *dev, int n, void *frame = tun_xdp_to_ptr(xdp); if (__ptr_ring_produce(&tfile->tx_ring, frame)) { - this_cpu_inc(tun->pcpu_stats->tx_dropped); + dev->stats.tx_dropped++; xdp_return_frame_rx_napi(xdp); drops++; } @@ -1283,7 +1235,7 @@ static const struct net_device_ops tap_netdev_ops = { .ndo_select_queue = tun_select_queue, .ndo_features_check = passthru_features_check, .ndo_set_rx_headroom = tun_set_headroom, - .ndo_get_stats64 = tun_net_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_bpf = tun_xdp, .ndo_xdp_xmit = tun_xdp_xmit, .ndo_change_carrier = tun_net_change_carrier, @@ -1577,7 +1529,7 @@ static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog, trace_xdp_exception(tun->dev, xdp_prog, act); fallthrough; case XDP_DROP: - this_cpu_inc(tun->pcpu_stats->rx_dropped); + tun->dev->stats.rx_dropped++; break; } @@ -1683,7 +1635,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, size_t total_len = iov_iter_count(from); size_t len = total_len, align = tun->align, linear; struct virtio_net_hdr gso = { 0 }; - struct tun_pcpu_stats *stats; int good_linear; int copylen; bool zerocopy = false; @@ -1752,7 +1703,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, */ skb = tun_build_skb(tun, tfile, from, &gso, len, &skb_xdp); if (IS_ERR(skb)) { - this_cpu_inc(tun->pcpu_stats->rx_dropped); + tun->dev->stats.rx_dropped++; return PTR_ERR(skb); } if (!skb) @@ -1781,7 +1732,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, if (IS_ERR(skb)) { if (PTR_ERR(skb) != -EAGAIN) - this_cpu_inc(tun->pcpu_stats->rx_dropped); + tun->dev->stats.rx_dropped++; if (frags) mutex_unlock(&tfile->napi_mutex); return PTR_ERR(skb); @@ -1795,7 +1746,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, if (err) { err = -EFAULT; drop: - this_cpu_inc(tun->pcpu_stats->rx_dropped); + tun->dev->stats.rx_dropped++; kfree_skb(skb); if (frags) { tfile->napi.skb = NULL; @@ -1807,7 +1758,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, } if (virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun))) { - this_cpu_inc(tun->pcpu_stats->rx_frame_errors); + tun->dev->stats.rx_frame_errors++; kfree_skb(skb); if (frags) { tfile->napi.skb = NULL; @@ -1830,7 +1781,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, pi.proto = htons(ETH_P_IPV6); break; default: - this_cpu_inc(tun->pcpu_stats->rx_dropped); + tun->dev->stats.rx_dropped++; kfree_skb(skb); return -EINVAL; } @@ -1910,7 +1861,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, skb_headlen(skb)); if (unlikely(headlen > skb_headlen(skb))) { - this_cpu_inc(tun->pcpu_stats->rx_dropped); + tun->dev->stats.rx_dropped++; napi_free_frags(&tfile->napi); rcu_read_unlock(); mutex_unlock(&tfile->napi_mutex); @@ -1942,12 +1893,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, } rcu_read_unlock(); - stats = get_cpu_ptr(tun->pcpu_stats); - u64_stats_update_begin(&stats->syncp); - u64_stats_inc(&stats->rx_packets); - u64_stats_add(&stats->rx_bytes, len); - u64_stats_update_end(&stats->syncp); - put_cpu_ptr(stats); + preempt_disable(); + dev_sw_netstats_rx_add(tun->dev, len); + preempt_enable(); if (rxhash) tun_flow_update(tun, rxhash, tfile); @@ -1979,7 +1927,6 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun, { int vnet_hdr_sz = 0; size_t size = xdp_frame->len; - struct tun_pcpu_stats *stats; size_t ret; if (tun->flags & IFF_VNET_HDR) { @@ -1996,12 +1943,9 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun, ret = copy_to_iter(xdp_frame->data, size, iter) + vnet_hdr_sz; - stats = get_cpu_ptr(tun->pcpu_stats); - u64_stats_update_begin(&stats->syncp); - u64_stats_inc(&stats->tx_packets); - u64_stats_add(&stats->tx_bytes, ret); - u64_stats_update_end(&stats->syncp); - put_cpu_ptr(tun->pcpu_stats); + preempt_disable(); + dev_sw_netstats_tx_add(tun->dev, 1, ret); + preempt_enable(); return ret; } @@ -2013,7 +1957,6 @@ static ssize_t tun_put_user(struct tun_struct *tun, struct iov_iter *iter) { struct tun_pi pi = { 0, skb->protocol }; - struct tun_pcpu_stats *stats; ssize_t total; int vlan_offset = 0; int vlan_hlen = 0; @@ -2091,12 +2034,9 @@ static ssize_t tun_put_user(struct tun_struct *tun, done: /* caller is in process context, */ - stats = get_cpu_ptr(tun->pcpu_stats); - u64_stats_update_begin(&stats->syncp); - u64_stats_inc(&stats->tx_packets); - u64_stats_add(&stats->tx_bytes, skb->len + vlan_hlen); - u64_stats_update_end(&stats->syncp); - put_cpu_ptr(tun->pcpu_stats); + preempt_disable(); + dev_sw_netstats_tx_add(tun->dev, 1, skb->len + vlan_hlen); + preempt_enable(); return total; } @@ -2235,11 +2175,11 @@ static void tun_free_netdev(struct net_device *dev) BUG_ON(!(list_empty(&tun->disabled))); - free_percpu(tun->pcpu_stats); - /* We clear pcpu_stats so that tun_set_iff() can tell if + free_percpu(dev->tstats); + /* We clear tstats so that tun_set_iff() can tell if * tun_free_netdev() has been called from register_netdevice(). */ - tun->pcpu_stats = NULL; + dev->tstats = NULL; tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); @@ -2370,7 +2310,6 @@ static int tun_xdp_one(struct tun_struct *tun, unsigned int datasize = xdp->data_end - xdp->data; struct tun_xdp_hdr *hdr = xdp->data_hard_start; struct virtio_net_hdr *gso = &hdr->gso; - struct tun_pcpu_stats *stats; struct bpf_prog *xdp_prog; struct sk_buff *skb = NULL; u32 rxhash = 0, act; @@ -2428,7 +2367,7 @@ static int tun_xdp_one(struct tun_struct *tun, skb_put(skb, xdp->data_end - xdp->data); if (virtio_net_hdr_to_skb(skb, gso, tun_is_little_endian(tun))) { - this_cpu_inc(tun->pcpu_stats->rx_frame_errors); + tun->dev->stats.rx_frame_errors++; kfree_skb(skb); err = -EINVAL; goto out; @@ -2451,14 +2390,10 @@ static int tun_xdp_one(struct tun_struct *tun, netif_receive_skb(skb); - /* No need for get_cpu_ptr() here since this function is + /* No need to disable preemption here since this function is * always called with bh disabled */ - stats = this_cpu_ptr(tun->pcpu_stats); - u64_stats_update_begin(&stats->syncp); - u64_stats_inc(&stats->rx_packets); - u64_stats_add(&stats->rx_bytes, datasize); - u64_stats_update_end(&stats->syncp); + dev_sw_netstats_rx_add(tun->dev, datasize); if (rxhash) tun_flow_update(tun, rxhash, tfile); @@ -2751,8 +2686,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) tun->rx_batched = 0; RCU_INIT_POINTER(tun->steering_prog, NULL); - tun->pcpu_stats = netdev_alloc_pcpu_stats(struct tun_pcpu_stats); - if (!tun->pcpu_stats) { + dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); + if (!dev->tstats) { err = -ENOMEM; goto err_free_dev; } @@ -2807,16 +2742,16 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) tun_detach_all(dev); /* We are here because register_netdevice() has failed. * If register_netdevice() already called tun_free_netdev() - * while dealing with the error, tun->pcpu_stats has been cleared. + * while dealing with the error, dev->stats has been cleared. */ - if (!tun->pcpu_stats) + if (!dev->tstats) goto err_free_dev; err_free_flow: tun_flow_uninit(tun); security_tun_dev_free_security(tun->security); err_free_stat: - free_percpu(tun->pcpu_stats); + free_percpu(dev->tstats); err_free_dev: free_netdev(dev); return err; From patchwork Wed Nov 4 14:26:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880789 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 4E509C2D0A3 for ; Wed, 4 Nov 2020 14:31:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEFDB2074B for ; Wed, 4 Nov 2020 14:31:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oqc3LELb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729944AbgKDObl (ORCPT ); Wed, 4 Nov 2020 09:31:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729484AbgKDObj (ORCPT ); Wed, 4 Nov 2020 09:31:39 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47268C061A4C for ; Wed, 4 Nov 2020 06:31:39 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id w14so22235969wrs.9 for ; Wed, 04 Nov 2020 06:31:39 -0800 (PST) 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=qEB7Z1RjR0G+DQiP2hCHYNQbM1LDy8ydPvZ+5mT8PJY=; b=oqc3LELbOHqVlrEwxcr95Uzj3oPBsqK0Nak4vw7gcR4/dVI6RUxZUXW6f5i47wIvsS 8ArQM6PlzCm2AppC7MMF2DLcku+T4teyS7eGqkcwZS406IFUqnbcqvzlF2TZRgBLx06p 3HYc641WliszKdF0S62P1MqROLAJa3FB6pmc6Z6egnxCdFZoQ+gEJmkj+mF+t8YmRvhZ UfkATTDdmC+MNlVBNBD4awnkkoO726ky7JLrG5VJhFN0yhTTj5usRcgam6icQsKrKG64 ccw7SUtnjKE4WdBzCfxZAMK/j19148XNTbs/Vf3zjp3xxQlNuTeEQyxxag5Y+szOsP9a oByg== 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=qEB7Z1RjR0G+DQiP2hCHYNQbM1LDy8ydPvZ+5mT8PJY=; b=Zimwx9zHHQO+YxQjWByJEEeOiuro5Z+9rm9vBsJyc5dRZBEnYQGgDyD2+/5eRPCt20 12JefloQ0d2QU/gtFk4XLlGr5+iQkOf1JYr6bTKvUHT6m6KmHiNvs6XNhfqj8a3W79gi I0dzuKGZUXUcN/sQfoT75GrpdQyMWFtN18Q5qsWEQu8iOZRzV47cuuPxGJcEKHCAicid mfZPnn+bIBHnlW7KOaszcNza4JCZxhgEyMkTO9e+dnZ53wp/1OO4yD+toBEy+BymTQrV idKgLpJjGOPmsKgMqwWKT3YzvTHYpoA/wV8HuqvBQwiInBTJ6gI3LMXzdo/lXKyYdor5 ArKw== X-Gm-Message-State: AOAM533c1bciy444GJAPOHaNVDZQq1TUVG9seC5MWsNM882/frUKvqNU A+X7wgTmuwsTfovKlZWSCPo= X-Google-Smtp-Source: ABdhPJzroOAM2nk7AMGE88U8txABdnW1WShg9Kwj96gyky21jL4XWyUtijC9VSYFoEfWdADhvSeNQw== X-Received: by 2002:a5d:5612:: with SMTP id l18mr34275754wrv.372.1604500298030; Wed, 04 Nov 2020 06:31:38 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id a185sm2595233wmf.24.2020.11.04.06.31.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:37 -0800 (PST) Subject: [PATCH net-next v2 04/10] ip6_tunnel: switch to dev_get_tstats64 From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: <4dc3d9f1-bf5e-1f56-9810-7af29988a5f1@gmail.com> Date: Wed, 4 Nov 2020 15:26:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Switch ip6_tunnel to the standard statistics pattern: - use dev->stats for the less frequently accessed counters - use dev->tstats for the frequently accessed counters An additional benefit is that we now have 64bit statistics also on 32bit systems. Signed-off-by: Heiner Kallweit --- net/ipv6/ip6_tunnel.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 648db3fe5..321d057c5 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -94,36 +94,6 @@ static inline int ip6_tnl_mpls_supported(void) return IS_ENABLED(CONFIG_MPLS); } -static struct net_device_stats *ip6_get_stats(struct net_device *dev) -{ - struct pcpu_sw_netstats tmp, sum = { 0 }; - int i; - - for_each_possible_cpu(i) { - unsigned int start; - const struct pcpu_sw_netstats *tstats = - per_cpu_ptr(dev->tstats, i); - - do { - start = u64_stats_fetch_begin_irq(&tstats->syncp); - tmp.rx_packets = tstats->rx_packets; - tmp.rx_bytes = tstats->rx_bytes; - tmp.tx_packets = tstats->tx_packets; - tmp.tx_bytes = tstats->tx_bytes; - } while (u64_stats_fetch_retry_irq(&tstats->syncp, start)); - - sum.rx_packets += tmp.rx_packets; - sum.rx_bytes += tmp.rx_bytes; - sum.tx_packets += tmp.tx_packets; - sum.tx_bytes += tmp.tx_bytes; - } - dev->stats.rx_packets = sum.rx_packets; - dev->stats.rx_bytes = sum.rx_bytes; - dev->stats.tx_packets = sum.tx_packets; - dev->stats.tx_bytes = sum.tx_bytes; - return &dev->stats; -} - #define for_each_ip6_tunnel_rcu(start) \ for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) @@ -1835,7 +1805,7 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { .ndo_start_xmit = ip6_tnl_start_xmit, .ndo_do_ioctl = ip6_tnl_ioctl, .ndo_change_mtu = ip6_tnl_change_mtu, - .ndo_get_stats = ip6_get_stats, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip6_tnl_get_iflink, }; From patchwork Wed Nov 4 14:27:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880797 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 33E8CC388F9 for ; Wed, 4 Nov 2020 14:31:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7DA62074B for ; Wed, 4 Nov 2020 14:31:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dDvTxo3+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730008AbgKDObo (ORCPT ); Wed, 4 Nov 2020 09:31:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729946AbgKDObl (ORCPT ); Wed, 4 Nov 2020 09:31:41 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFC9AC0613D3 for ; Wed, 4 Nov 2020 06:31:40 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id p22so2553894wmg.3 for ; Wed, 04 Nov 2020 06:31:40 -0800 (PST) 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=BnTgwBVz1ZO0k7LKVJSAZVBIqGzXjGz0VSRBSuIyloc=; b=dDvTxo3+AsEj/68Cdlgde2+BjLBZtLbTGzssWfAMt7CVcHxDGfCSYr2m2FXQ6zaHTJ Ue3bzwa8izCGvHqwNbZpDhBhhQ5w4+ENVUurLKAup8fKMuRCMqH2unqBZQ6774R7au3c 93AbS4hpboSpLVGPdiQJhi82QknvuotS2nohKFWGZ83ZB5owLORKtYSxLY7EbbOiclTH uF2jzRf6GLVyINzmhmHTjt831zyw00Djd6H5sMh76hpc0Vm+yXLkDOiF27nS9hixOPBb PSTbMImmgf07tW49LLP0SWTqtr+PZOUvA4XO5MKGeTvihcOP4VUNKJj5g5uoKH6jPA81 NUYw== 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=BnTgwBVz1ZO0k7LKVJSAZVBIqGzXjGz0VSRBSuIyloc=; b=k29wB3bXFCBPYclnlbVeW77U9mBz7aYt/CpPEaiHvoMNyNR+1xlH6jNaXNCSyoHfDp sbkImwbIOaNy7sVlKTfGexeNzfDgHkw4Pxr8asMhWzSa0cbO6jidUZE6mY0PSSsp/T2t uBs5KxEZ/wWQZKhHkiPiOv/FRd0aHLOEaR/YILPrl+Jr+Ye7Aj/8tVWqrAaKhdCgaM+v MTeF2k9Go+WXgjZTpeMMOdNXML5nWKQwIgfr0PkPAdmd7jpfwFvhDdiw7lcNHjqkTjAF ZNcgULhZEabn0LSF4l0nHnoZULETNnQHtCEmVLB4nkgsesd8/Rq1EA8yFzrgo9w81zgH Wdyw== X-Gm-Message-State: AOAM532FAMjX9MSP8BmDrX8hurSocUDA55yr/sdXMApbi62B1P8i/MCa NkLecfWPRPxyTqBkg40210o= X-Google-Smtp-Source: ABdhPJzPGzBMF8LcdUpb79YVk6qku4r3FsMQ57O6u0bisOkeVnWRROLBrmu7Qwyz8Odq+Ndv/P4vMw== X-Received: by 2002:a7b:c00b:: with SMTP id c11mr3544932wmb.175.1604500299569; Wed, 04 Nov 2020 06:31:39 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id t1sm2932329wrs.48.2020.11.04.06.31.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:39 -0800 (PST) Subject: [PATCH net-next v2 05/10] net: switch to dev_get_tstats64 From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: Date: Wed, 4 Nov 2020 15:27:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Replace ip_tunnel_get_stats64() with the new identical core fucntion dev_get_tstats64(). Signed-off-by: Heiner Kallweit --- drivers/net/bareudp.c | 2 +- drivers/net/geneve.c | 2 +- drivers/net/vxlan.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index ff0bea155..28257bcce 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -510,7 +510,7 @@ static const struct net_device_ops bareudp_netdev_ops = { .ndo_open = bareudp_open, .ndo_stop = bareudp_stop, .ndo_start_xmit = bareudp_xmit, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_fill_metadata_dst = bareudp_fill_metadata_dst, }; diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index d07008a81..a3c8ce6de 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -1138,7 +1138,7 @@ static const struct net_device_ops geneve_netdev_ops = { .ndo_open = geneve_open, .ndo_stop = geneve_stop, .ndo_start_xmit = geneve_xmit, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_change_mtu = geneve_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr, diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1a557aeba..cb9930595 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3210,7 +3210,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = { .ndo_open = vxlan_open, .ndo_stop = vxlan_stop, .ndo_start_xmit = vxlan_xmit, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_set_rx_mode = vxlan_set_multicast_list, .ndo_change_mtu = vxlan_change_mtu, .ndo_validate_addr = eth_validate_addr, @@ -3229,7 +3229,7 @@ static const struct net_device_ops vxlan_netdev_raw_ops = { .ndo_open = vxlan_open, .ndo_stop = vxlan_stop, .ndo_start_xmit = vxlan_xmit, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_change_mtu = vxlan_change_mtu, .ndo_fill_metadata_dst = vxlan_fill_metadata_dst, }; From patchwork Wed Nov 4 14:27:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880791 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 E359EC4741F for ; Wed, 4 Nov 2020 14:31:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E1B62074B for ; Wed, 4 Nov 2020 14:31:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gydV31gZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730029AbgKDObr (ORCPT ); Wed, 4 Nov 2020 09:31:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729972AbgKDObm (ORCPT ); Wed, 4 Nov 2020 09:31:42 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C8CC0613D3 for ; Wed, 4 Nov 2020 06:31:42 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id x7so22293125wrl.3 for ; Wed, 04 Nov 2020 06:31:42 -0800 (PST) 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=xp6oy8hFijEmY9NkC9fHkoFa4aR3nW13I4ZttL2CY1s=; b=gydV31gZS7M+j5E46kP9AIaz8+BM5M32QpZbH/YNlCKoV/ZpmW6d81ZlDl2VCcdXas tKYGkBIlQGA4J/CbWlOD8h++H0zwu4ZMdKjneqQBTk6hR54YzL6GFu2A2dc4UAKXFEIU BAW+1cFOjFLDoecjZWP9OJcXLKm3C07PCk8C6MmUXxJE+c8pytKWDMQ1VuYizJNkaiKS DxOaZ4BIo72zZ0QtJ+JPj5v5eu8sRpTOynCk2lo5W0guQPj9DoTFQom2CXoQBP74e2w6 4c3ALEpoidWzuDh9nyOiIDPnpPTeDpp+rxcN9yTFS8ajTAUcfCVRP/P5YKsoIWfD2nRS ZX8A== 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=xp6oy8hFijEmY9NkC9fHkoFa4aR3nW13I4ZttL2CY1s=; b=AKwD0QbrRpFj6TnTCiSGiFNrJTr0t/PuSTRngdi4YWmyozln5UMh4kCtA7Er1oX0ME l2iezvn893shLCBNKZkAhIdvS/3eTpBmhVtHyCgfDcd7snB69l0K/qWcx/A3LAMjqapX SgnIxJvvflRi1gIOPSNriyFP1RIQ5Rsk5oxNEr49EsyXDTpKTg4vBVRGBBlKHsDIQ5Sq gCv6mXEpbVZ6jiOV6MynQlGfBf+WCi6e+069gJWxkZGsQ2kvSDKLsUWzR23sD0weAM49 xYdmjaLFXcnc2Bz/8ku58iTRjMqf+K72ZDTfJ07lJMvQf/zkeLdOfb2lz1BxcjqgLwfH ff0g== X-Gm-Message-State: AOAM532fr3oJ0vreD44gNSv1fO89b7k7+2+YE1f/K4g/cTBdbnm07iZt sux2b7YQbcyjbHWwzZJjcAM= X-Google-Smtp-Source: ABdhPJyvvhuRWzQmFq7CIZ0Iq/4dBo0VuuTGRZ7iy05CIxTO7DdreWemTSw/gAg+68JIxl2poVPGKA== X-Received: by 2002:adf:dec1:: with SMTP id i1mr30822590wrn.50.1604500301068; Wed, 04 Nov 2020 06:31:41 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id t12sm2976964wrm.25.2020.11.04.06.31.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:40 -0800 (PST) Subject: [PATCH net-next v2 06/10] gtp: switch to dev_get_tstats64 From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: <52d228fe-9ed3-7cd0-eebc-051c38b5e45f@gmail.com> Date: Wed, 4 Nov 2020 15:27:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Replace ip_tunnel_get_stats64() with the new identical core fucntion dev_get_tstats64(). Signed-off-by: Heiner Kallweit Acked-by: Harald Welte --- drivers/net/gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index dc668ed28..4c04e271f 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -607,7 +607,7 @@ static const struct net_device_ops gtp_netdev_ops = { .ndo_init = gtp_dev_init, .ndo_uninit = gtp_dev_uninit, .ndo_start_xmit = gtp_dev_xmit, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, }; static void gtp_link_setup(struct net_device *dev) From patchwork Wed Nov 4 14:28:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880803 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 0C094C2D0A3 for ; Wed, 4 Nov 2020 14:32:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC14A20735 for ; Wed, 4 Nov 2020 14:32:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eE8ak1TB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730127AbgKDOcE (ORCPT ); Wed, 4 Nov 2020 09:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729990AbgKDObo (ORCPT ); Wed, 4 Nov 2020 09:31:44 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA85CC0613D3 for ; Wed, 4 Nov 2020 06:31:43 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id b8so22292659wrn.0 for ; Wed, 04 Nov 2020 06:31:43 -0800 (PST) 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=ISdFe78IibjR0mRAQ86gBh/OHzTQrxaMboYtkFYsqpE=; b=eE8ak1TBDVXreX9muVNGINPPTvKoQUGUD0knZOHr+4cKU7tAK22S3ATaMp2kFxsxRy iiMxKWeDrIIOa6dXxEZmheaPMa7hXUAh4/BjqpaQDfLRVHSgPI+YYSvcYhpHfTHoLA5P wg2kho8HjLlH0ER5waUhPXWL7UvsSE/j6+h1ICFXEvcwE6nHlhA71k0EPzEyI4BEh8fE D9/Dw9aV15WdZbgs+6dF6oHQjVZPrvMdmqR3hbfxTeupHkARuPGWI/STHjm52TLbn2A3 A3o4CVot3uA6ift59ypoE8kihX6cQlGv+OlXIPXLyF1MrYHykPZPGay7CfdBE1+FMAZc IRyw== 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=ISdFe78IibjR0mRAQ86gBh/OHzTQrxaMboYtkFYsqpE=; b=Jkc9axOGA1sf3rrP86ceB2bd9ilGZHdnJ3zX6/PqSGVeSOa30PBheGKWAHaE4tiFc5 YJ/JFBKg5ln94+MgYDoHg42842VlkpDENoTKAZiRJLQqVz1GLR3r6NOC98z2MXpbvF/d 6qQB9HsYzUasLyWT9oHSToW4w7ijdnWE2WM6z2iO9vqaAF1GBfE7tPfL4wSfyfq2d/NV gWBAFsPAmQ0+CmdY5wOd7ZnjPETZHNscqwcfyWmXURen6YpoYzl6J+B5khJ1rJZlRWm/ uqJ/FQnFPs6uVSPi9FRkVkFi9gYIwl+CLwfRO3ynwmOnvvZU4BdNnROFIZXC0pjrimR9 bFzA== X-Gm-Message-State: AOAM532K0pZOGIQIuk6DIU5FmTfR0Ou879UzjziCXSwxTMHPp6va97bI pdwKe9sjkDW2zD6Fi9++Y44= X-Google-Smtp-Source: ABdhPJyTmgp2E3e/UB8WuI4mAejZD7B4seUjChiV1gJQIko6Xt6GU+2OLu3kC+3iK9h4fWeGCnAcTA== X-Received: by 2002:adf:fa8a:: with SMTP id h10mr32097178wrr.336.1604500302448; Wed, 04 Nov 2020 06:31:42 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id f17sm2938117wrm.27.2020.11.04.06.31.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:42 -0800 (PST) Subject: [PATCH net-next v2 07/10] wireguard: switch to dev_get_tstats64 From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: <4f731535-2a51-a673-5daf-d9ec2536a8f8@gmail.com> Date: Wed, 4 Nov 2020 15:28:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Replace ip_tunnel_get_stats64() with the new identical core fucntion dev_get_tstats64(). Signed-off-by: Heiner Kallweit Reviewed-by: Jason A. Donenfeld --- drivers/net/wireguard/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c index c9f65e96c..a3ed49cd9 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -215,7 +215,7 @@ static const struct net_device_ops netdev_ops = { .ndo_open = wg_open, .ndo_stop = wg_stop, .ndo_start_xmit = wg_xmit, - .ndo_get_stats64 = ip_tunnel_get_stats64 + .ndo_get_stats64 = dev_get_tstats64 }; static void wg_destruct(struct net_device *dev) From patchwork Wed Nov 4 14:28:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880799 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 6E65DC2D0A3 for ; Wed, 4 Nov 2020 14:31:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FB372074B for ; Wed, 4 Nov 2020 14:31:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sfcMSso4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730113AbgKDObz (ORCPT ); Wed, 4 Nov 2020 09:31:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729972AbgKDObu (ORCPT ); Wed, 4 Nov 2020 09:31:50 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA98DC040203 for ; Wed, 4 Nov 2020 06:31:45 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id k18so2504919wmj.5 for ; Wed, 04 Nov 2020 06:31:45 -0800 (PST) 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=4rfiet18ZS0o4KG/dtF63+kbk0+HAV5dp9bIiGOx7/A=; b=sfcMSso4ZIjtzw+Jqb8eHi5oFWOCYuHZedzoLVlBFMW/sxgG00Nc+1+kdXJtQ1wFeK 5AZmIvNBcO6P68XQ9UvidKMYuZImUVIQTLZHHMsyaYUVJ1yikHF5Hd9x9yPrTZfffgTm XqLF3s03M6QC1cRYtX716btEvouYkcwrKZZhzTYAYNARPONfVdTiIirM0Gvcj0sdjOXF tQQ8Qr7Q/ktvp0DJY50hyPUyPFfa8Esgm9ZqFiVD7j1P69NgsJ7+xlsow/SiOhFmlzkM daPqYy5+nrlehTHr520j0YUbEll5KpaLxnjHNCV3AsoYlHpiNv/cHIaLVSmiunqQwDvY 5C7Q== 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=4rfiet18ZS0o4KG/dtF63+kbk0+HAV5dp9bIiGOx7/A=; b=skx73XPLyumBCD8Q38IQLjknOCnEtNBL8WzeLHu/ATM/TzO3auMgwDIanVVusO0jJ0 YisSuq+Yswd8JirxkISNn7hL5Io7Z5F6kO0OkqOORsoxul/bDylUkZV5iiroyQaOF0VK bUWI9pWpl0yuXRQsNkGE5NyjxPz4N5UmYWz0blNTNtnFIyhq/M0FzsZtQjwWJ3Qw0J8q mnhW1PS3ZxChiewB7uMQoIwdSV67fQtwQbYGuil4rz/YaUUCorkChHPTRM0xR3BLNgO+ PLvoIGcFUEHvwQ4LumfcX8nfT/0Ukx5COGvW1pMFiVPoA4m7dvwJITdnOY+qcIy+0gql hSNg== X-Gm-Message-State: AOAM533hU+qx2cLfcaYcmj5dICI4DEvseNN27khzeywCpdtvcVyHQxsY Jk86Kc0sfU+jZrdTvp+t9xc= X-Google-Smtp-Source: ABdhPJxI7VpXKJmZPAAzWLeHi6wM4l7xKzxiHLBrCNzzFeW86JBey7HQ+giLzYO7y6Ko67W2NU36yQ== X-Received: by 2002:a1c:b387:: with SMTP id c129mr5161673wmf.66.1604500304441; Wed, 04 Nov 2020 06:31:44 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id 205sm2493118wme.38.2020.11.04.06.31.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:44 -0800 (PST) Subject: [PATCH net-next v2 08/10] vti: switch to dev_get_tstats64 From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: Date: Wed, 4 Nov 2020 15:28:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Replace ip_tunnel_get_stats64() with the new identical core fucntion dev_get_tstats64(). Signed-off-by: Heiner Kallweit --- net/ipv4/ip_vti.c | 2 +- net/ipv6/ip6_vti.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index b957cbee2..abc171e79 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c @@ -404,7 +404,7 @@ static const struct net_device_ops vti_netdev_ops = { .ndo_start_xmit = vti_tunnel_xmit, .ndo_do_ioctl = ip_tunnel_ioctl, .ndo_change_mtu = ip_tunnel_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip_tunnel_get_iflink, .ndo_tunnel_ctl = vti_tunnel_ctl, }; diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 5f9c4fdc1..b7b2bb27d 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -889,7 +889,7 @@ static const struct net_device_ops vti6_netdev_ops = { .ndo_uninit = vti6_dev_uninit, .ndo_start_xmit = vti6_tnl_xmit, .ndo_do_ioctl = vti6_ioctl, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip6_tnl_get_iflink, }; From patchwork Wed Nov 4 14:29:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880793 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 343CFC2D0A3 for ; Wed, 4 Nov 2020 14:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4B0120735 for ; Wed, 4 Nov 2020 14:32:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UBktEN5F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730107AbgKDObx (ORCPT ); Wed, 4 Nov 2020 09:31:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730030AbgKDObu (ORCPT ); Wed, 4 Nov 2020 09:31:50 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F788C0401C1 for ; Wed, 4 Nov 2020 06:31:47 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id c9so2538933wml.5 for ; Wed, 04 Nov 2020 06:31:47 -0800 (PST) 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=vff6yNcLVki99HBXZKVURhKPJZnmPneHA9KBTYAFVzs=; b=UBktEN5FFWzGcN/0dr4YKDfe1DmzUGMSWC0WJ2kbIDqpZCZWf/DZ5Ndq5EZ7Pl2F41 B3UQT6eKdT1KQgUAoglAHvIqc2o9oZqfTN9B5GURjMhOw1d4GQ0j4j8wkw8RN7KIGOGD 3DX8t5fgwcEb6E3+KlwaEZ2BaaO1M3mncFslT6rqlfqIR1+WMNW3PGrFfI1/0gC0ZqTP sMXKywSZW4x+Cay10MDEEKQGahsJRWowTvL0187JqA98jHyT6Z7wzW1hJ70eWuXwQ9Vw 8OjaD5nFLQ6GYKbsfNRDYHT3y5zT+/TtXyFi6JSMmiBFnkjUsIxxjcYnWV4MP+U4u8i7 lNTw== 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=vff6yNcLVki99HBXZKVURhKPJZnmPneHA9KBTYAFVzs=; b=kGFLwmkrexKMhlLJXjouky41pWIWS0cMENRdVNP2R6VQpx81Tt8YxkduqnoGKBmq2v TnfFzsi6Dst9eOQaxa0azEW0o6Dqk/GgUzdaHF0uVWcOTWyykJeEHlVfR5pAXjBL+LjL Ho2WUFzQ1gYO6HV1MYK0ck4EjZ4cIB5vZL0bUV9OvS7nqVnYcYyEckdlKHRMIWbLCjrl N3RVG3VvhwV/NKzQDAb/09Ir6LKs24DcKYHC24oJStczX0/LU8ptnGd6lbQL0t6LbdOq mYtIDSo4VeRtRATzKtrzSI7KPQNqdgQYt8kH3S8FZq205jTG6pWkzSY+AweDe+St47CZ U1ew== X-Gm-Message-State: AOAM531pYKbMPubhC7AXxRv6s3bQQNCdPtbxxlEiEW2VEXy1mkwfdb2q uO5/m3eJvVUYQVbs2iefuK8= X-Google-Smtp-Source: ABdhPJyuPb/O1vtK4Zhv26voXtkXkk4NNvFF1xRJ61h9iW1ULwMrqeM1nC5CNCuUIvPWej8nSAUxBg== X-Received: by 2002:a05:600c:2110:: with SMTP id u16mr4940556wml.4.1604500305924; Wed, 04 Nov 2020 06:31:45 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id g17sm2850560wrw.37.2020.11.04.06.31.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:45 -0800 (PST) Subject: [PATCH net-next v2 09/10] ipv4/ipv6: switch to dev_get_tstats64 From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: Date: Wed, 4 Nov 2020 15:29:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Replace ip_tunnel_get_stats64() with the new identical core fucntion dev_get_tstats64(). Signed-off-by: Heiner Kallweit --- net/ipv4/ip_gre.c | 6 +++--- net/ipv4/ipip.c | 2 +- net/ipv6/ip6_gre.c | 6 +++--- net/ipv6/sit.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index e70291748..a68bf4c6f 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -920,7 +920,7 @@ static const struct net_device_ops ipgre_netdev_ops = { .ndo_start_xmit = ipgre_xmit, .ndo_do_ioctl = ip_tunnel_ioctl, .ndo_change_mtu = ip_tunnel_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip_tunnel_get_iflink, .ndo_tunnel_ctl = ipgre_tunnel_ctl, }; @@ -1275,7 +1275,7 @@ static const struct net_device_ops gre_tap_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, .ndo_change_mtu = ip_tunnel_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip_tunnel_get_iflink, .ndo_fill_metadata_dst = gre_fill_metadata_dst, }; @@ -1308,7 +1308,7 @@ static const struct net_device_ops erspan_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, .ndo_change_mtu = ip_tunnel_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip_tunnel_get_iflink, .ndo_fill_metadata_dst = gre_fill_metadata_dst, }; diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 75d35e76b..d5bfa087c 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -347,7 +347,7 @@ static const struct net_device_ops ipip_netdev_ops = { .ndo_start_xmit = ipip_tunnel_xmit, .ndo_do_ioctl = ip_tunnel_ioctl, .ndo_change_mtu = ip_tunnel_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip_tunnel_get_iflink, .ndo_tunnel_ctl = ipip_tunnel_ctl, }; diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 931b186d2..8cf659994 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1391,7 +1391,7 @@ static const struct net_device_ops ip6gre_netdev_ops = { .ndo_start_xmit = ip6gre_tunnel_xmit, .ndo_do_ioctl = ip6gre_tunnel_ioctl, .ndo_change_mtu = ip6_tnl_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip6_tnl_get_iflink, }; @@ -1828,7 +1828,7 @@ static const struct net_device_ops ip6gre_tap_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, .ndo_change_mtu = ip6_tnl_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip6_tnl_get_iflink, }; @@ -1896,7 +1896,7 @@ static const struct net_device_ops ip6erspan_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, .ndo_change_mtu = ip6_tnl_change_mtu, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip6_tnl_get_iflink, }; diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 5e2c34c0a..4dc5f9366 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1396,7 +1396,7 @@ static const struct net_device_ops ipip6_netdev_ops = { .ndo_uninit = ipip6_tunnel_uninit, .ndo_start_xmit = sit_tunnel_xmit, .ndo_do_ioctl = ipip6_tunnel_ioctl, - .ndo_get_stats64 = ip_tunnel_get_stats64, + .ndo_get_stats64 = dev_get_tstats64, .ndo_get_iflink = ip_tunnel_get_iflink, .ndo_tunnel_ctl = ipip6_tunnel_ctl, }; From patchwork Wed Nov 4 14:31:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 11880795 X-Patchwork-Delegate: kuba@kernel.org 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 AE474C388F9 for ; Wed, 4 Nov 2020 14:31:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53A9420739 for ; Wed, 4 Nov 2020 14:31:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Gfkh6YfC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730129AbgKDOb4 (ORCPT ); Wed, 4 Nov 2020 09:31:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730042AbgKDObu (ORCPT ); Wed, 4 Nov 2020 09:31:50 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8D7FC0401C2 for ; Wed, 4 Nov 2020 06:31:48 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id x7so22293551wrl.3 for ; Wed, 04 Nov 2020 06:31:48 -0800 (PST) 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=K0xwbWgfzNb+siGOnTIoHV8a22y8LDX4Jm2bW67sNRs=; b=Gfkh6YfCE72+ydlSJ/wl7fWmXAUOkTbF24ca29DtpQjcRnzH2tuzCLv3xTT37WI3E1 ADY32e7KnYdz09JC2n7Ffr6URAzF0HDjz3MxA71JqOiTjEJKepuLYN7K9nZmvk90RRF5 bZvEQXcMAZxU5w4Fq/D2ZYzLxto9L/ffmiYoUHwmxRx3xQJCsnyQm0R1J82N+6Qv96lg 4L6uz/yaCUq28ORAzFXzKYqwYUAI4KFP3Xe+fN5bYN+SO0YZxbxQqMmXL0vXA4KoP5PA iu5k47/kJGsNgbsFX6Pl/x+Ll9JjfG9MKhHtPAPufCLMKlT9HNlOfqHZVL1eALx65NZ8 TmZA== 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=K0xwbWgfzNb+siGOnTIoHV8a22y8LDX4Jm2bW67sNRs=; b=g7EaILlz+8jisPTcNCgOAfZwlaMRvxTOcTuw/rRD3bJvOmE/pBV4t6XtBHW38HpN0n x175Eq/Ugp0H4RT+Fwzh7Cn6d/EESq4uCss3d1ejJCvJ9xd1K/G+XE3VfYdr2/PwgkPc unxtFg95giqF0xdC4mCPAiYsU5J8xSmt5a0ZzWSDPpsEEu7sto0SzmQuVGTQPlUXE49P 8xI9ZvVhMlK2XBv67R2JiVd4lR8KcC0NOwXPfh/6Ropi0ymTdXiVna8M/8lzVynEisPG TZo6fJA9hVwZlQUq1thUToxrdsuW42cnxZPpDWY8zPAfvnx3FUwWwDLtVlMIPX4hhOBM m9tA== X-Gm-Message-State: AOAM532QezPt7bV2pYe8Iosbozn+3a4YO0st1/FRNyWpNeR7JqMQHjgq rB8OL/xWBk6TYDulAq0Kv00= X-Google-Smtp-Source: ABdhPJwl5X8jvdS+mUXZcO0Nb3rEd3NCzr93XMi5XApyMil2tE6bG73j3OHe5qt6fBIyVpvdh0u7gw== X-Received: by 2002:a5d:474f:: with SMTP id o15mr5595878wrs.100.1604500307652; Wed, 04 Nov 2020 06:31:47 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:d177:63da:d01d:cf70? (p200300ea8f232800d17763dad01dcf70.dip0.t-ipconnect.de. [2003:ea:8f23:2800:d177:63da:d01d:cf70]) by smtp.googlemail.com with ESMTPSA id k84sm2508318wmf.42.2020.11.04.06.31.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:31:47 -0800 (PST) Subject: [PATCH net-next v2 10/10] net: remove ip_tunnel_get_stats64 From: Heiner Kallweit To: Jakub Kicinski , David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , Pablo Neira Ayuso , Harald Welte , "Jason A. Donenfeld" , Herbert Xu Cc: "netdev@vger.kernel.org" , osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com, Steffen Klassert References: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Message-ID: <1d40c040-7b4b-9531-2cb0-0e8e3f954e25@gmail.com> Date: Wed, 4 Nov 2020 15:31:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <059fcb95-fba8-673e-0cd6-fb26e8ed4861@gmail.com> Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org After having migrated all users remove ip_tunnel_get_stats64(). Signed-off-by: Heiner Kallweit --- include/net/ip_tunnels.h | 2 -- net/ipv4/ip_tunnel_core.c | 9 --------- 2 files changed, 11 deletions(-) diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 02ccd3254..1b7905eb7 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h @@ -274,8 +274,6 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict); int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); -void ip_tunnel_get_stats64(struct net_device *dev, - struct rtnl_link_stats64 *tot); struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, int link, __be16 flags, __be32 remote, __be32 local, diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 25f1caf5a..923a9fa2e 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -429,15 +429,6 @@ int skb_tunnel_check_pmtu(struct sk_buff *skb, struct dst_entry *encap_dst, } EXPORT_SYMBOL(skb_tunnel_check_pmtu); -/* Often modified stats are per cpu, other are shared (netdev->stats) */ -void ip_tunnel_get_stats64(struct net_device *dev, - struct rtnl_link_stats64 *tot) -{ - netdev_stats_to_stats64(tot, &dev->stats); - dev_fetch_sw_netstats(tot, dev->tstats); -} -EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64); - static const struct nla_policy ip_tun_policy[LWTUNNEL_IP_MAX + 1] = { [LWTUNNEL_IP_UNSPEC] = { .strict_start_type = LWTUNNEL_IP_OPTS }, [LWTUNNEL_IP_ID] = { .type = NLA_U64 },