Module Name: src Committed By: msaitoh Date: Fri Feb 10 06:35:22 UTC 2017
Modified Files: src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixgbe_vf.h ixv.c Log Message: - Both mbuf_defrag_failed and m_defrag_failed existed. Remove m_defrag_failed. - rx_irq, dropped_pkts, morerx, moretx and txloops counters are uncounted, so remove them. - Count handleq in ixv_handle_que(). - Detach event counters correctly. - Set some per-queue event names correctly. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_vf.h cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.18 src/sys/dev/pci/ixgbe/ix_txrx.c:1.19 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.18 Wed Feb 1 10:47:13 2017 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Fri Feb 10 06:35:22 2017 @@ -59,7 +59,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ /*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 301538 2016-06-07 04:51:50Z sephe $*/ -/*$NetBSD: ix_txrx.c,v 1.18 2017/02/01 10:47:13 msaitoh Exp $*/ +/*$NetBSD: ix_txrx.c,v 1.19 2017/02/10 06:35:22 msaitoh Exp $*/ #include "opt_inet.h" #include "opt_inet6.h" @@ -171,7 +171,7 @@ ixgbe_start_locked(struct tx_ring *txr, if (rc != 0) adapter->efbig2_tx_dma_setup.ev_count++; } else - adapter->m_defrag_failed.ev_count++; + adapter->mbuf_defrag_failed.ev_count++; } if (rc != 0) { m_freem(m_head); Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.71 src/sys/dev/pci/ixgbe/ixgbe.c:1.72 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.71 Wed Feb 8 09:00:37 2017 +++ src/sys/dev/pci/ixgbe/ixgbe.c Fri Feb 10 06:35:22 2017 @@ -59,7 +59,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/ -/*$NetBSD: ixgbe.c,v 1.71 2017/02/08 09:00:37 msaitoh Exp $*/ +/*$NetBSD: ixgbe.c,v 1.72 2017/02/10 06:35:22 msaitoh Exp $*/ #include "opt_inet.h" #include "opt_inet6.h" @@ -710,10 +710,10 @@ static int ixgbe_detach(device_t dev, int flags) { struct adapter *adapter = device_private(dev); - struct rx_ring *rxr = adapter->rx_rings; - struct ixgbe_hw_stats *stats = &adapter->stats.pf; struct ix_queue *que = adapter->queues; + struct rx_ring *rxr = adapter->rx_rings; struct tx_ring *txr = adapter->tx_rings; + struct ixgbe_hw_stats *stats = &adapter->stats.pf; u32 ctrl_ext; INIT_DEBUGOUT("ixgbe_detach: begin"); @@ -784,11 +784,8 @@ ixgbe_detach(device_t dev, int flags) sysctl_teardown(&adapter->sysctllog); evcnt_detach(&adapter->handleq); evcnt_detach(&adapter->req); - evcnt_detach(&adapter->morerx); - evcnt_detach(&adapter->moretx); - evcnt_detach(&adapter->txloops); evcnt_detach(&adapter->efbig_tx_dma_setup); - evcnt_detach(&adapter->m_defrag_failed); + evcnt_detach(&adapter->mbuf_defrag_failed); evcnt_detach(&adapter->efbig2_tx_dma_setup); evcnt_detach(&adapter->einval_tx_dma_setup); evcnt_detach(&adapter->other_tx_dma_setup); @@ -800,26 +797,30 @@ ixgbe_detach(device_t dev, int flags) txr = adapter->tx_rings; for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + evcnt_detach(&adapter->queues[i].irqs); evcnt_detach(&txr->no_desc_avail); evcnt_detach(&txr->total_packets); evcnt_detach(&txr->tso_tx); +#ifndef IXGBE_LEGACY_TX + evcnt_detach(&txr->pcq_drops); +#endif - if (i < __arraycount(adapter->stats.pf.mpc)) { - evcnt_detach(&adapter->stats.pf.mpc[i]); + if (i < __arraycount(stats->mpc)) { + evcnt_detach(&stats->mpc[i]); + } + if (i < __arraycount(stats->pxontxc)) { + evcnt_detach(&stats->pxontxc[i]); + evcnt_detach(&stats->pxonrxc[i]); + evcnt_detach(&stats->pxofftxc[i]); + evcnt_detach(&stats->pxoffrxc[i]); + evcnt_detach(&stats->pxon2offc[i]); } - if (i < __arraycount(adapter->stats.pf.pxontxc)) { - evcnt_detach(&adapter->stats.pf.pxontxc[i]); - evcnt_detach(&adapter->stats.pf.pxonrxc[i]); - evcnt_detach(&adapter->stats.pf.pxofftxc[i]); - evcnt_detach(&adapter->stats.pf.pxoffrxc[i]); - evcnt_detach(&adapter->stats.pf.pxon2offc[i]); - } - if (i < __arraycount(adapter->stats.pf.qprc)) { - evcnt_detach(&adapter->stats.pf.qprc[i]); - evcnt_detach(&adapter->stats.pf.qptc[i]); - evcnt_detach(&adapter->stats.pf.qbrc[i]); - evcnt_detach(&adapter->stats.pf.qbtc[i]); - evcnt_detach(&adapter->stats.pf.qprdc[i]); + if (i < __arraycount(stats->qprc)) { + evcnt_detach(&stats->qprc[i]); + evcnt_detach(&stats->qptc[i]); + evcnt_detach(&stats->qbrc[i]); + evcnt_detach(&stats->qbtc[i]); + evcnt_detach(&stats->qprdc[i]); } evcnt_detach(&rxr->rx_packets); @@ -827,7 +828,6 @@ ixgbe_detach(device_t dev, int flags) evcnt_detach(&rxr->rx_copies); evcnt_detach(&rxr->no_jmbuf); evcnt_detach(&rxr->rx_discarded); - evcnt_detach(&rxr->rx_irq); } evcnt_detach(&stats->ipcs); evcnt_detach(&stats->l4cs); @@ -4660,13 +4660,11 @@ ixgbe_add_hw_stats(struct adapter *adapt struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; struct ixgbe_hw_stats *stats = &adapter->stats.pf; + const char *xname = device_xname(dev); /* Driver Statistics */ #if 0 /* These counters are not updated by the software */ - SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", - CTLFLAG_RD, &adapter->dropped_pkts, - "Driver dropped packets"); SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_header_failed", CTLFLAG_RD, &adapter->mbuf_header_failed, "???"); @@ -4678,40 +4676,34 @@ ixgbe_add_hw_stats(struct adapter *adapt "???"); #endif evcnt_attach_dynamic(&adapter->handleq, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Handled queue in softint"); + NULL, xname, "Handled queue in softint"); evcnt_attach_dynamic(&adapter->req, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Requeued in softint"); - evcnt_attach_dynamic(&adapter->morerx, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Interrupt handler more rx"); - evcnt_attach_dynamic(&adapter->moretx, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Interrupt handler more tx"); - evcnt_attach_dynamic(&adapter->txloops, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Interrupt handler tx loops"); + NULL, xname, "Requeued in softint"); evcnt_attach_dynamic(&adapter->efbig_tx_dma_setup, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Driver tx dma soft fail EFBIG"); - evcnt_attach_dynamic(&adapter->m_defrag_failed, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "m_defrag() failed"); + NULL, xname, "Driver tx dma soft fail EFBIG"); + evcnt_attach_dynamic(&adapter->mbuf_defrag_failed, EVCNT_TYPE_MISC, + NULL, xname, "m_defrag() failed"); evcnt_attach_dynamic(&adapter->efbig2_tx_dma_setup, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Driver tx dma hard fail EFBIG"); + NULL, xname, "Driver tx dma hard fail EFBIG"); evcnt_attach_dynamic(&adapter->einval_tx_dma_setup, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Driver tx dma hard fail EINVAL"); + NULL, xname, "Driver tx dma hard fail EINVAL"); evcnt_attach_dynamic(&adapter->other_tx_dma_setup, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Driver tx dma hard fail other"); + NULL, xname, "Driver tx dma hard fail other"); evcnt_attach_dynamic(&adapter->eagain_tx_dma_setup, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Driver tx dma soft fail EAGAIN"); + NULL, xname, "Driver tx dma soft fail EAGAIN"); evcnt_attach_dynamic(&adapter->enomem_tx_dma_setup, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Driver tx dma soft fail ENOMEM"); + NULL, xname, "Driver tx dma soft fail ENOMEM"); evcnt_attach_dynamic(&adapter->watchdog_events, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Watchdog timeouts"); + NULL, xname, "Watchdog timeouts"); evcnt_attach_dynamic(&adapter->tso_err, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "TSO errors"); - evcnt_attach_dynamic(&adapter->link_irq, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "Link MSIX IRQ Handled"); + NULL, xname, "TSO errors"); + evcnt_attach_dynamic(&adapter->link_irq, EVCNT_TYPE_INTR, + NULL, xname, "Link MSIX IRQ Handled"); for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { snprintf(adapter->queues[i].evnamebuf, sizeof(adapter->queues[i].evnamebuf), "%s q%d", - device_xname(dev), i); + xname, i); snprintf(adapter->queues[i].namebuf, sizeof(adapter->queues[i].namebuf), "q%d", i); @@ -4756,8 +4748,10 @@ ixgbe_add_hw_stats(struct adapter *adapt 0, CTL_CREATE, CTL_EOL) != 0) break; + evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR, + NULL, adapter->queues[i].evnamebuf, "IRQs on queue"); evcnt_attach_dynamic(&txr->tso_tx, EVCNT_TYPE_MISC, - NULL, device_xname(dev), "TSO"); + NULL, adapter->queues[i].evnamebuf, "TSO"); evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, "Queue No Descriptor Available"); @@ -4840,8 +4834,6 @@ ixgbe_add_hw_stats(struct adapter *adapt NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf"); evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf, "Rx discarded"); - evcnt_attach_dynamic(&rxr->rx_irq, EVCNT_TYPE_MISC, - NULL, adapter->queues[i].evnamebuf, "Rx interrupts"); #ifdef LRO SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", CTLFLAG_RD, &lro->lro_queued, 0, @@ -4854,9 +4846,8 @@ ixgbe_add_hw_stats(struct adapter *adapt /* MAC stats get the own sub node */ - snprintf(stats->namebuf, - sizeof(stats->namebuf), "%s MAC Statistics", device_xname(dev)); + sizeof(stats->namebuf), "%s MAC Statistics", xname); evcnt_attach_dynamic(&stats->ipcs, EVCNT_TYPE_MISC, NULL, stats->namebuf, "rx csum offload - IP"); Index: src/sys/dev/pci/ixgbe/ixgbe.h diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.22 src/sys/dev/pci/ixgbe/ixgbe.h:1.23 --- src/sys/dev/pci/ixgbe/ixgbe.h:1.22 Wed Feb 1 10:47:13 2017 +++ src/sys/dev/pci/ixgbe/ixgbe.h Fri Feb 10 06:35:22 2017 @@ -59,7 +59,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ /*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 303890 2016-08-09 19:32:06Z dumbbell $*/ -/*$NetBSD: ixgbe.h,v 1.22 2017/02/01 10:47:13 msaitoh Exp $*/ +/*$NetBSD: ixgbe.h,v 1.23 2017/02/10 06:35:22 msaitoh Exp $*/ #ifndef _IXGBE_H_ @@ -435,7 +435,6 @@ struct rx_ring { u32 packets; /* Soft stats */ - struct evcnt rx_irq; struct evcnt rx_copies; struct evcnt rx_packets; struct evcnt rx_bytes; @@ -579,13 +578,11 @@ struct adapter { #endif /* Misc stats maintained by the driver */ - struct evcnt dropped_pkts; struct evcnt mbuf_defrag_failed; struct evcnt mbuf_header_failed; struct evcnt mbuf_packet_failed; struct evcnt efbig_tx_dma_setup; struct evcnt efbig2_tx_dma_setup; - struct evcnt m_defrag_failed; struct evcnt einval_tx_dma_setup; struct evcnt other_tx_dma_setup; struct evcnt eagain_tx_dma_setup; @@ -593,9 +590,6 @@ struct adapter { struct evcnt tso_err; struct evcnt watchdog_events; struct evcnt link_irq; - struct evcnt morerx; - struct evcnt moretx; - struct evcnt txloops; struct evcnt handleq; struct evcnt req; Index: src/sys/dev/pci/ixgbe/ixgbe_vf.h diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.7 src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8 --- src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.7 Thu Dec 1 06:56:28 2016 +++ src/sys/dev/pci/ixgbe/ixgbe_vf.h Fri Feb 10 06:35:22 2017 @@ -31,7 +31,7 @@ ******************************************************************************/ /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.h 282289 2015-04-30 22:53:27Z erj $*/ -/*$NetBSD: ixgbe_vf.h,v 1.7 2016/12/01 06:56:28 msaitoh Exp $*/ +/*$NetBSD: ixgbe_vf.h,v 1.8 2017/02/10 06:35:22 msaitoh Exp $*/ #ifndef __IXGBE_VF_H__ #define __IXGBE_VF_H__ @@ -91,6 +91,7 @@ struct ixgbevf_hw_stats { + char namebuf[32]; u64 base_vfgprc; u64 base_vfgptc; u64 base_vfgorc; Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.48 src/sys/dev/pci/ixgbe/ixv.c:1.49 --- src/sys/dev/pci/ixgbe/ixv.c:1.48 Fri Feb 10 04:34:11 2017 +++ src/sys/dev/pci/ixgbe/ixv.c Fri Feb 10 06:35:22 2017 @@ -31,7 +31,7 @@ ******************************************************************************/ /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 302384 2016-07-07 03:39:18Z sbruno $*/ -/*$NetBSD: ixv.c,v 1.48 2017/02/10 04:34:11 msaitoh Exp $*/ +/*$NetBSD: ixv.c,v 1.49 2017/02/10 06:35:22 msaitoh Exp $*/ #include "opt_inet.h" #include "opt_inet6.h" @@ -476,6 +476,8 @@ ixv_detach(device_t dev, int flags) struct adapter *adapter = device_private(dev); struct ix_queue *que = adapter->queues; struct tx_ring *txr = adapter->tx_rings; + struct rx_ring *rxr = adapter->rx_rings; + struct ixgbevf_hw_stats *stats = &adapter->stats.vf; INIT_DEBUGOUT("ixv_detach: begin"); if (adapter->osdep.attached == false) @@ -527,6 +529,48 @@ ixv_detach(device_t dev, int flags) if_detach(adapter->ifp); sysctl_teardown(&adapter->sysctllog); + evcnt_detach(&adapter->handleq); + evcnt_detach(&adapter->req); + evcnt_detach(&adapter->efbig_tx_dma_setup); + evcnt_detach(&adapter->mbuf_defrag_failed); + evcnt_detach(&adapter->efbig2_tx_dma_setup); + evcnt_detach(&adapter->einval_tx_dma_setup); + evcnt_detach(&adapter->other_tx_dma_setup); + evcnt_detach(&adapter->eagain_tx_dma_setup); + evcnt_detach(&adapter->enomem_tx_dma_setup); + evcnt_detach(&adapter->watchdog_events); + evcnt_detach(&adapter->tso_err); + evcnt_detach(&adapter->link_irq); + + txr = adapter->tx_rings; + for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + evcnt_detach(&adapter->queues[i].irqs); + evcnt_detach(&txr->no_desc_avail); + evcnt_detach(&txr->total_packets); + evcnt_detach(&txr->tso_tx); +#ifndef IXGBE_LEGACY_TX + evcnt_detach(&txr->pcq_drops); +#endif + + evcnt_detach(&rxr->rx_packets); + evcnt_detach(&rxr->rx_bytes); + evcnt_detach(&rxr->rx_copies); + evcnt_detach(&rxr->no_jmbuf); + evcnt_detach(&rxr->rx_discarded); + } + evcnt_detach(&stats->ipcs); + evcnt_detach(&stats->l4cs); + evcnt_detach(&stats->ipcs_bad); + evcnt_detach(&stats->l4cs_bad); + + /* Packet Reception Stats */ + evcnt_detach(&stats->vfgorc); + evcnt_detach(&stats->vfgprc); + evcnt_detach(&stats->vfmprc); + + /* Packet Transmission Stats */ + evcnt_detach(&stats->vfgotc); + evcnt_detach(&stats->vfgptc); ixgbe_free_transmit_structures(adapter); ixgbe_free_receive_structures(adapter); @@ -829,6 +873,8 @@ ixv_handle_que(void *context) struct ifnet *ifp = adapter->ifp; bool more; + adapter->handleq.ev_count++; + if (ifp->if_flags & IFF_RUNNING) { more = ixgbe_rxeof(que); IXGBE_TX_LOCK(txr); @@ -1578,11 +1624,8 @@ ixv_free_pci_resources(struct adapter * } - /* Clean the Legacy or Link interrupt last */ - if (adapter->vector) /* we are doing MSIX */ - rid = adapter->vector; - else - rid = 0; + /* Clean the Link interrupt last */ + rid = adapter->vector; if (adapter->osdep.ihs[rid] != NULL) { pci_intr_disestablish(adapter->osdep.pc, @@ -2297,22 +2340,161 @@ static void ixv_add_stats_sysctls(struct adapter *adapter) { device_t dev = adapter->dev; + const struct sysctlnode *rnode; + struct sysctllog **log = &adapter->sysctllog; struct ix_queue *que = &adapter->queues[0]; struct tx_ring *txr = que->txr; struct rx_ring *rxr = que->rxr; struct ixgbevf_hw_stats *stats = &adapter->stats.vf; - const char *xname = device_xname(dev); /* Driver Statistics */ - evcnt_attach_dynamic(&adapter->dropped_pkts, EVCNT_TYPE_MISC, - NULL, xname, "Driver dropped packets"); + evcnt_attach_dynamic(&adapter->handleq, EVCNT_TYPE_MISC, + NULL, xname, "Handled queue in softint"); + evcnt_attach_dynamic(&adapter->req, EVCNT_TYPE_MISC, + NULL, xname, "Requeued in softint"); + evcnt_attach_dynamic(&adapter->efbig_tx_dma_setup, EVCNT_TYPE_MISC, + NULL, xname, "Driver tx dma soft fail EFBIG"); evcnt_attach_dynamic(&adapter->mbuf_defrag_failed, EVCNT_TYPE_MISC, NULL, xname, "m_defrag() failed"); + evcnt_attach_dynamic(&adapter->efbig2_tx_dma_setup, EVCNT_TYPE_MISC, + NULL, xname, "Driver tx dma hard fail EFBIG"); + evcnt_attach_dynamic(&adapter->einval_tx_dma_setup, EVCNT_TYPE_MISC, + NULL, xname, "Driver tx dma hard fail EINVAL"); + evcnt_attach_dynamic(&adapter->other_tx_dma_setup, EVCNT_TYPE_MISC, + NULL, xname, "Driver tx dma hard fail other"); + evcnt_attach_dynamic(&adapter->eagain_tx_dma_setup, EVCNT_TYPE_MISC, + NULL, xname, "Driver tx dma soft fail EAGAIN"); + evcnt_attach_dynamic(&adapter->enomem_tx_dma_setup, EVCNT_TYPE_MISC, + NULL, xname, "Driver tx dma soft fail ENOMEM"); evcnt_attach_dynamic(&adapter->watchdog_events, EVCNT_TYPE_MISC, NULL, xname, "Watchdog timeouts"); + evcnt_attach_dynamic(&adapter->tso_err, EVCNT_TYPE_MISC, + NULL, xname, "TSO errors"); + evcnt_attach_dynamic(&adapter->link_irq, EVCNT_TYPE_INTR, + NULL, xname, "Link MSIX IRQ Handled"); + + for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) { + snprintf(adapter->queues[i].evnamebuf, + sizeof(adapter->queues[i].evnamebuf), "%s q%d", + xname, i); + snprintf(adapter->queues[i].namebuf, + sizeof(adapter->queues[i].namebuf), "q%d", i); + + if ((rnode = ixv_sysctl_instance(adapter)) == NULL) { + aprint_error_dev(dev, "could not create sysctl root\n"); + break; + } + + if (sysctl_createv(log, 0, &rnode, &rnode, + 0, CTLTYPE_NODE, + adapter->queues[i].namebuf, SYSCTL_DESCR("Queue Name"), + NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL) != 0) + break; + +#if 0 /* not yet */ + if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READWRITE, CTLTYPE_INT, + "interrupt_rate", SYSCTL_DESCR("Interrupt Rate"), + ixgbe_sysctl_interrupt_rate_handler, 0, + (void *)&adapter->queues[i], 0, CTL_CREATE, CTL_EOL) != 0) + break; + + if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READONLY, CTLTYPE_QUAD, + "irqs", SYSCTL_DESCR("irqs on this queue"), + NULL, 0, &(adapter->queues[i].irqs), + 0, CTL_CREATE, CTL_EOL) != 0) + break; + + if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READONLY, CTLTYPE_INT, + "txd_head", SYSCTL_DESCR("Transmit Descriptor Head"), + ixgbe_sysctl_tdh_handler, 0, (void *)txr, + 0, CTL_CREATE, CTL_EOL) != 0) + break; + + if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READONLY, CTLTYPE_INT, + "txd_tail", SYSCTL_DESCR("Transmit Descriptor Tail"), + ixgbe_sysctl_tdt_handler, 0, (void *)txr, + 0, CTL_CREATE, CTL_EOL) != 0) + break; +#endif + evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR, + NULL, adapter->queues[i].evnamebuf, "IRQs on queue"); + evcnt_attach_dynamic(&txr->tso_tx, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, "TSO"); + evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, + "Queue No Descriptor Available"); + evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, + "Queue Packets Transmitted"); +#ifndef IXGBE_LEGACY_TX + evcnt_attach_dynamic(&txr->pcq_drops, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, + "Packets dropped in pcq"); +#endif + +#ifdef LRO + struct lro_ctrl *lro = &rxr->lro; +#endif /* LRO */ + +#if 0 /* not yet */ + if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READONLY, + CTLTYPE_INT, + "rxd_head", SYSCTL_DESCR("Receive Descriptor Head"), + ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0, + CTL_CREATE, CTL_EOL) != 0) + break; + + if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READONLY, + CTLTYPE_INT, + "rxd_tail", SYSCTL_DESCR("Receive Descriptor Tail"), + ixgbe_sysctl_rdt_handler, 0, (void *)rxr, 0, + CTL_CREATE, CTL_EOL) != 0) + break; +#endif + + evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, "Queue Packets Received"); + evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, "Queue Bytes Received"); + evcnt_attach_dynamic(&rxr->rx_copies, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, "Copied RX Frames"); + evcnt_attach_dynamic(&rxr->no_jmbuf, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, "Rx no jumbo mbuf"); + evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC, + NULL, adapter->queues[i].evnamebuf, "Rx discarded"); +#ifdef LRO + SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_queued", + CTLFLAG_RD, &lro->lro_queued, 0, + "LRO Queued"); + SYSCTL_ADD_INT(ctx, queue_list, OID_AUTO, "lro_flushed", + CTLFLAG_RD, &lro->lro_flushed, 0, + "LRO Flushed"); +#endif /* LRO */ + } + + /* MAC stats get the own sub node */ + + snprintf(stats->namebuf, + sizeof(stats->namebuf), "%s MAC Statistics", xname); + + evcnt_attach_dynamic(&stats->ipcs, EVCNT_TYPE_MISC, NULL, + stats->namebuf, "rx csum offload - IP"); + evcnt_attach_dynamic(&stats->l4cs, EVCNT_TYPE_MISC, NULL, + stats->namebuf, "rx csum offload - L4"); + evcnt_attach_dynamic(&stats->ipcs_bad, EVCNT_TYPE_MISC, NULL, + stats->namebuf, "rx csum offload - IP bad"); + evcnt_attach_dynamic(&stats->l4cs_bad, EVCNT_TYPE_MISC, NULL, + stats->namebuf, "rx csum offload - L4 bad"); + /* Packet Reception Stats */ evcnt_attach_dynamic(&stats->vfgprc, EVCNT_TYPE_MISC, NULL, xname, "Good Packets Received"); evcnt_attach_dynamic(&stats->vfgorc, EVCNT_TYPE_MISC, NULL, @@ -2323,22 +2505,6 @@ ixv_add_stats_sysctls(struct adapter *ad xname, "Good Packets Transmitted"); evcnt_attach_dynamic(&stats->vfgotc, EVCNT_TYPE_MISC, NULL, xname, "Good Octets Transmitted"); - evcnt_attach_dynamic(&que->irqs, EVCNT_TYPE_INTR, NULL, - xname, "IRQs on queue"); - evcnt_attach_dynamic(&rxr->rx_irq, EVCNT_TYPE_INTR, NULL, - xname, "RX irqs on queue"); - evcnt_attach_dynamic(&rxr->rx_packets, EVCNT_TYPE_MISC, NULL, - xname, "RX packets"); - evcnt_attach_dynamic(&rxr->rx_bytes, EVCNT_TYPE_MISC, NULL, - xname, "RX bytes"); - evcnt_attach_dynamic(&rxr->rx_discarded, EVCNT_TYPE_MISC, NULL, - xname, "Discarded RX packets"); - evcnt_attach_dynamic(&txr->total_packets, EVCNT_TYPE_MISC, NULL, - xname, "TX Packets"); - evcnt_attach_dynamic(&txr->no_desc_avail, EVCNT_TYPE_MISC, NULL, - xname, "# of times not enough descriptors were available during TX"); - evcnt_attach_dynamic(&txr->tso_tx, EVCNT_TYPE_MISC, NULL, - xname, "TX TSO"); } static void