From: Jakub Kicinski <kuba@kernel.org>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Willem de Bruijn <willemb@google.com>,
David Miller <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Harald Welte <laforge@gnumonks.org>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
osmocom-net-gprs@lists.osmocom.org, wireguard@lists.zx2c4.com,
Steffen Klassert <steffen.klassert@secunet.com>
Subject: Re: [PATCH net-next v2 03/10] tun: switch to net core provided statistics counters
Date: Fri, 6 Nov 2020 08:18:46 -0800 [thread overview]
Message-ID: <20201106081846.27212e9e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <aea7d78e-2d77-1f8a-70f0-73d46c96b44e@gmail.com>
On Fri, 6 Nov 2020 09:27:45 +0100 Heiner Kallweit wrote:
> On 06.11.2020 08:48, Heiner Kallweit wrote:
> > On 06.11.2020 02:14, Jakub Kicinski wrote:
> >> On Wed, 4 Nov 2020 15:25:24 +0100 Heiner Kallweit wrote:
> >>> @@ -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();
> >>
> >> This is no longer atomic. Multiple CPUs may try to update it at the
> >> same time.
> >>
> >> Do you know what the story on dev->rx_dropped is? The kdoc says drivers
> >> are not supposed to use it but:
> >>
> >> drivers/net/ipvlan/ipvlan_core.c: atomic_long_inc(&skb->dev->rx_dropped);
> >> drivers/net/macvlan.c: atomic_long_inc(&skb->dev->rx_dropped);
> >> drivers/net/vxlan.c: atomic_long_inc(&vxlan->dev->rx_dropped);
> >>
> >> Maybe tun can use it, too?
> >>
> > Thanks, yes that should be possible. Here we speak about tx_dropped,
> > but AFAICS the same applies as for rx_dropped. Will change it accordingly
> > in a v3.
> >
> For rx_dropped and tx_dropped it's easy, however tun also has a per-cpu
> counter for rx_frame_errors that is incremented if virtio_net_hdr_to_skb()
> fails. Not sure how to deal best with this one.
Umpf, yeah, so I'd probably add an atomic long to struct tun_struct,
but then you'll need to keep the ndo implementation instead of using
dev_get_tstats64 directly. I can't think of a better way, tho.
next prev parent reply other threads:[~2020-11-06 16:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 14:23 [PATCH net-next v2 00/10] net: add and use dev_get_tstats64 Heiner Kallweit
2020-11-04 14:24 ` [PATCH net-next v2 01/10] net: core: add dev_get_tstats64 as a ndo_get_stats64 implementation Heiner Kallweit
2020-11-04 14:24 ` [PATCH net-next v2 02/10] net: dsa: use net core stats64 handling Heiner Kallweit
2020-11-04 14:25 ` [PATCH net-next v2 03/10] tun: switch to net core provided statistics counters Heiner Kallweit
2020-11-06 1:14 ` Jakub Kicinski
2020-11-06 7:48 ` Heiner Kallweit
2020-11-06 8:27 ` Heiner Kallweit
2020-11-06 16:18 ` Jakub Kicinski [this message]
2020-11-04 14:26 ` [PATCH net-next v2 04/10] ip6_tunnel: switch to dev_get_tstats64 Heiner Kallweit
2020-11-04 14:27 ` [PATCH net-next v2 05/10] net: " Heiner Kallweit
2020-11-04 14:27 ` [PATCH net-next v2 06/10] gtp: " Heiner Kallweit
2020-11-05 7:58 ` Harald Welte
2020-11-04 14:28 ` [PATCH net-next v2 07/10] wireguard: " Heiner Kallweit
2020-11-04 19:46 ` Jason A. Donenfeld
2020-11-04 14:28 ` [PATCH net-next v2 08/10] vti: " Heiner Kallweit
2020-11-04 14:29 ` [PATCH net-next v2 09/10] ipv4/ipv6: " Heiner Kallweit
2020-11-04 14:31 ` [PATCH net-next v2 10/10] net: remove ip_tunnel_get_stats64 Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201106081846.27212e9e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=Jason@zx2c4.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=hkallweit1@gmail.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=laforge@gnumonks.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=osmocom-net-gprs@lists.osmocom.org \
--cc=pablo@netfilter.org \
--cc=steffen.klassert@secunet.com \
--cc=vivien.didelot@gmail.com \
--cc=willemb@google.com \
--cc=wireguard@lists.zx2c4.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).