From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 37178C4167B for ; Fri, 4 Dec 2020 22:14:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3A2722CBE for ; Fri, 4 Dec 2020 22:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbgLDWNr (ORCPT ); Fri, 4 Dec 2020 17:13:47 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:39450 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgLDWNr (ORCPT ); Fri, 4 Dec 2020 17:13:47 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1klJJx-00AGxT-JU; Fri, 04 Dec 2020 23:12:57 +0100 Date: Fri, 4 Dec 2020 23:12:57 +0100 From: Andrew Lunn To: George McCollister Cc: Oleksij Rempel , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Russell King , Pengutronix Kernel Team , netdev@vger.kernel.org, open list , linux-mips@vger.kernel.org Subject: Re: [PATCH v4 net-next 2/2] net: dsa: qca: ar9331: export stats64 Message-ID: <20201204221257.GH2400258@lunn.ch> References: <20201204145624.11713-1-o.rempel@pengutronix.de> <20201204145624.11713-3-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > +struct ar9331_sw_stats { > > + u64 rxbroad; > > + u64 rxpause; > > + u64 rxmulti; > > +}; 7> > +struct ar9331_sw_port { > > + int idx; > > + struct ar9331_sw_priv *priv; > > + struct delayed_work mib_read; > > + struct ar9331_sw_stats stats; > > +static void ar9331_stats_update(struct ar9331_sw_port *port, > > + struct rtnl_link_stats64 *stats) > > +{ > > + struct ar9331_sw_stats *s = &port->stats; > > + > > + stats->rx_packets = s->rxbroad + s->rxmulti + s->rx64byte + > > + s->rx128byte + s->rx256byte + s->rx512byte + s->rx1024byte + > > + s->rx1518byte + s->rxmaxbyte; > > Are all of these port->stats accesses always atomic? I'll need to do > something similar in my xrs700x driver and want to make sure there > doesn't need to be a lock between here and where they're updated in > the delayed work. Since these are u64, they are not atomic on 32 bit systems. Take a look at include/linux/u64_stats_sync.h Andrewu