From c533f1a09afd07a3a4a94ca7f58bcd067c82c7d9 Mon Sep 17 00:00:00 2001 From: kmacy Date: Mon, 1 Dec 2008 05:43:30 +0000 Subject: 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 --- sys/dev/cxgb/cxgb_main.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c index 43ba57a..581cc09 100644 --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -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 -- cgit v1.1