Module Name:    src
Committed By:   msaitoh
Date:           Wed Mar  7 03:29:10 UTC 2018

Modified Files:
        src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h ixv.c

Log Message:
- Make "Handled queue in softint" and "Requeued in softint" evcnt(9) per queue
  and count them correctly.
- Remove #if 0'ed code.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.84 -r1.85 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/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.128 src/sys/dev/pci/ixgbe/ixgbe.c:1.129
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.128	Fri Mar  2 10:19:20 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Mar  7 03:29:10 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.128 2018/03/02 10:19:20 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.129 2018/03/07 03:29:10 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -1686,10 +1686,6 @@ ixgbe_add_hw_stats(struct adapter *adapt
 	const char *xname = device_xname(dev);
 
 	/* Driver Statistics */
-	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,
@@ -1736,15 +1732,6 @@ ixgbe_add_hw_stats(struct adapter *adapt
 		    (void *)&adapter->queues[i], 0, CTL_CREATE, CTL_EOL) != 0)
 			break;
 
-#if 0 /* XXX msaitoh */
-		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;
-#endif
-
 		if (sysctl_createv(log, 0, &rnode, &cnode,
 		    CTLFLAG_READONLY, CTLTYPE_INT,
 		    "txd_head", SYSCTL_DESCR("Transmit Descriptor Head"),
@@ -1761,6 +1748,11 @@ ixgbe_add_hw_stats(struct adapter *adapt
 
 		evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR,
 		    NULL, adapter->queues[i].evnamebuf, "IRQs on queue");
+		evcnt_attach_dynamic(&adapter->queues[i].handleq,
+		    EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
+		    "Handled queue in softint");
+		evcnt_attach_dynamic(&adapter->queues[i].req, EVCNT_TYPE_MISC,
+		    NULL, adapter->queues[i].evnamebuf, "Requeued in softint");
 		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,
@@ -1981,8 +1973,6 @@ ixgbe_clear_evcnt(struct adapter *adapte
 	struct ixgbe_hw *hw = &adapter->hw;
 	struct ixgbe_hw_stats *stats = &adapter->stats.pf;
 
-	adapter->handleq.ev_count = 0;
-	adapter->req.ev_count = 0;
 	adapter->efbig_tx_dma_setup.ev_count = 0;
 	adapter->mbuf_defrag_failed.ev_count = 0;
 	adapter->efbig2_tx_dma_setup.ev_count = 0;
@@ -1997,6 +1987,8 @@ ixgbe_clear_evcnt(struct adapter *adapte
 	txr = adapter->tx_rings;
 	for (int i = 0; i < adapter->num_queues; i++, rxr++, txr++) {
 		adapter->queues[i].irqs.ev_count = 0;
+		adapter->queues[i].handleq.ev_count = 0;
+		adapter->queues[i].req.ev_count = 0;
 		txr->no_desc_avail.ev_count = 0;
 		txr->total_packets.ev_count = 0;
 		txr->tso_tx.ev_count = 0;
@@ -2535,6 +2527,7 @@ ixgbe_msix_que(void *arg)
 
 no_calc:
 	if (more) {
+		que->req.ev_count++;
 		if (adapter->txrx_use_workqueue) {
 			/*
 			 * adapter->que_wq is bound to each CPU instead of
@@ -3376,8 +3369,6 @@ ixgbe_detach(device_t dev, int flags)
 	if_percpuq_destroy(adapter->ipq);
 
 	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);
@@ -3392,6 +3383,8 @@ 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(&adapter->queues[i].handleq);
+		evcnt_detach(&adapter->queues[i].req);
 		evcnt_detach(&txr->no_desc_avail);
 		evcnt_detach(&txr->total_packets);
 		evcnt_detach(&txr->tso_tx);
@@ -4724,9 +4717,10 @@ ixgbe_legacy_irq(void *arg)
 	    (eicr & IXGBE_EICR_GPI_SDP0_X540))
 		softint_schedule(adapter->phy_si);
 
-	if (more)
+	if (more) {
+		que->req.ev_count++;
 		softint_schedule(que->que_si);
-	else
+	} else
 		ixgbe_enable_intr(adapter);
 
 	return 1;
@@ -5825,7 +5819,7 @@ ixgbe_handle_que(void *context)
 	struct ifnet    *ifp = adapter->ifp;
 	bool		more = false;
 
-	adapter->handleq.ev_count++;
+	que->handleq.ev_count++;
 
 	if (ifp->if_flags & IFF_RUNNING) {
 		more = ixgbe_rxeof(que);
@@ -5843,6 +5837,7 @@ ixgbe_handle_que(void *context)
 	}
 
 	if (more) {
+		que->req.ev_count++;
 		if (adapter->txrx_use_workqueue) {
 			/*
 			 * "enqueued flag" is not required here.

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.33 src/sys/dev/pci/ixgbe/ixgbe.h:1.34
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.33	Tue Mar  6 03:47:23 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Wed Mar  7 03:29:10 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.33 2018/03/06 03:47:23 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.34 2018/03/07 03:29:10 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -335,6 +335,8 @@ struct ix_queue {
 	struct work      wq_cookie;
 	void             *que_si;
 	struct evcnt     irqs;
+	struct evcnt     handleq;
+	struct evcnt     req;
 	char             namebuf[32];
 	char             evnamebuf[32];
 
@@ -566,8 +568,6 @@ struct adapter {
 	struct evcnt	   	tso_err;
 	struct evcnt	   	watchdog_events;
 	struct evcnt		link_irq;
-	struct evcnt		handleq;
-	struct evcnt		req;
 
 	union {
 		struct ixgbe_hw_stats pf;

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.84 src/sys/dev/pci/ixgbe/ixv.c:1.85
--- src/sys/dev/pci/ixgbe/ixv.c:1.84	Fri Mar  2 10:21:01 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Mar  7 03:29:10 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.84 2018/03/02 10:21:01 knakahara Exp $*/
+/*$NetBSD: ixv.c,v 1.85 2018/03/07 03:29:10 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -640,8 +640,6 @@ ixv_detach(device_t dev, int flags)
 	if_percpuq_destroy(adapter->ipq);
 
 	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);
@@ -656,6 +654,8 @@ ixv_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(&adapter->queues[i].handleq);
+		evcnt_detach(&adapter->queues[i].req);
 		evcnt_detach(&txr->no_desc_avail);
 		evcnt_detach(&txr->total_packets);
 		evcnt_detach(&txr->tso_tx);
@@ -959,9 +959,10 @@ ixv_msix_que(void *arg)
 	rxr->packets = 0;
 
 no_calc:
-	if (more)
+	if (more) {
+		que->req.ev_count++;
 		softint_schedule(que->que_si);
-	else /* Re-enable this interrupt */
+	} else /* Re-enable this interrupt */
 		ixv_enable_queue(adapter, que->msix);
 
 	return 1;
@@ -2341,10 +2342,6 @@ ixv_add_stats_sysctls(struct adapter *ad
 	const char *xname = device_xname(dev);
 
 	/* Driver Statistics */
-	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,
@@ -2391,15 +2388,6 @@ ixv_add_stats_sysctls(struct adapter *ad
 		    (void *)&adapter->queues[i], 0, CTL_CREATE, CTL_EOL) != 0)
 			break;
 
-#if 0
-		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;
-#endif
-
 		if (sysctl_createv(log, 0, &rnode, &cnode,
 		    CTLFLAG_READONLY, CTLTYPE_INT,
 		    "txd_head", SYSCTL_DESCR("Transmit Descriptor Head"),
@@ -2416,6 +2404,11 @@ ixv_add_stats_sysctls(struct adapter *ad
 
 		evcnt_attach_dynamic(&adapter->queues[i].irqs, EVCNT_TYPE_INTR,
 		    NULL, adapter->queues[i].evnamebuf, "IRQs on queue");
+		evcnt_attach_dynamic(&adapter->queues[i].handleq,
+		    EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
+		    "Handled queue in softint");
+		evcnt_attach_dynamic(&adapter->queues[i].req, EVCNT_TYPE_MISC,
+		    NULL, adapter->queues[i].evnamebuf, "Requeued in softint");
 		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,
@@ -2804,7 +2797,7 @@ ixv_handle_que(void *context)
 	struct ifnet    *ifp = adapter->ifp;
 	bool		more;
 
-	adapter->handleq.ev_count++;
+	que->handleq.ev_count++;
 
 	if (ifp->if_flags & IFF_RUNNING) {
 		more = ixgbe_rxeof(que);
@@ -2820,7 +2813,7 @@ ixv_handle_que(void *context)
 			ixgbe_legacy_start_locked(ifp, txr);
 		IXGBE_TX_UNLOCK(txr);
 		if (more) {
-			adapter->req.ev_count++;
+			que->req.ev_count++;
 			if (adapter->txrx_use_workqueue) {
 				/*
 				 * "enqueued flag" is not required here

Reply via email to