]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: aquantia: fetch up to date statistics on ethtool request
authorDmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Mon, 29 Apr 2019 10:05:02 +0000 (10:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 May 2019 13:30:15 +0000 (09:30 -0400)
This improves ethtool -S usage, where stats are now actual
on each request. Before that stats only were updated at service
timer period.

Tested-by: Nikita Danilov <ndanilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Dmitry Bogdanov <dmitry.bogdanov@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/aq_nic.c

index 454a44bb148e84ad9137816f1ed810208fa26f44..8018f483ae45748893e7e6d4536c577cef298100 100644 (file)
@@ -700,7 +700,14 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data)
        unsigned int i = 0U;
        unsigned int count = 0U;
        struct aq_vec_s *aq_vec = NULL;
-       struct aq_stats_s *stats = self->aq_hw_ops->hw_get_hw_stats(self->aq_hw);
+       struct aq_stats_s *stats;
+
+       if (self->aq_fw_ops->update_stats) {
+               mutex_lock(&self->fwreq_mutex);
+               self->aq_fw_ops->update_stats(self->aq_hw);
+               mutex_unlock(&self->fwreq_mutex);
+       }
+       stats = self->aq_hw_ops->hw_get_hw_stats(self->aq_hw);
 
        if (!stats)
                goto err_exit;