[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f80ea68e-9515-0d4e-b2e3-1ae9e8296cd0@pengutronix.de>
Date: Wed, 2 Dec 2020 13:47:17 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
linux-mips@...r.kernel.org, Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Vladimir Oltean <olteanv@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] net: dsa: qca: ar9331: export stats64
On 12/2/20 1:43 PM, Oleksij Rempel wrote:
>>> +struct ar9331_sw_priv;
>>> +struct ar9331_sw_port {
>>> + int idx;
>>> + struct ar9331_sw_priv *priv;
>>> + struct delayed_work mib_read;
>>> + struct ar9331_sw_stats stats;
>>> + struct mutex lock; /* stats access */
>>
>> What does the lock protect? It's only used a single time.
>
> The ar9331_read_stats() function is called from two different contests:
> from worker over ar9331_do_stats_poll() and from user space over
> ar9331_get_stats64().
>
> The mutex lock should prevent a race in the read modify write operations
> for in the stats->*
Makes sense!
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists