Module Name:    src
Committed By:   msaitoh
Date:           Tue Mar  5 10:26:08 UTC 2019

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

Log Message:
 It's not required to calculate unused queues' statistics.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/dev/pci/ixgbe/ixgbe.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.175 src/sys/dev/pci/ixgbe/ixgbe.c:1.176
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.175	Tue Mar  5 09:42:36 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Mar  5 10:26:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.175 2019/03/05 09:42:36 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.176 2019/03/05 10:26:08 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -1570,7 +1570,8 @@ ixgbe_update_stats_counters(struct adapt
 	u32                   missed_rx = 0, bprc, lxon, lxoff, total;
 	u64                   total_missed_rx = 0;
 	uint64_t              crcerrs, rlec;
-	int		      i, j;
+	unsigned int          queue_counters;
+	int		      i;
 
 	crcerrs = IXGBE_READ_REG(hw, IXGBE_CRCERRS);
 	stats->crcerrs.ev_count += crcerrs;
@@ -1580,14 +1581,13 @@ ixgbe_update_stats_counters(struct adapt
 	if (hw->mac.type == ixgbe_mac_X550)
 		stats->mbsdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MBSDC);
 
-	/* 16 registers */
-	for (i = 0; i < __arraycount(stats->qprc); i++) {
-		j = i % adapter->num_queues;
-
-		stats->qprc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPRC(i));
-		stats->qptc[j].ev_count += IXGBE_READ_REG(hw, IXGBE_QPTC(i));
+	/* 16 registers exist */
+	queue_counters = uimin(__arraycount(stats->qprc), adapter->num_queues);
+	for (i = 0; i < queue_counters; i++) {
+		stats->qprc[i].ev_count += IXGBE_READ_REG(hw, IXGBE_QPRC(i));
+		stats->qptc[i].ev_count += IXGBE_READ_REG(hw, IXGBE_QPTC(i));
 		if (hw->mac.type >= ixgbe_mac_82599EB) {
-			stats->qprdc[j].ev_count
+			stats->qprdc[i].ev_count
 			    += IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
 		}
 	}

Reply via email to