net: aquantia: Update hw counters on hw init
authorIgor Russkikh <igor.russkikh@aquantia.com>
Thu, 14 Dec 2017 09:34:46 +0000 (12:34 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Dec 2017 17:46:42 +0000 (12:46 -0500)
On very first start we should read out current HW counter values
to make diff based calculations later.
This also should be done each time NIC gets down/up or wakes up
after sleep state. We reset link state explicitly to prevent diffs
from being summed this first time.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c

index b0abd187cead95a34da01d2b07f54e5bf30726cb..f18dce14c93cfa89f5c091db5f5b06c6e882aa68 100644 (file)
@@ -344,6 +344,10 @@ static int hw_atl_a0_hw_init(struct aq_hw_s *self,
        hw_atl_a0_hw_rss_set(self, &aq_nic_cfg->aq_rss);
        hw_atl_a0_hw_rss_hash_set(self, &aq_nic_cfg->aq_rss);
 
+       /* Reset link status and read out initial hardware counters */
+       self->aq_link_status.mbps = 0;
+       hw_atl_utils_update_stats(self);
+
        err = aq_hw_err_from_flags(self);
        if (err < 0)
                goto err_exit;
index 36fddb199160b064f0d2c38363eb7e192437ed2c..e4a22ce7bf09d50f21ffed6425783d7be7c88da5 100644 (file)
@@ -397,6 +397,10 @@ static int hw_atl_b0_hw_init(struct aq_hw_s *self,
         */
        aq_hw_write_reg(self, tx_dma_total_req_limit_adr, 24);
 
+       /* Reset link status and read out initial hardware counters */
+       self->aq_link_status.mbps = 0;
+       hw_atl_utils_update_stats(self);
+
        err = aq_hw_err_from_flags(self);
        if (err < 0)
                goto err_exit;