From: Corinna Vinschen <vinsc...@redhat.com> Date: Mon, 24 Aug 2015 12:52:39 +0200
> The r8169 driver collects statistical information returned by > @get_stats64 by counting them in the driver itself, even though many > (but not all) of the values are already collected by tally counters > (TCs) in the NIC. Some of these TC values are not returned by > @get_stats64. Especially the received multicast packages are missing > from /proc/net/dev. > > Rectify this by fetching the TCs and returning them from > rtl8169_get_stats64. > > The counters collected in the driver obviously disappear as soon as the > driver is unloaded so after a driver is loaded the counters always start > at 0. The TCs on the other hand are only reset by a power cycle. Without > further considerations the values collected by the driver would not match > up against the TC values. > > This patch introduces a new function rtl8169_reset_counters which > resets the TCs. Also, since rtl8169_reset_counters shares most of > its code with rtl8169_update_counters, refactor the shared code into > two new functions rtl8169_map_counters and rtl8169_unmap_counters. > > Unfortunately chip versions prior to RTL_GIGA_MAC_VER_19 don't allow > to reset the TCs programatically. Therefore introduce an addition to > the rtl8169_private struct and a function rtl8169_init_counter_offsets > to store the TCs at first rtl_open. Use these values as offsets in > rtl8169_get_stats64. Propagate a failure to reset *and* update the > counters up to rtl_open and emit a warning message, if so. > > Signed-off-by: Corinna Vinschen <vinsc...@redhat.com> Your counter offsets should be read at probe time, not open time. Bringing the interface is brought down/up should not reset the counters. Look at how the software counters behave in such a situation. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html