From: Heiner Kallweit <hkallweit1@gmail.com>
To: Lev Stipakov <lstipakov@gmail.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Lev Stipakov <lev@openvpn.net>
Subject: Re: [PATCH 3/3] net: xfrm: use core API for updating TX stats
Date: Fri, 13 Nov 2020 08:46:48 +0100 [thread overview]
Message-ID: <59b6c94d-e0de-e4f5-d02e-e799694f6dc8@gmail.com> (raw)
In-Reply-To: <20201112111345.34625-1-lev@openvpn.net>
Am 12.11.2020 um 12:13 schrieb Lev Stipakov:
> Commit d3fd65484c781 ("net: core: add dev_sw_netstats_tx_add") has added
> function "dev_sw_netstats_tx_add()" to update net device per-cpu TX
> stats.
>
> Use this function instead of own code.
>
LGTM. In addition you can replace xfrmi_get_stats64() with
dev_get_tstats64().
> Signed-off-by: Lev Stipakov <lev@openvpn.net>
> ---
> net/xfrm/xfrm_interface.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
> index 9b8e292a7c6a..43ee4c5a6fa9 100644
> --- a/net/xfrm/xfrm_interface.c
> +++ b/net/xfrm/xfrm_interface.c
> @@ -319,12 +319,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
>
> err = dst_output(xi->net, skb->sk, skb);
> if (net_xmit_eval(err) == 0) {
> - struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
> -
> - u64_stats_update_begin(&tstats->syncp);
> - tstats->tx_bytes += length;
> - tstats->tx_packets++;
> - u64_stats_update_end(&tstats->syncp);
> + dev_sw_netstats_tx_add(dev, 1, length);
> } else {
> stats->tx_errors++;
> stats->tx_aborted_errors++;
>
next prev parent reply other threads:[~2020-11-13 7:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 11:13 [PATCH 3/3] net: xfrm: use core API for updating TX stats Lev Stipakov
2020-11-13 7:46 ` Heiner Kallweit [this message]
2020-11-13 9:07 ` [PATCH v2 3/3] net: xfrm: use core API for updating/providing stats Lev Stipakov
2020-11-13 10:46 ` Heiner Kallweit
2020-11-13 21:59 ` [PATCH v3] " Lev Stipakov
2020-11-15 1:03 ` Jakub Kicinski
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=59b6c94d-e0de-e4f5-d02e-e799694f6dc8@gmail.com \
--to=hkallweit1@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=lev@openvpn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lstipakov@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/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).