Messages in this thread | | | Subject | Re: [PATCH v2 2/2] net: dsa: qca: ar9331: export stats64 | From | Marc Kleine-Budde <> | Date | Wed, 2 Dec 2020 13:47:17 +0100 |
| |
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 |
[unhandled content-type:application/pgp-signature] | |