[PATCH 9/9] net: aquantia: Reset nic statistics on interface up/down

AceLan Kao acelan.kao at canonical.com
Tue Nov 7 01:52:03 UTC 2017

From: Igor Russkikh <igor.russkikh at aquantia.com>

BugLink: http://bugs.launchpad.net/bugs/1730544

Internal statistics system on chip never gets reset until hardware
reboot. This is quite inconvenient in terms of ethtool statistics usage.

This patch implements incremental statistics update inside of
service callback.

Upon nic initialization, first request is done to fetch
initial stat data, current collected stat data gets cleared.
Internal statistics mailbox readout is improved to save space and
increase readability

Signed-off-by: Pavel Belous <pavel.belous at aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh at aquantia.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 65e665e68d097edfe667372f13d54f3e4edcb69c)
Signed-off-by: AceLan Kao <acelan.kao at canonical.com>
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index c628089..a9176e4 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -182,6 +182,9 @@ static void aq_nic_service_timer_cb(unsigned long param)
 	if (self->aq_hw_ops.hw_update_stats)
+	if (self->aq_hw_ops.hw_update_stats)
+		self->aq_hw_ops.hw_update_stats(self->aq_hw);
 	memset(&stats_rx, 0U, sizeof(struct aq_ring_stats_rx_s));
 	memset(&stats_tx, 0U, sizeof(struct aq_ring_stats_tx_s));
 	for (i = AQ_DIMOF(self->aq_vec); i--;) {

More information about the kernel-team mailing list