Module Name:    src
Committed By:   msaitoh
Date:           Thu Sep  5 10:01:30 UTC 2019

Modified Files:
        src/share/man/man4: ixv.4
        src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Add support SIOCZIFDATA as ixgbe.c.

BUGS
     The following event counters are not cleared by SIOCZIFDATA because the
     corresponding registers are read only and not cleared on read:

           Good Packets Received
           Good Octets Received
           Multicast Packets Received
           Good Packets Transmitted
           Good Octets Transmitted


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/ixv.4
cvs rdiff -u -r1.130 -r1.131 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/share/man/man4/ixv.4
diff -u src/share/man/man4/ixv.4:1.4 src/share/man/man4/ixv.4:1.5
--- src/share/man/man4/ixv.4:1.4	Thu Jul 18 03:52:26 2019
+++ src/share/man/man4/ixv.4	Thu Sep  5 10:01:30 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ixv.4,v 1.4 2019/07/18 03:52:26 msaitoh Exp $
+.\"	$NetBSD: ixv.4,v 1.5 2019/09/05 10:01:30 msaitoh Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 18, 2019
+.Dd September 5, 2019
 .Dt IXV 4
 .Os
 .Sh NAME
@@ -61,3 +61,20 @@ The
 .Nm
 driver was written by
 .An Intel Corporation Aq Mt freebsd...@mailbox.intel.com .
+.Sh BUGS
+The following event counters are not cleared by
+.Dv SIOCZIFDATA
+because the corresponding registers are read only and not cleared on read:
+.Pp
+.Bl -item -offset indent -compact
+.It
+Good Packets Received
+.It
+Good Octets Received
+.It
+Multicast Packets Received
+.It
+Good Packets Transmitted
+.It
+Good Octets Transmitted
+.El

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.130 src/sys/dev/pci/ixgbe/ixv.c:1.131
--- src/sys/dev/pci/ixgbe/ixv.c:1.130	Wed Sep  4 10:34:04 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Sep  5 10:01:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.130 2019/09/04 10:34:04 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.131 2019/09/05 10:01:30 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -131,6 +131,7 @@ static void	ixv_save_stats(struct adapte
 static void	ixv_init_stats(struct adapter *);
 static void	ixv_update_stats(struct adapter *);
 static void	ixv_add_stats_sysctls(struct adapter *);
+static void	ixv_clear_evcnt(struct adapter *);
 
 /* Sysctl handlers */
 static void	ixv_set_sysctl_value(struct adapter *, const char *,
@@ -2630,6 +2631,76 @@ ixv_add_stats_sysctls(struct adapter *ad
 
 } /* ixv_add_stats_sysctls */
 
+static void
+ixv_clear_evcnt(struct adapter *adapter)
+{
+	struct tx_ring		*txr = adapter->tx_rings;
+	struct rx_ring		*rxr = adapter->rx_rings;
+	struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int i;
+
+	/* Driver Statistics */
+	adapter->efbig_tx_dma_setup.ev_count = 0;
+	adapter->mbuf_defrag_failed.ev_count = 0;
+	adapter->efbig2_tx_dma_setup.ev_count = 0;
+	adapter->einval_tx_dma_setup.ev_count = 0;
+	adapter->other_tx_dma_setup.ev_count = 0;
+	adapter->eagain_tx_dma_setup.ev_count = 0;
+	adapter->enomem_tx_dma_setup.ev_count = 0;
+	adapter->watchdog_events.ev_count = 0;
+	adapter->tso_err.ev_count = 0;
+	adapter->link_irq.ev_count = 0;
+
+	for (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->tso_tx.ev_count = 0;
+		txr->no_desc_avail.ev_count = 0;
+		txr->total_packets.ev_count = 0;
+#ifndef IXGBE_LEGACY_TX
+		txr->pcq_drops.ev_count = 0;
+#endif
+		txr->q_efbig_tx_dma_setup = 0;
+		txr->q_mbuf_defrag_failed = 0;
+		txr->q_efbig2_tx_dma_setup = 0;
+		txr->q_einval_tx_dma_setup = 0;
+		txr->q_other_tx_dma_setup = 0;
+		txr->q_eagain_tx_dma_setup = 0;
+		txr->q_enomem_tx_dma_setup = 0;
+		txr->q_tso_err = 0;
+
+		rxr->rx_packets.ev_count = 0;
+		rxr->rx_bytes.ev_count = 0;
+		rxr->rx_copies.ev_count = 0;
+		rxr->no_jmbuf.ev_count = 0;
+		rxr->rx_discarded.ev_count = 0;
+	}
+
+	/* MAC stats get their own sub node */
+
+	stats->ipcs.ev_count = 0;
+	stats->l4cs.ev_count = 0;
+	stats->ipcs_bad.ev_count = 0;
+	stats->l4cs_bad.ev_count = 0;
+
+	/* Packet Reception Stats */
+	stats->vfgprc.ev_count = 0;
+	stats->vfgorc.ev_count = 0;
+	stats->vfmprc.ev_count = 0;
+	stats->vfgptc.ev_count = 0;
+	stats->vfgotc.ev_count = 0;
+
+	/* Mailbox Stats */
+	hw->mbx.stats.msgs_tx.ev_count = 0;
+	hw->mbx.stats.msgs_rx.ev_count = 0;
+	hw->mbx.stats.acks.ev_count = 0;
+	hw->mbx.stats.reqs.ev_count = 0;
+	hw->mbx.stats.rsts.ev_count = 0;
+
+} /* ixv_clear_evcnt */
+
 /************************************************************************
  * ixv_set_sysctl_value
  ************************************************************************/
@@ -2863,6 +2934,11 @@ ixv_ioctl(struct ifnet *ifp, u_long comm
 	case SIOCSIFMTU:
 		IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)");
 		break;
+	case SIOCZIFDATA:
+		IOCTL_DEBUGOUT("ioctl: SIOCZIFDATA (Zero counter)");
+		ixv_update_stats(adapter);
+		ixv_clear_evcnt(adapter);
+		break;
 	default:
 		IOCTL_DEBUGOUT1("ioctl: UNKNOWN (0x%X)", (int)command);
 		break;

Reply via email to