[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250113193650.1b3d6f55@kernel.org>
Date: Mon, 13 Jan 2025 19:36:50 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Shinas Rasheed <srasheed@...vell.com>
Cc: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<hgani@...vell.com>, <sedara@...vell.com>, <vimleshk@...vell.com>,
<thaller@...hat.com>, <wizhao@...hat.com>, <kheib@...hat.com>,
<konguyen@...hat.com>, <horms@...nel.org>, <einstein.xue@...axg.com>,
Veerasenareddy Burru <vburru@...vell.com>, Andrew Lunn
<andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, "Paolo Abeni" <pabeni@...hat.com>
Subject: Re: [PATCH net v6 1/4] octeon_ep: update tx/rx stats locally for
persistence
On Fri, 10 Jan 2025 04:27:27 -0800 Shinas Rasheed wrote:
> @@ -991,33 +991,30 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb,
> static void octep_get_stats64(struct net_device *netdev,
> struct rtnl_link_stats64 *stats)
> {
> - u64 tx_packets, tx_bytes, rx_packets, rx_bytes;
> struct octep_device *oct = netdev_priv(netdev);
> int q;
>
> + oct->iface_tx_stats.pkts = 0;
> + oct->iface_tx_stats.octs = 0;
> + oct->iface_rx_stats.pkts = 0;
> + oct->iface_rx_stats.octets = 0;
> + for (q = 0; q < oct->num_ioq_stats; q++) {
> + oct->iface_tx_stats.pkts += oct->stats_iq[q].instr_completed;
> + oct->iface_tx_stats.octs += oct->stats_iq[q].bytes_sent;
> + oct->iface_rx_stats.pkts += oct->stats_oq[q].packets;
> + oct->iface_rx_stats.octets += oct->stats_oq[q].bytes;
> + }
The new approach is much better, but you can't use oct->iface_* as
intermediate storage. There is no exclusive locking on this function,
multiple processes can be executing this function in parallel.
Overwriting each others updates to oct->iface_tx_stats etc.
--
pw-bot: cr
Powered by blists - more mailing lists