Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/ixgbe Make some event counters MP safe. Now all ...
details: https://anonhg.NetBSD.org/src/rev/1960b5b3fe4e
branches: trunk
changeset: 321283:1960b5b3fe4e
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Mar 09 06:27:53 2018 +0000
description:
Make some event counters MP safe. Now all of the event counters are
MP safe.
diffstat:
sys/dev/pci/ixgbe/ix_txrx.c | 16 ++++++++--------
sys/dev/pci/ixgbe/ixgbe.c | 43 +++++++++++++++++++++++++++++++++++++++----
sys/dev/pci/ixgbe/ixgbe.h | 20 +++++++++++++++-----
sys/dev/pci/ixgbe/ixv.c | 31 +++++++++++++++++++++++++++++--
4 files changed, 91 insertions(+), 19 deletions(-)
diffs (250 lines):
diff -r 3b347be0f191 -r 1960b5b3fe4e sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c Fri Mar 09 02:36:28 2018 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c Fri Mar 09 06:27:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.34 2018/03/02 10:19:20 knakahara Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.35 2018/03/09 06:27:53 msaitoh Exp $ */
/******************************************************************************
@@ -392,10 +392,10 @@
switch (error) {
case EAGAIN:
- adapter->eagain_tx_dma_setup.ev_count++;
+ txr->q_eagain_tx_dma_setup++;
return EAGAIN;
case ENOMEM:
- adapter->enomem_tx_dma_setup.ev_count++;
+ txr->q_enomem_tx_dma_setup++;
return EAGAIN;
case EFBIG:
/* Try it again? - one try */
@@ -405,23 +405,23 @@
* XXX: m_defrag will choke on
* non-MCLBYTES-sized clusters
*/
- adapter->efbig_tx_dma_setup.ev_count++;
+ txr->q_efbig_tx_dma_setup++;
m = m_defrag(m_head, M_NOWAIT);
if (m == NULL) {
- adapter->mbuf_defrag_failed.ev_count++;
+ txr->q_mbuf_defrag_failed++;
return ENOBUFS;
}
m_head = m;
goto retry;
} else {
- adapter->efbig2_tx_dma_setup.ev_count++;
+ txr->q_efbig2_tx_dma_setup++;
return error;
}
case EINVAL:
- adapter->einval_tx_dma_setup.ev_count++;
+ txr->q_einval_tx_dma_setup++;
return error;
default:
- adapter->other_tx_dma_setup.ev_count++;
+ txr->q_other_tx_dma_setup++;
return error;
}
}
diff -r 3b347be0f191 -r 1960b5b3fe4e sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 09 02:36:28 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 09 06:27:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.133 2018/03/08 02:41:27 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.134 2018/03/09 06:27:53 msaitoh Exp $ */
/******************************************************************************
@@ -1980,8 +1980,8 @@
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->tso_err.ev_count = 0;
adapter->watchdog_events.ev_count = 0;
- adapter->tso_err.ev_count = 0;
adapter->link_irq.ev_count = 0;
txr = adapter->tx_rings;
@@ -1995,6 +1995,14 @@
#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;
if (i < __arraycount(stats->mpc)) {
stats->mpc[i].ev_count = 0;
@@ -4190,7 +4198,9 @@
device_t dev = adapter->dev;
struct ix_queue *que = adapter->queues;
u64 queues = 0;
+ u64 v0, v1, v2, v3, v4, v5, v6, v7;
int hung = 0;
+ int i;
KASSERT(mutex_owned(&adapter->core_mtx));
@@ -4202,12 +4212,37 @@
ixgbe_update_link_status(adapter);
ixgbe_update_stats_counters(adapter);
+ /* Update some event counters */
+ v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = 0;
+ que = adapter->queues;
+ for (i = 0; i < adapter->num_queues; i++, que++) {
+ struct tx_ring *txr = que->txr;
+
+ v0 += txr->q_efbig_tx_dma_setup;
+ v1 += txr->q_mbuf_defrag_failed;
+ v2 += txr->q_efbig2_tx_dma_setup;
+ v3 += txr->q_einval_tx_dma_setup;
+ v4 += txr->q_other_tx_dma_setup;
+ v5 += txr->q_eagain_tx_dma_setup;
+ v6 += txr->q_enomem_tx_dma_setup;
+ v7 += txr->q_tso_err;
+ }
+ adapter->efbig_tx_dma_setup.ev_count = v0;
+ adapter->mbuf_defrag_failed.ev_count = v1;
+ adapter->efbig2_tx_dma_setup.ev_count = v2;
+ adapter->einval_tx_dma_setup.ev_count = v3;
+ adapter->other_tx_dma_setup.ev_count = v4;
+ adapter->eagain_tx_dma_setup.ev_count = v5;
+ adapter->enomem_tx_dma_setup.ev_count = v6;
+ adapter->tso_err.ev_count = v7;
+
/*
* Check the TX queues status
* - mark hung queues so we don't schedule on them
* - watchdog only if all queues show hung
*/
- for (int i = 0; i < adapter->num_queues; i++, que++) {
+ que = adapter->queues;
+ for (i = 0; i < adapter->num_queues; i++, que++) {
/* Keep track of queues with work for soft irq */
if (que->txr->busy)
queues |= ((u64)1 << que->me);
@@ -4239,7 +4274,7 @@
goto watchdog;
else if (queues != 0) { /* Force an IRQ on queues with work */
que = adapter->queues;
- for (int i = 0; i < adapter->num_queues; i++, que++) {
+ for (i = 0; i < adapter->num_queues; i++, que++) {
mutex_enter(&que->im_mtx);
if (que->im_nest == 0)
ixgbe_rearm_queues(adapter,
diff -r 3b347be0f191 -r 1960b5b3fe4e sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Fri Mar 09 02:36:28 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Fri Mar 09 06:27:53 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.34 2018/03/07 03:29:10 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.35 2018/03/09 06:27:53 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -334,9 +334,10 @@
struct rx_ring *rxr;
struct work wq_cookie;
void *que_si;
- struct evcnt irqs;
- struct evcnt handleq;
- struct evcnt req;
+ /* Per queue event conters */
+ struct evcnt irqs; /* Hardware interrupt */
+ struct evcnt handleq; /* software_interrupt */
+ struct evcnt req; /* deferred */
char namebuf[32];
char evnamebuf[32];
@@ -378,6 +379,15 @@
struct evcnt no_desc_avail;
struct evcnt total_packets;
struct evcnt pcq_drops;
+ /* Per queue conters. The adapter total is in struct adapter */
+ u64 q_efbig_tx_dma_setup;
+ u64 q_mbuf_defrag_failed;
+ u64 q_efbig2_tx_dma_setup;
+ u64 q_einval_tx_dma_setup;
+ u64 q_other_tx_dma_setup;
+ u64 q_eagain_tx_dma_setup;
+ u64 q_enomem_tx_dma_setup;
+ u64 q_tso_err;
};
@@ -558,8 +568,8 @@
void (*stop_locked)(void *);
/* Misc stats maintained by the driver */
+ struct evcnt efbig_tx_dma_setup;
struct evcnt mbuf_defrag_failed;
- struct evcnt efbig_tx_dma_setup;
struct evcnt efbig2_tx_dma_setup;
struct evcnt einval_tx_dma_setup;
struct evcnt other_tx_dma_setup;
diff -r 3b347be0f191 -r 1960b5b3fe4e sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c Fri Mar 09 02:36:28 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c Fri Mar 09 06:27:53 2018 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.86 2018/03/07 08:01:32 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.87 2018/03/09 06:27:53 msaitoh Exp $*/
/******************************************************************************
@@ -1194,7 +1194,9 @@
device_t dev = adapter->dev;
struct ix_queue *que = adapter->queues;
u64 queues = 0;
+ u64 v0, v1, v2, v3, v4, v5, v6, v7;
int hung = 0;
+ int i;
KASSERT(mutex_owned(&adapter->core_mtx));
@@ -1203,12 +1205,37 @@
/* Stats Update */
ixv_update_stats(adapter);
+ /* Update some event counters */
+ v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = 0;
+ que = adapter->queues;
+ for (i = 0; i < adapter->num_queues; i++, que++) {
+ struct tx_ring *txr = que->txr;
+
+ v0 += txr->q_efbig_tx_dma_setup;
+ v1 += txr->q_mbuf_defrag_failed;
+ v2 += txr->q_efbig2_tx_dma_setup;
+ v3 += txr->q_einval_tx_dma_setup;
+ v4 += txr->q_other_tx_dma_setup;
+ v5 += txr->q_eagain_tx_dma_setup;
+ v6 += txr->q_enomem_tx_dma_setup;
+ v7 += txr->q_tso_err;
+ }
+ adapter->efbig_tx_dma_setup.ev_count = v0;
+ adapter->mbuf_defrag_failed.ev_count = v1;
+ adapter->efbig2_tx_dma_setup.ev_count = v2;
+ adapter->einval_tx_dma_setup.ev_count = v3;
+ adapter->other_tx_dma_setup.ev_count = v4;
+ adapter->eagain_tx_dma_setup.ev_count = v5;
+ adapter->enomem_tx_dma_setup.ev_count = v6;
+ adapter->tso_err.ev_count = v7;
+
/*
* Check the TX queues status
* - mark hung queues so we don't schedule on them
* - watchdog only if all queues show hung
*/
- for (int i = 0; i < adapter->num_queues; i++, que++) {
+ que = adapter->queues;
+ for (i = 0; i < adapter->num_queues; i++, que++) {
/* Keep track of queues with work for soft irq */
if (que->txr->busy)
queues |= ((u64)1 << que->me);
Home |
Main Index |
Thread Index |
Old Index