lkml.org 
[lkml]   [2020]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 2/2] net: dsa: qca: ar9331: export stats64
From
Date
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]
\
 
 \ /
  Last update: 2020-12-02 13:49    [W:0.043 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site