Date: Sun, 30 Nov 2008 22:16:47 -0800 From: Navdeep Parhar <nparhar@gmail.com> To: svn-src-all@freebsd.org Subject: Re: svn commit: r185506 - head/sys/dev/cxgb Message-ID: <20081201061647.GA10625@insightsol.com> In-Reply-To: <200812010441.mB14fj1M012485@svn.freebsd.org> References: <200812010441.mB14fj1M012485@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Kip, pi->mac.stats are not updated too frequently, especially when compared to the rates at which packets/bytes are sent and received. The ifp-> counters will lag behind the actual values. This will affect the "realtime-ness" of the stats seen via utilities like netstat. We should continue to increment the ifp's counters as best as we can during tx/rx. It is good to sync them up with mac.stats every so often, but relying exclusively on mac.stats may not be best. Regards, Navdeep On Mon, Dec 01, 2008 at 04:41:45AM +0000, Kip Macy wrote: > Author: kmacy > Date: Mon Dec 1 04:41:45 2008 > New Revision: 185506 > URL: http://svn.freebsd.org/changeset/base/185506 > > Log: > Proper fix for tracking ifnet statistics > > Modified: > head/sys/dev/cxgb/cxgb_main.c > > Modified: head/sys/dev/cxgb/cxgb_main.c > ============================================================================== > --- head/sys/dev/cxgb/cxgb_main.c Mon Dec 1 04:03:17 2008 (r185505) > +++ head/sys/dev/cxgb/cxgb_main.c Mon Dec 1 04:41:45 2008 (r185506) > @@ -2203,6 +2203,58 @@ cxgb_tick_handler(void *arg, int count) > if (p->linkpoll_period) > check_link_status(sc); > > + > + for (i = 0; i < sc->params.nports; i++) { > + struct port_info *pi = &sc->port[i]; > + struct ifnet *ifp = pi->ifp; > + struct mac_stats *mstats = &pi->mac.stats; > + > + ifp->if_opackets = > + mstats->tx_frames_64 + > + mstats->tx_frames_65_127 + > + mstats->tx_frames_128_255 + > + mstats->tx_frames_256_511 + > + mstats->tx_frames_512_1023 + > + mstats->tx_frames_1024_1518 + > + mstats->tx_frames_1519_max; > + > + ifp->if_ipackets = > + mstats->rx_frames_64 + > + mstats->rx_frames_65_127 + > + mstats->rx_frames_128_255 + > + mstats->rx_frames_256_511 + > + mstats->rx_frames_512_1023 + > + mstats->rx_frames_1024_1518 + > + mstats->rx_frames_1519_max; > + > + ifp->if_obytes = mstats->tx_octets; > + ifp->if_ibytes = mstats->rx_octets; > + ifp->if_omcasts = mstats->tx_mcast_frames; > + ifp->if_imcasts = mstats->rx_mcast_frames; > + > + ifp->if_collisions = > + mstats->tx_total_collisions; > + > + ifp->if_iqdrops = mstats->rx_cong_drops; > + > + ifp->if_oerrors = > + mstats->tx_excess_collisions + > + mstats->tx_underrun + > + mstats->tx_len_errs + > + mstats->tx_mac_internal_errs + > + mstats->tx_excess_deferral + > + mstats->tx_fcs_errs; > + ifp->if_ierrors = > + mstats->rx_jabber + > + mstats->rx_data_errs + > + mstats->rx_sequence_errs + > + mstats->rx_runt + > + mstats->rx_too_long + > + mstats->rx_mac_internal_errs + > + mstats->rx_short + > + mstats->rx_fcs_errs; > + } > + > sc->check_task_cnt++; > > /* > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081201061647.GA10625>