Date: Mon, 1 Dec 2008 05:43:30 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r185508 - head/sys/dev/cxgb Message-ID: <200812010543.mB15hU3N013803@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Mon Dec 1 05:43:30 2008 New Revision: 185508 URL: http://svn.freebsd.org/changeset/base/185508 Log: Update internal mac stats every time the tick task is called if we don't do this "netstat -w 1" will frequently see negative differences in packets sent 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:42:39 2008 (r185507) +++ head/sys/dev/cxgb/cxgb_main.c Mon Dec 1 05:43:30 2008 (r185508) @@ -2185,7 +2185,7 @@ cxgb_tick(void *arg) if(sc->flags & CXGB_SHUTDOWN) return; - taskqueue_enqueue(sc->tq, &sc->tick_task); + taskqueue_enqueue(sc->tq, &sc->tick_task); callout_reset(&sc->cxgb_tick_ch, CXGB_TICKS(sc), cxgb_tick, sc); } @@ -2204,10 +2204,25 @@ cxgb_tick_handler(void *arg, int count) check_link_status(sc); + sc->check_task_cnt++; + + /* + * adapter lock can currently only be acquired after the + * port lock + */ + ADAPTER_UNLOCK(sc); + + if (p->rev == T3_REV_B2 && p->nports < 4 && sc->open_device_map) + check_t3b2_mac(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; + PORT_LOCK(pi); + t3_mac_update_stats(&pi->mac); + PORT_UNLOCK(pi); + ifp->if_opackets = mstats->tx_frames_64 + @@ -2254,30 +2269,6 @@ cxgb_tick_handler(void *arg, int count) mstats->rx_short + mstats->rx_fcs_errs; } - - sc->check_task_cnt++; - - /* - * adapter lock can currently only be acquired after the - * port lock - */ - ADAPTER_UNLOCK(sc); - - if (p->rev == T3_REV_B2 && p->nports < 4 && sc->open_device_map) - check_t3b2_mac(sc); - - /* Update MAC stats if it's time to do so */ - if (!p->linkpoll_period || - (sc->check_task_cnt * p->linkpoll_period) / 10 >= - p->stats_update_period) { - for_each_port(sc, i) { - struct port_info *port = &sc->port[i]; - PORT_LOCK(port); - t3_mac_update_stats(&port->mac); - PORT_UNLOCK(port); - } - sc->check_task_cnt = 0; - } } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812010543.mB15hU3N013803>